summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-05-05 16:12:54 +0400
committerAlexander Barkov <bar@mariadb.org>2017-05-05 16:12:54 +0400
commitac53b49b1be807f588aebd83883ec93b764f5d54 (patch)
treec86cbdb535eefb15e2077a7ac2ffaeff9d76955e
parent583b68e89961c35fa95a06c38988f82e33c73f4a (diff)
parentdb0917f68f2681882974afd53935aa8cba29c6b8 (diff)
downloadmariadb-git-ac53b49b1be807f588aebd83883ec93b764f5d54.tar.gz
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
-rw-r--r--client/mysqldump.c14
-rw-r--r--cmake/cpu_info.cmake27
-rw-r--r--cmake/libutils.cmake2
-rw-r--r--cmake/wsrep.cmake2
-rw-r--r--debian/mariadb-server-10.2.install1
-rw-r--r--extra/innochecksum.cc5
-rw-r--r--man/CMakeLists.txt4
-rw-r--r--man/my_safe_process.116
-rw-r--r--man/tokuft_logdump.116
-rw-r--r--mysql-test/include/assert_grep.inc154
-rw-r--r--mysql-test/include/diff_servers.inc67
-rw-r--r--mysql-test/include/galera_wait_ready.inc2
-rw-r--r--mysql-test/include/have_innodb_max_16k.inc4
-rw-r--r--mysql-test/include/mysqlhotcopy.inc2
-rw-r--r--mysql-test/r/check_constraint.result2
-rw-r--r--mysql-test/r/create_drop_binlog.result2
-rw-r--r--mysql-test/r/create_drop_view.result2
-rw-r--r--mysql-test/r/cte_nonrecursive.result18
-rw-r--r--mysql-test/r/cte_recursive.result326
-rw-r--r--mysql-test/r/default.result15
-rw-r--r--mysql-test/r/derived_cond_pushdown.result103
-rw-r--r--mysql-test/r/drop.result8
-rw-r--r--mysql-test/r/func_json.result13
-rw-r--r--mysql-test/r/gis-rt-precise.result2
-rw-r--r--mysql-test/r/gis-rtree.result2
-rw-r--r--mysql-test/r/grant.result2
-rw-r--r--mysql-test/r/keyread.result6
-rw-r--r--mysql-test/r/loadxml.result11
-rw-r--r--mysql-test/r/mysqldump.result49
-rw-r--r--mysql-test/r/profiling.result2
-rw-r--r--mysql-test/r/sp-group.result2
-rw-r--r--mysql-test/r/sp.result2
-rw-r--r--mysql-test/r/subselect.result14
-rw-r--r--mysql-test/r/subselect_no_exists_to_in.result14
-rw-r--r--mysql-test/r/subselect_no_mat.result14
-rw-r--r--mysql-test/r/subselect_no_opts.result14
-rw-r--r--mysql-test/r/subselect_no_scache.result14
-rw-r--r--mysql-test/r/subselect_no_semijoin.result14
-rw-r--r--mysql-test/r/type_time.result16
-rw-r--r--mysql-test/r/view.result2
-rw-r--r--mysql-test/r/win.result30
-rw-r--r--mysql-test/std_data/loaddata/mdev12696.xml9
-rw-r--r--mysql-test/suite/binlog/r/flashback.result5
-rw-r--r--mysql-test/suite/binlog/t/flashback.test4
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result6
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result6
-rw-r--r--mysql-test/suite/galera/disabled.def22
-rw-r--r--mysql-test/suite/galera/galera_2nodes.cnf9
-rw-r--r--mysql-test/suite/galera/galera_2nodes_as_master_slave.cnf83
-rw-r--r--mysql-test/suite/galera/galera_2nodes_as_master_with_repl_filter.cnf87
-rw-r--r--mysql-test/suite/galera/r/GAL-401.result24
-rw-r--r--mysql-test/suite/galera/r/GAL-419.result4
-rw-r--r--mysql-test/suite/galera/r/GAL-480.result39
-rw-r--r--mysql-test/suite/galera/r/MW-313.result32
-rw-r--r--mysql-test/suite/galera/r/MW-328A.result27
-rw-r--r--mysql-test/suite/galera/r/MW-328B.result23
-rw-r--r--mysql-test/suite/galera/r/MW-328C.result23
-rw-r--r--mysql-test/suite/galera/r/MW-328D.result20
-rw-r--r--mysql-test/suite/galera/r/MW-328E.result20
-rw-r--r--mysql-test/suite/galera/r/MW-329.result20
-rw-r--r--mysql-test/suite/galera/r/ev51914.result173
-rw-r--r--mysql-test/suite/galera/r/galera_account_management.result9
-rw-r--r--mysql-test/suite/galera/r/galera_admin.result56
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort.result8
-rw-r--r--mysql-test/suite/galera/r/galera_defaults.result2
-rw-r--r--mysql-test/suite/galera/r/galera_desync_overlapped.result50
-rw-r--r--mysql-test/suite/galera/r/galera_gcache_recover.result18
-rw-r--r--mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result19
-rw-r--r--mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result107
-rw-r--r--mysql-test/suite/galera/r/galera_many_tables_pk.result11
-rw-r--r--mysql-test/suite/galera/r/galera_restart_on_unknown_option.result40
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result23
-rw-r--r--mysql-test/suite/galera/r/galera_toi_drop_database.result32
-rw-r--r--mysql-test/suite/galera/r/galera_toi_truncate.result22
-rw-r--r--mysql-test/suite/galera/r/galera_var_cluster_address.result1
-rw-r--r--mysql-test/suite/galera/r/galera_var_retry_autocommit.result32
-rw-r--r--mysql-test/suite/galera/r/galera_var_slave_threads.result1
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_log_conficts.result25
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result5
-rw-r--r--mysql-test/suite/galera/r/lp1376747-2.result23
-rw-r--r--mysql-test/suite/galera/r/lp1376747-3.result27
-rw-r--r--mysql-test/suite/galera/r/lp1376747-4.result47
-rw-r--r--mysql-test/suite/galera/r/lp1376747.result23
-rw-r--r--mysql-test/suite/galera/r/pxc-421.result42
-rw-r--r--mysql-test/suite/galera/t/GAL-401.test51
-rw-r--r--mysql-test/suite/galera/t/GAL-419.test35
-rw-r--r--mysql-test/suite/galera/t/GAL-480.test46
-rw-r--r--mysql-test/suite/galera/t/MW-258.test2
-rw-r--r--mysql-test/suite/galera/t/MW-313-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-313.test51
-rw-r--r--mysql-test/suite/galera/t/MW-328-footer.inc18
-rw-r--r--mysql-test/suite/galera/t/MW-328-header.inc29
-rw-r--r--mysql-test/suite/galera/t/MW-328A.test56
-rw-r--r--mysql-test/suite/galera/t/MW-328B.test36
-rw-r--r--mysql-test/suite/galera/t/MW-328C.test36
-rw-r--r--mysql-test/suite/galera/t/MW-328D.test40
-rw-r--r--mysql-test/suite/galera/t/MW-328E.test41
-rw-r--r--mysql-test/suite/galera/t/MW-329-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-329.test82
-rw-r--r--mysql-test/suite/galera/t/ev51914.test214
-rw-r--r--mysql-test/suite/galera/t/galera#414.test4
-rw-r--r--mysql-test/suite/galera/t/galera_account_management.test14
-rw-r--r--mysql-test/suite/galera/t/galera_admin.test86
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort.test13
-rw-r--r--mysql-test/suite/galera/t/galera_desync_overlapped.test59
-rw-r--r--mysql-test/suite/galera/t/galera_flush_local.opt2
-rw-r--r--mysql-test/suite/galera/t/galera_gcache_recover.cnf7
-rw-r--r--mysql-test/suite/galera/t/galera_gcache_recover.test77
-rw-r--r--mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf9
-rw-r--r--mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test59
-rw-r--r--mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf9
-rw-r--r--mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test216
-rw-r--r--mysql-test/suite/galera/t/galera_many_tables_pk.test25
-rw-r--r--mysql-test/suite/galera/t/galera_restart_on_unknown_option.test150
-rw-r--r--mysql-test/suite/galera/t/galera_roles.test1
-rw-r--r--mysql-test/suite/galera/t/galera_toi_ddl_fk_update.test49
-rw-r--r--mysql-test/suite/galera/t/galera_toi_drop_database.test56
-rw-r--r--mysql-test/suite/galera/t/galera_toi_truncate.test43
-rw-r--r--mysql-test/suite/galera/t/galera_var_cluster_address.test2
-rw-r--r--mysql-test/suite/galera/t/galera_var_retry_autocommit.test98
-rw-r--r--mysql-test/suite/galera/t/galera_var_slave_threads.test2
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_log_conficts.test55
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test20
-rw-r--r--mysql-test/suite/galera/t/lp1376747-2.test22
-rw-r--r--mysql-test/suite/galera/t/lp1376747-3.test28
-rw-r--r--mysql-test/suite/galera/t/lp1376747-4.test53
-rw-r--r--mysql-test/suite/galera/t/lp1376747.test24
-rw-r--r--mysql-test/suite/galera/t/pxc-421.test60
-rw-r--r--mysql-test/suite/galera_3nodes/galera_3nodes.cnf8
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result26
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test163
-rw-r--r--mysql-test/suite/gcol/inc/gcol_column_def_options.inc2
-rw-r--r--mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result2
-rw-r--r--mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result2
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_debug.result30
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_fk.result98
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_debug.test30
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_fk.test86
-rw-r--r--mysql-test/suite/innodb/include/innodb_isolation_selects.inc15
-rw-r--r--mysql-test/suite/innodb/r/autoinc_debug.result100
-rw-r--r--mysql-test/suite/innodb/r/autoinc_persist.result16
-rw-r--r--mysql-test/suite/innodb/r/deadlock_detect.result30
-rw-r--r--mysql-test/suite/innodb/r/foreign_key.result152
-rw-r--r--mysql-test/suite/innodb/r/ibuf_not_empty.result25
-rw-r--r--mysql-test/suite/innodb/r/innodb-index-online-norebuild.result26
-rw-r--r--mysql-test/suite/innodb/r/innodb-isolation.result1411
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522,xtradb.rdiff-disabled56
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522-debug.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-wl5522.result14
-rw-r--r--mysql-test/suite/innodb/r/innodb_force_recovery.result90
-rw-r--r--mysql-test/suite/innodb/r/innodb_gis.result9
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_del_mark.result91
-rw-r--r--mysql-test/suite/innodb/r/insert_debug.result20
-rw-r--r--mysql-test/suite/innodb/r/readahead.result6
-rw-r--r--mysql-test/suite/innodb/r/redo_log_during_checkpoint.result25
-rw-r--r--mysql-test/suite/innodb/r/truncate_debug.result86
-rw-r--r--mysql-test/suite/innodb/r/truncate_purge_debug.result29
-rw-r--r--mysql-test/suite/innodb/t/autoinc_debug.test85
-rw-r--r--mysql-test/suite/innodb/t/autoinc_persist.test21
-rw-r--r--mysql-test/suite/innodb/t/deadlock_detect.test55
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test115
-rw-r--r--mysql-test/suite/innodb/t/ibuf_not_empty.test54
-rw-r--r--mysql-test/suite/innodb/t/innodb-index-online-norebuild.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb-index-online-norebuild.test71
-rw-r--r--mysql-test/suite/innodb/t/innodb-isolation.test354
-rw-r--r--mysql-test/suite/innodb/t/innodb-wl5522-debug.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_force_recovery.test139
-rw-r--r--mysql-test/suite/innodb/t/innodb_gis.test9
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_del_mark-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_del_mark.test113
-rw-r--r--mysql-test/suite/innodb/t/insert_debug.test32
-rw-r--r--mysql-test/suite/innodb/t/readahead.test22
-rw-r--r--mysql-test/suite/innodb/t/redo_log_during_checkpoint.test75
-rw-r--r--mysql-test/suite/innodb/t/truncate_debug.test122
-rw-r--r--mysql-test/suite/innodb/t/truncate_purge_debug.opt3
-rw-r--r--mysql-test/suite/innodb/t/truncate_purge_debug.test66
-rw-r--r--mysql-test/suite/innodb_gis/r/0.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/alter_spatial_index.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/create_spatial_index.result5
-rw-r--r--mysql-test/suite/innodb_gis/r/rt_precise.result3
-rw-r--r--mysql-test/suite/innodb_gis/r/rtree.result647
-rw-r--r--mysql-test/suite/innodb_gis/t/rtree.test623
-rw-r--r--mysql-test/suite/innodb_undo/include/have_undo_tablespaces.inc4
-rw-r--r--mysql-test/suite/innodb_undo/include/truncate_recover.inc8
-rw-r--r--mysql-test/suite/innodb_undo/r/truncate.result11
-rw-r--r--mysql-test/suite/innodb_undo/r/truncate_multi_client.result51
-rw-r--r--mysql-test/suite/innodb_undo/r/truncate_recover.result15
-rw-r--r--mysql-test/suite/innodb_undo/t/truncate.test72
-rw-r--r--mysql-test/suite/innodb_undo/t/truncate_multi_client.test77
-rw-r--r--mysql-test/suite/innodb_undo/t/truncate_recover.test50
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree-dynamic.result4
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree-trans.result4
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_create_drop_view.result2
-rw-r--r--mysql-test/suite/sql_sequence/create.result14
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_deadlock_detect_basic.result56
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_max_undo_log_size_basic.result12
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff4
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result40
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_wsrep.result2
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_deadlock_detect_basic.test53
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_max_undo_log_size_basic.test8
-rw-r--r--mysql-test/suite/wsrep/r/binlog_format.result2
-rw-r--r--mysql-test/suite/wsrep/r/wsrep_rpl.result4
-rw-r--r--mysql-test/suite/wsrep/t/binlog_format.test2
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_rpl.test10
-rw-r--r--mysql-test/t/check_constraint.test6
-rw-r--r--mysql-test/t/cte_nonrecursive.test19
-rw-r--r--mysql-test/t/cte_recursive.test267
-rw-r--r--mysql-test/t/default.test14
-rw-r--r--mysql-test/t/derived_cond_pushdown.test99
-rw-r--r--mysql-test/t/func_json.test22
-rw-r--r--mysql-test/t/keyread.test10
-rw-r--r--mysql-test/t/loadxml.test13
-rw-r--r--mysql-test/t/mysqldump.test12
-rw-r--r--mysql-test/t/subselect.test17
-rw-r--r--mysql-test/t/win.test21
-rw-r--r--plugin/aws_key_management/CMakeLists.txt10
-rw-r--r--plugin/user_variables/CMakeLists.txt3
-rw-r--r--plugin/user_variables/mysql-test/user_variables/basic.result2
-rw-r--r--plugin/user_variables/mysql-test/user_variables/suite.pm3
-rw-r--r--plugin/user_variables/user_variables.cc2
-rw-r--r--scripts/CMakeLists.txt1
-rwxr-xr-x[-rw-r--r--]scripts/wsrep_sst_common0
-rw-r--r--sql/field.h27
-rw-r--r--sql/handler.h5
-rw-r--r--sql/item.cc20
-rw-r--r--sql/item.h54
-rw-r--r--sql/item_func.cc12
-rw-r--r--sql/item_func.h10
-rw-r--r--sql/item_geofunc.cc4
-rw-r--r--sql/item_jsonfunc.cc14
-rw-r--r--sql/item_subselect.cc45
-rw-r--r--sql/item_subselect.h8
-rw-r--r--sql/log_event.cc5
-rw-r--r--sql/mysqld.cc8
-rw-r--r--sql/opt_sum.cc2
-rw-r--r--sql/rpl_parallel.cc3
-rw-r--r--sql/share/errmsg-utf8.txt2
-rw-r--r--sql/slave.cc3
-rw-r--r--sql/sql_cte.cc72
-rw-r--r--sql/sql_cte.h21
-rw-r--r--sql/sql_derived.cc20
-rw-r--r--sql/sql_derived.h4
-rw-r--r--sql/sql_load.cc61
-rw-r--r--sql/sql_select.cc62
-rw-r--r--sql/sql_select.h2
-rw-r--r--sql/sql_union.cc14
-rw-r--r--sql/sql_window.cc7
-rw-r--r--sql/sys_vars.cc15
-rw-r--r--sql/table.cc25
-rw-r--r--sql/table.h2
-rw-r--r--sql/wsrep_hton.cc2
-rw-r--r--sql/wsrep_mysqld.h1
-rw-r--r--sql/wsrep_thd.cc33
-rw-r--r--storage/innobase/btr/btr0btr.cc41
-rw-r--r--storage/innobase/btr/btr0cur.cc6
-rw-r--r--storage/innobase/btr/btr0defragment.cc4
-rw-r--r--storage/innobase/btr/btr0scrub.cc21
-rw-r--r--storage/innobase/btr/btr0sea.cc37
-rw-r--r--storage/innobase/buf/buf0buf.cc445
-rw-r--r--storage/innobase/buf/buf0dblwr.cc20
-rw-r--r--storage/innobase/buf/buf0dump.cc6
-rw-r--r--storage/innobase/buf/buf0flu.cc42
-rw-r--r--storage/innobase/buf/buf0lru.cc80
-rw-r--r--storage/innobase/buf/buf0rea.cc21
-rw-r--r--storage/innobase/data/data0data.cc2
-rw-r--r--storage/innobase/dict/dict0boot.cc6
-rw-r--r--storage/innobase/dict/dict0dict.cc10
-rw-r--r--storage/innobase/dict/dict0mem.cc7
-rw-r--r--storage/innobase/dict/dict0stats.cc50
-rw-r--r--storage/innobase/dict/dict0stats_bg.cc10
-rw-r--r--storage/innobase/fil/fil0crypt.cc98
-rw-r--r--storage/innobase/fil/fil0fil.cc249
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc75
-rw-r--r--storage/innobase/fts/fts0config.cc6
-rw-r--r--storage/innobase/fts/fts0fts.cc35
-rw-r--r--storage/innobase/fts/fts0opt.cc7
-rw-r--r--storage/innobase/fts/fts0que.cc3
-rw-r--r--storage/innobase/gis/gis0rtree.cc6
-rw-r--r--storage/innobase/ha/ha0ha.cc29
-rw-r--r--storage/innobase/handler/ha_innodb.cc429
-rw-r--r--storage/innobase/handler/ha_innodb.h5
-rw-r--r--storage/innobase/handler/ha_innopart.cc37
-rw-r--r--storage/innobase/handler/ha_innopart.h4
-rw-r--r--storage/innobase/handler/handler0alter.cc131
-rw-r--r--storage/innobase/handler/i_s.cc6
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc27
-rw-r--r--storage/innobase/include/btr0sea.h2
-rw-r--r--storage/innobase/include/buf0buf.h130
-rw-r--r--storage/innobase/include/buf0buf.ic1
-rw-r--r--storage/innobase/include/buf0dblwr.h15
-rw-r--r--storage/innobase/include/dict0dict.ic17
-rw-r--r--storage/innobase/include/fil0crypt.h8
-rw-r--r--storage/innobase/include/fil0fil.h124
-rw-r--r--storage/innobase/include/fil0fil.ic24
-rw-r--r--storage/innobase/include/fil0pagecompress.h31
-rw-r--r--storage/innobase/include/fsp0pagecompress.ic66
-rw-r--r--storage/innobase/include/fts0fts.h10
-rw-r--r--storage/innobase/include/ha_prototypes.h1
-rw-r--r--storage/innobase/include/lock0lock.h5
-rw-r--r--storage/innobase/include/log0log.h8
-rw-r--r--storage/innobase/include/mtr0log.ic20
-rw-r--r--storage/innobase/include/mtr0mtr.h10
-rw-r--r--storage/innobase/include/os0file.h13
-rw-r--r--storage/innobase/include/os0thread.h14
-rw-r--r--storage/innobase/include/page0page.ic2
-rw-r--r--storage/innobase/include/page0zip.h14
-rw-r--r--storage/innobase/include/pars0grm.h193
-rw-r--r--storage/innobase/include/row0mysql.h5
-rw-r--r--storage/innobase/include/srv0mon.h27
-rw-r--r--storage/innobase/include/srv0srv.h35
-rw-r--r--storage/innobase/include/srv0start.h2
-rw-r--r--storage/innobase/include/sync0types.h26
-rw-r--r--storage/innobase/include/trx0rseg.h5
-rw-r--r--storage/innobase/include/trx0rseg.ic8
-rw-r--r--storage/innobase/include/trx0sys.h6
-rw-r--r--storage/innobase/include/trx0trx.h60
-rw-r--r--storage/innobase/include/univ.i80
-rw-r--r--storage/innobase/lock/lock0lock.cc100
-rw-r--r--storage/innobase/log/log0log.cc23
-rw-r--r--storage/innobase/log/log0recv.cc36
-rw-r--r--storage/innobase/mach/mach0data.cc65
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc27
-rw-r--r--storage/innobase/os/os0file.cc66
-rw-r--r--storage/innobase/os/os0thread.cc31
-rw-r--r--storage/innobase/page/page0cur.cc3
-rw-r--r--storage/innobase/page/page0zip.cc32
-rw-r--r--storage/innobase/pars/pars0grm.cc1769
-rw-r--r--storage/innobase/pars/pars0grm.y6
-rw-r--r--storage/innobase/pars/pars0sym.cc16
-rw-r--r--storage/innobase/rem/rem0rec.cc50
-rw-r--r--storage/innobase/row/row0ftsort.cc22
-rw-r--r--storage/innobase/row/row0import.cc138
-rw-r--r--storage/innobase/row/row0ins.cc30
-rw-r--r--storage/innobase/row/row0log.cc45
-rw-r--r--storage/innobase/row/row0merge.cc99
-rw-r--r--storage/innobase/row/row0mysql.cc51
-rw-r--r--storage/innobase/row/row0purge.cc20
-rw-r--r--storage/innobase/row/row0trunc.cc21
-rw-r--r--storage/innobase/row/row0uins.cc20
-rw-r--r--storage/innobase/row/row0umod.cc35
-rw-r--r--storage/innobase/srv/srv0mon.cc6
-rw-r--r--storage/innobase/srv/srv0srv.cc403
-rw-r--r--storage/innobase/srv/srv0start.cc45
-rw-r--r--storage/innobase/sync/sync0arr.cc56
-rw-r--r--storage/innobase/sync/sync0debug.cc260
-rw-r--r--storage/innobase/trx/trx0i_s.cc4
-rw-r--r--storage/innobase/trx/trx0purge.cc58
-rw-r--r--storage/innobase/trx/trx0roll.cc5
-rw-r--r--storage/innobase/trx/trx0rseg.cc2
-rw-r--r--storage/innobase/trx/trx0sys.cc35
-rw-r--r--storage/innobase/trx/trx0trx.cc116
-rw-r--r--storage/innobase/ut/ut0ut.cc9
-rw-r--r--storage/rocksdb/CMakeLists.txt7
-rw-r--r--storage/spider/ha_spider.cc80
-rw-r--r--storage/spider/ha_spider.h2
-rw-r--r--storage/spider/spd_db_handlersocket.cc9
-rw-r--r--storage/spider/spd_db_handlersocket.h3
-rw-r--r--storage/spider/spd_db_include.h3
-rw-r--r--storage/spider/spd_db_mysql.cc59
-rw-r--r--storage/spider/spd_db_mysql.h3
-rw-r--r--storage/spider/spd_db_oracle.cc59
-rw-r--r--storage/spider/spd_db_oracle.h3
-rw-r--r--storage/xtradb/btr/btr0btr.cc2
-rw-r--r--storage/xtradb/btr/btr0defragment.cc2
-rw-r--r--storage/xtradb/buf/buf0buf.cc141
-rw-r--r--storage/xtradb/buf/buf0dblwr.cc8
-rw-r--r--storage/xtradb/buf/buf0flu.cc16
-rw-r--r--storage/xtradb/buf/buf0rea.cc14
-rw-r--r--storage/xtradb/dict/dict0stats.cc4
-rw-r--r--storage/xtradb/fil/fil0crypt.cc61
-rw-r--r--storage/xtradb/fil/fil0fil.cc80
-rw-r--r--storage/xtradb/fil/fil0pagecompress.cc124
-rw-r--r--storage/xtradb/include/buf0buf.h18
-rw-r--r--storage/xtradb/include/dict0dict.ic101
-rw-r--r--storage/xtradb/include/fil0crypt.h6
-rw-r--r--storage/xtradb/include/fil0fil.h37
-rw-r--r--storage/xtradb/include/fil0fil.ic60
-rw-r--r--storage/xtradb/include/fil0pagecompress.h30
-rw-r--r--storage/xtradb/include/fsp0pagecompress.ic63
-rw-r--r--storage/xtradb/include/os0file.h12
-rw-r--r--storage/xtradb/include/os0sync.h5
-rw-r--r--storage/xtradb/include/srv0mon.h63
-rw-r--r--storage/xtradb/include/trx0trx.h17
-rw-r--r--storage/xtradb/include/univ.i28
-rw-r--r--storage/xtradb/lock/lock0lock.cc8
-rw-r--r--storage/xtradb/log/log0recv.cc6
-rw-r--r--storage/xtradb/os/os0file.cc184
-rw-r--r--storage/xtradb/row/row0ftsort.cc7
-rw-r--r--storage/xtradb/row/row0import.cc130
-rw-r--r--storage/xtradb/row/row0merge.cc155
-rw-r--r--storage/xtradb/srv/srv0mon.cc6
-rw-r--r--storage/xtradb/srv/srv0srv.cc4
-rw-r--r--storage/xtradb/sync/sync0arr.cc48
-rw-r--r--storage/xtradb/trx/trx0trx.cc112
-rw-r--r--strings/json_lib.c1
398 files changed, 15182 insertions, 4342 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 281a7a6c7f2..99fcbdb4250 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -114,7 +114,8 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_m
opt_slave_apply= 0,
opt_include_master_host_port= 0,
opt_events= 0, opt_comments_used= 0,
- opt_alltspcs=0, opt_notspcs= 0, opt_logging;
+ opt_alltspcs=0, opt_notspcs= 0, opt_logging,
+ opt_drop_trigger= 0 ;
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*mysql=0;
@@ -233,6 +234,9 @@ static struct my_option my_long_options[] =
{"add-drop-table", OPT_DROP, "Add a DROP TABLE before each create.",
&opt_drop, &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
+ {"add-drop-trigger", 0, "Add a DROP TRIGGER before each create.",
+ &opt_drop_trigger, &opt_drop_trigger, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
+ 0},
{"add-locks", OPT_LOCKS, "Add locks around INSERT statements.",
&opt_lock, &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
@@ -3281,6 +3285,10 @@ static void dump_trigger_old(FILE *sql_file, MYSQL_RES *show_triggers_rs,
if (opt_compact)
fprintf(sql_file, "/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n");
+ if (opt_drop_trigger)
+ fprintf(sql_file, "/*!50032 DROP TRIGGER IF EXISTS %s */;\n",
+ (*show_trigger_row)[0]);
+
fprintf(sql_file,
"DELIMITER ;;\n"
"/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n"
@@ -3361,6 +3369,10 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
switch_sql_mode(sql_file, ";", row[1]);
+ if (opt_drop_trigger)
+ fprintf(sql_file, "/*!50032 DROP TRIGGER IF EXISTS %s */;\n",
+ row[0]);
+
query_str= cover_definer_clause(row[2], strlen(row[2]),
C_STRING_WITH_LEN("50017"),
C_STRING_WITH_LEN("50003"),
diff --git a/cmake/cpu_info.cmake b/cmake/cpu_info.cmake
index 7c2c08a07db..c53759d24d6 100644
--- a/cmake/cpu_info.cmake
+++ b/cmake/cpu_info.cmake
@@ -15,12 +15,25 @@
# Symbols with information about the CPU.
-FIND_PROGRAM(GETCONF getconf)
-MARK_AS_ADVANCED(GETCONF)
+IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ FIND_PROGRAM(SYSCTL sysctl)
+ MARK_AS_ADVANCED(SYSCTL)
-IF(GETCONF)
- EXECUTE_PROCESS(
- COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE
- OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
- )
+ IF(SYSCTL)
+ EXECUTE_PROCESS(
+ COMMAND ${SYSCTL} -n hw.cachelinesize
+ OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
+ )
+ ENDIF()
+
+ELSE()
+ FIND_PROGRAM(GETCONF getconf)
+ MARK_AS_ADVANCED(GETCONF)
+
+ IF(GETCONF)
+ EXECUTE_PROCESS(
+ COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE
+ OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
+ )
+ ENDIF()
ENDIF()
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
index 0965ec8cb83..67b14b72828 100644
--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -188,7 +188,7 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
# binaries properly)
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
COMMAND rm ${TARGET_LOCATION}
- COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION}
+ COMMAND libtool -static -o ${TARGET_LOCATION}
${STATIC_LIBS}
)
ELSE()
diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake
index 067a9f128a2..0a1c7dd9697 100644
--- a/cmake/wsrep.cmake
+++ b/cmake/wsrep.cmake
@@ -26,7 +26,7 @@ ENDIF()
OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default})
# Set the patch version
-SET(WSREP_PATCH_VERSION "16")
+SET(WSREP_PATCH_VERSION "19")
# Obtain wsrep API version
FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION
diff --git a/debian/mariadb-server-10.2.install b/debian/mariadb-server-10.2.install
index 7ab6ccd7c7a..3b5a475f486 100644
--- a/debian/mariadb-server-10.2.install
+++ b/debian/mariadb-server-10.2.install
@@ -56,7 +56,6 @@ usr/lib/mysql/plugin/semisync_slave.so
usr/lib/mysql/plugin/server_audit.so
usr/lib/mysql/plugin/simple_password_check.so
usr/lib/mysql/plugin/sql_errlog.so
-usr/lib/mysql/plugin/user_variables.so
usr/lib/mysql/plugin/wsrep_info.so
usr/share/apport/package-hooks/source_mariadb-10.2.py
usr/share/doc/mariadb-server-10.2/mysqld.sym.gz
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index fa50ca72867..238a5a80ac5 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -571,7 +571,6 @@ is_page_corrupted(
if (mach_read_from_4(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0) {
is_corrupted = fil_space_verify_crypt_checksum(
const_cast<byte*>(buf), page_size,
- strict_verify, is_log_enabled ? log_file : NULL,
mach_read_from_4(buf
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID),
cur_page_num);
@@ -581,9 +580,7 @@ is_page_corrupted(
if (is_corrupted) {
is_corrupted = buf_page_is_corrupted(
- true, buf, page_size, NULL,
- cur_page_num, strict_verify,
- is_log_enabled, log_file);
+ true, buf, page_size, NULL);
}
return(is_corrupted);
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
index f24c5c95d69..f5899577a47 100644
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -26,7 +26,7 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1
mysqld_safe_helper.1 tokuftdump.1 wsrep_sst_common.1
wsrep_sst_mysqldump.1 wsrep_sst_rsync.1
wsrep_sst_xtrabackup-v2.1 wsrep_sst_xtrabackup.1
- galera_recovery.1 galera_new_cluster.1)
+ galera_recovery.1 galera_new_cluster.1 tokuft_logdump.1)
SET(MAN8_SERVER mysqld.8)
SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1
mysqlaccess.1 mysqladmin.1 mysqlbinlog.1 mysqlcheck.1
@@ -34,7 +34,7 @@ SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1
mysql_plugin.1)
SET(MAN1_DEVEL mysql_config.1)
SET(MAN1_TEST mysql-stress-test.pl.1 mysql-test-run.pl.1 mysql_client_test.1
- mysqltest_embedded.1 mysql_client_test_embedded.1)
+ mysqltest_embedded.1 mysql_client_test_embedded.1 my_safe_process.1)
INSTALL(FILES ${MAN1_SERVER} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesServer)
INSTALL(FILES ${MAN8_SERVER} DESTINATION ${INSTALL_MANDIR}/man8 COMPONENT ManPagesServer)
diff --git a/man/my_safe_process.1 b/man/my_safe_process.1
new file mode 100644
index 00000000000..fac8ed69fc8
--- /dev/null
+++ b/man/my_safe_process.1
@@ -0,0 +1,16 @@
+'\" t
+.\"
+.TH "\FBMY_SAFE_PROCESS\FR" "1" "29 March 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH NAME
+my_safe_process \- Utility program that encapsulates process creation, monitoring and bulletproof process cleanup
+.SH DESCRIPTION
+Use: safe_process [options to safe_process] -- progname arg1 \.\.\. argn\.
+.PP
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/man/tokuft_logdump.1 b/man/tokuft_logdump.1
new file mode 100644
index 00000000000..f6cf08080f7
--- /dev/null
+++ b/man/tokuft_logdump.1
@@ -0,0 +1,16 @@
+'\" t
+.\"
+.TH "\FBTOKUFT_LOGPRINT\FR" "1" "27 March 2017" "MariaDB 10\&.1" "MariaDB Database System"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH NAME
+tokuft_logprint \- Dump the log from stdin to stdout
+.SH DESCRIPTION
+Use: Dump the log from stdin to stdout\.
+.PP
+For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/
diff --git a/mysql-test/include/assert_grep.inc b/mysql-test/include/assert_grep.inc
new file mode 100644
index 00000000000..a980a6d73b1
--- /dev/null
+++ b/mysql-test/include/assert_grep.inc
@@ -0,0 +1,154 @@
+# ==== Purpose ====
+#
+# Grep a file for a pattern, produce a single string out of the
+# matching lines, and assert that the string matches a given regular
+# expression.
+#
+# ==== Usage ====
+#
+# --let $assert_text= TEXT
+# --let $assert_file= FILE
+# --let $assert_select= REGEX
+# [--let $assert_match= REGEX | --let $assert_count= NUMBER]
+# [--let $assert_only_after= REGEX]
+# --source include/assert_grep.inc
+#
+# Parameters:
+#
+# $assert_text
+# Text that describes what is being checked. This text is written to
+# the query log so it should not contain non-deterministic elements.
+#
+# $assert_file
+# File to search.
+#
+# $assert_select
+# All lines matching this text will be checked.
+#
+# $assert_match
+# The script will find all lines that match $assert_select,
+# concatenate them to a long string, and assert that it matches
+# $assert_match.
+#
+# $assert_count
+# Instead of asserting that the selected lines match
+# $assert_match, assert that there were exactly $assert_count
+# matching lines.
+#
+# $assert_only_after
+# Reset all the lines matched and the counter when finding this pattern.
+# It is useful for searching things in the mysqld.err log file just
+# after the last server restart for example (discarding the log content
+# of previous server executions).
+
+
+if (!$assert_text)
+{
+ --die !!!ERROR IN TEST: you must set $assert_text
+}
+if (!$assert_file)
+{
+ --die !!!ERROR IN TEST: you must set $assert_file
+}
+if (!$assert_select)
+{
+ --die !!!ERROR IN TEST: you must set $assert_select
+}
+if ($assert_match == '')
+{
+ if ($assert_count == '')
+ {
+ --die !!!ERROR IN TEST: you must set either $assert_match or $assert_count
+ }
+}
+if ($assert_match != '')
+{
+ if ($assert_count != '')
+ {
+ --echo assert_text='$assert_text' assert_count='$assert_count'
+ --die !!!ERROR IN TEST: you must set only one of $assert_match or $assert_count
+ }
+}
+
+
+--let $include_filename= assert_grep.inc [$assert_text]
+--source include/begin_include_file.inc
+
+
+--let _AG_ASSERT_TEXT= $assert_text
+--let _AG_ASSERT_FILE= $assert_file
+--let _AG_ASSERT_SELECT= $assert_select
+--let _AG_ASSERT_MATCH= $assert_match
+--let _AG_ASSERT_COUNT= $assert_count
+--let _AG_OUT= `SELECT CONCAT('$MYSQLTEST_VARDIR/tmp/_ag_', UUID())`
+--let _AG_ASSERT_ONLY_AFTER= $assert_only_after
+
+
+--perl
+ use strict;
+ use warnings;
+ my $file= $ENV{'_AG_ASSERT_FILE'};
+ my $assert_select= $ENV{'_AG_ASSERT_SELECT'};
+ my $assert_match= $ENV{'_AG_ASSERT_MATCH'};
+ my $assert_count= $ENV{'_AG_ASSERT_COUNT'};
+ my $assert_only_after= $ENV{'_AG_ASSERT_ONLY_AFTER'};
+ my $out= $ENV{'_AG_OUT'};
+
+ my $result= '';
+ my $count= 0;
+ open(FILE, "$file") or die("Error $? opening $file: $!\n");
+ while (<FILE>) {
+ my $line = $_;
+ if ($assert_only_after && $line =~ /$assert_only_after/) {
+ $result = "";
+ $count = 0;
+ }
+ if ($line =~ /$assert_select/) {
+ if ($assert_count ne '') {
+ $count++;
+ }
+ else {
+ $result .= $line;
+ }
+ }
+ }
+ close(FILE) or die("Error $? closing $file: $!");
+ open OUT, "> $out" or die("Error $? opening $out: $!");
+ if ($assert_count ne '' && ($count != $assert_count)) {
+ print OUT ($count) or die("Error $? writing $out: $!");
+ }
+ elsif ($assert_count eq '' && $result !~ /$assert_match/) {
+ print OUT ($result) or die("Error $? writing $out: $!");
+ }
+ else {
+ print OUT ("assert_grep.inc ok");
+ }
+ close OUT or die("Error $? closing $out: $!");
+EOF
+
+
+--let $_ag_outcome= `SELECT LOAD_FILE('$_AG_OUT')`
+if ($_ag_outcome != 'assert_grep.inc ok')
+{
+ --source include/show_rpl_debug_info.inc
+ --echo include/assert_grep.inc failed!
+ --echo assert_text: '$assert_text'
+ --echo assert_file: '$assert_file'
+ --echo assert_select: '$assert_select'
+ --echo assert_match: '$assert_match'
+ --echo assert_count: '$assert_count'
+ --echo assert_only_after: '$assert_only_after'
+ if ($assert_match != '')
+ {
+ --echo matching lines: '$_ag_outcome'
+ }
+ if ($assert_count != '')
+ {
+ --echo number of matching lines: $_ag_outcome
+ }
+ --die assert_grep.inc failed.
+}
+
+
+--let $include_filename= include/assert_grep.inc [$assert_text]
+--source include/end_include_file.inc
diff --git a/mysql-test/include/diff_servers.inc b/mysql-test/include/diff_servers.inc
new file mode 100644
index 00000000000..5ec7efc38b9
--- /dev/null
+++ b/mysql-test/include/diff_servers.inc
@@ -0,0 +1,67 @@
+# ==== Purpose ====
+#
+# Check that two or more servers have identical databases; fail if not.
+#
+# ==== Usage ====
+#
+# --let $diff_servers= 1 2
+# [--let $databases= db1 db2 ...]
+# [--let $rpl_debug= 1]
+# --source include/diff_servers.inc
+
+# pretty-print header
+--let $_ds_info= servers=$diff_servers
+if ($databases != '')
+{
+ --let $_ds_info= $_ds_info databases=$databases
+}
+--let $include_filename= diff_servers.inc [$_ds_info]
+--source include/begin_include_file.inc
+
+# get databases
+--let $_ds_databases= $diff_database
+if ($_ds_databases == '')
+{
+ --let $_ds_databases= `SELECT GROUP_CONCAT(SCHEMA_NAME SEPARATOR ' ') FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('information_schema', 'mtr', 'mysql', 'performance_schema')`
+}
+
+# generate command line
+--let $_ds_arg= --defaults-group-suffix=.
+--let $_ds_number_pos= `SELECT LOCATE('$_ds_arg', '$MYSQL_DUMP') + LENGTH('$_ds_arg')`
+--let $_ds_pre_command= `SELECT SUBSTR('$MYSQL_DUMP', 1, $_ds_number_pos - 1)`
+--let $_ds_post_command= `SELECT SUBSTR('$MYSQL_DUMP', $_ds_number_pos + 1)`
+--let $_ds_post_command= $_ds_post_command --compact --order-by-primary --skip-extended-insert --no-create-info --databases $_ds_databases
+--let $_ds_prev_outfile=
+
+# iterate over servers
+--let $_ds_servers= $diff_servers
+while ($_ds_servers != '')
+{
+ --let $_ds_server_number= `SELECT SUBSTRING_INDEX('$_ds_servers', ' ', 1)`
+ --let $_ds_servers= `SELECT TRIM(SUBSTRING('$_ds_servers', 1 + LENGTH('_$ds_server_number')))`
+ --let $_ds_outfile= $MYSQLTEST_VARDIR/tmp/diff_servers_$_ds_server_number
+
+ if ($rpl_debug)
+ {
+ --echo generating dump from server '$_ds_server_number' using command '$_ds_pre_command$_ds_server_number $_ds_post_command > $_ds_outfile'
+ --echo remaining servers: '$_ds_servers'
+ }
+ --exec $_ds_pre_command$_ds_server_number $_ds_post_command > $_ds_outfile
+
+ if ($_ds_prev_outfile != '')
+ {
+ if ($rpl_debug)
+ {
+ --echo diffing files '$_ds_prev_outfile' and '$_ds_outfile'
+ }
+ --diff_files $_ds_prev_outfile $_ds_outfile
+
+ --remove_file $_ds_prev_outfile
+ }
+ --let $_ds_prev_outfile= $_ds_outfile
+}
+
+--remove_file $_ds_prev_outfile
+
+--let $include_filename= diff_servers.inc [servers=$_ds_info]
+--source include/end_include_file.inc
diff --git a/mysql-test/include/galera_wait_ready.inc b/mysql-test/include/galera_wait_ready.inc
new file mode 100644
index 00000000000..e20f01fad90
--- /dev/null
+++ b/mysql-test/include/galera_wait_ready.inc
@@ -0,0 +1,2 @@
+let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' AND VARIABLE_VALUE = 'ON';
+--source include/wait_condition.inc
diff --git a/mysql-test/include/have_innodb_max_16k.inc b/mysql-test/include/have_innodb_max_16k.inc
new file mode 100644
index 00000000000..f8346666299
--- /dev/null
+++ b/mysql-test/include/have_innodb_max_16k.inc
@@ -0,0 +1,4 @@
+if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_page_size' AND variable_value <= 16384`)
+{
+ --skip Test requires InnoDB with page size not greater than 16k.
+}
diff --git a/mysql-test/include/mysqlhotcopy.inc b/mysql-test/include/mysqlhotcopy.inc
index f775d782b28..2fc14d599d9 100644
--- a/mysql-test/include/mysqlhotcopy.inc
+++ b/mysql-test/include/mysqlhotcopy.inc
@@ -109,7 +109,7 @@ DROP DATABASE hotcopy_save;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_save
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
---error 1
+--error 1,9,11,110,2304,255
--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet --allowold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
diff --git a/mysql-test/r/check_constraint.result b/mysql-test/r/check_constraint.result
index 7447550ed09..fcda0a84fcb 100644
--- a/mysql-test/r/check_constraint.result
+++ b/mysql-test/r/check_constraint.result
@@ -140,6 +140,8 @@ create table t1 (a int, b int, check(a>0));
alter table t1 drop column a;
ERROR 42S22: Unknown column 'a' in 'CHECK'
drop table t1;
+create or replace table t1( c1 int auto_increment primary key, check( c1 > 0 or c1 is null ) );
+ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the CHECK clause of `c1`
create table t1 (a int check (@b in (select user from mysql.user)));
ERROR HY000: Function or expression 'select ...' cannot be used in the CHECK clause of `a`
create table t1 (a int check (a > @b));
diff --git a/mysql-test/r/create_drop_binlog.result b/mysql-test/r/create_drop_binlog.result
index 5a14ed5def9..dc9c1da2c14 100644
--- a/mysql-test/r/create_drop_binlog.result
+++ b/mysql-test/r/create_drop_binlog.result
@@ -160,7 +160,7 @@ Note 1050 Table 'v1' already exists
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4067 Unknown VIEW: 'test.v1'
+Note 4068 Unknown VIEW: 'test.v1'
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# # Format_desc 1 # VER
diff --git a/mysql-test/r/create_drop_view.result b/mysql-test/r/create_drop_view.result
index fc9dca3ea2e..117f7b851c6 100644
--- a/mysql-test/r/create_drop_view.result
+++ b/mysql-test/r/create_drop_view.result
@@ -55,5 +55,5 @@ id
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4067 Unknown VIEW: 'test.v1'
+Note 4068 Unknown VIEW: 'test.v1'
DROP TABLE t1;
diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result
index 5b773067f13..317d8bd05df 100644
--- a/mysql-test/r/cte_nonrecursive.result
+++ b/mysql-test/r/cte_nonrecursive.result
@@ -962,7 +962,7 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with alias1 as (select 1 AS `one`), alias2 as (select 2 AS `two`)select `alias1`.`one` AS `one`,`alias2`.`two` AS `two` from (`alias1` join `alias2`) latin1 latin1_swedish_ci
drop view v1;
#
-# MDEV-12440: the same CTE table is used in twice
+# MDEV-12440: the same CTE table is used twice
#
create table t1 (a int, b varchar(32));
insert into t1 values
@@ -984,3 +984,19 @@ select * from cte3;
a b
4 dd
drop table t1;
+#
+# MDEV-12558: CTE with the same name as temporary table
+#
+CREATE TABLE t ENGINE=MyISAM AS SELECT 1 AS i;
+CREATE TEMPORARY TABLE cte ENGINE=MyISAM AS SELECT 2 AS f;
+WITH cte AS ( SELECT i FROM t ) SELECT * FROM cte;
+i
+1
+WITH cte AS ( SELECT i FROM t GROUP BY i) SELECT * FROM cte;
+i
+1
+SELECT * FROM cte;
+f
+2
+DROP TABLE cte;
+DROP TABLE t;
diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result
index 207a2ca3549..f691db27239 100644
--- a/mysql-test/r/cte_recursive.result
+++ b/mysql-test/r/cte_recursive.result
@@ -2560,3 +2560,329 @@ m
m1
m2
drop table value_nodes, module_nodes, module_arguments, module_results;
+#
+# mdev-12519: recursive references in subqueries
+#
+create table t1 (lp char(4) not null, rp char(4) not null);
+insert into t1 values
+('p1','p2'), ('p2','p3'), ('p3','p4'), ('p4','p5'),
+('p2','p7'), ('p7','p8'), ('p8','p3'), ('p8','p4');
+set standard_compliant_cte=0;
+with recursive
+reachables(p) as
+(
+select lp from t1 where lp = 'p1'
+ union
+select t1.rp from reachables, t1
+where t1.lp = reachables.p
+)
+select * from reachables;
+p
+p1
+p2
+p3
+p7
+p4
+p8
+p5
+with recursive
+reachables(p) as
+(
+select lp from t1 where lp = 'p1'
+ union
+select t1.rp from reachables, t1
+where 'p3' not in (select * from reachables) and
+t1.lp = reachables.p
+)
+select * from reachables;
+p
+p1
+p2
+p3
+p7
+with recursive
+reachables(p) as
+(
+select lp from t1 where lp = 'p1'
+ union
+select t1.rp from reachables, t1
+where 'p3' not in (select p from reachables where p <= 'p5'
+ union
+select p from reachables where p > 'p5') and
+t1.lp = reachables.p
+)
+select * from reachables;
+p
+p1
+p2
+p3
+p7
+prepare stmt from "
+with recursive
+reachables(p) as
+(
+ select lp from t1 where lp = 'p1'
+ union
+ select t1.rp from reachables, t1
+ where 'p3' not in (select p from reachables where p <= 'p5'
+ union
+ select p from reachables where p > 'p5') and
+ t1.lp = reachables.p
+)
+select * from reachables;
+";
+execute stmt;
+p
+p1
+p2
+p3
+p7
+execute stmt;
+p
+p1
+p2
+p3
+p7
+deallocate prepare stmt;
+drop table t1;
+create table objects(v char(4) not null);
+insert into objects values
+('v1'), ('v2'), ('v3'), ('v4'), ('v5'),
+('v6'), ('v7'), ('v8'), ('v9'), ('v10');
+create table modules(m char(4) not null);
+insert into modules values
+('m1'), ('m2'), ('m3'), ('m4');
+create table module_arguments(m char(4) not null, v char(4) not null);
+insert into module_arguments values
+('m1','v3'), ('m1','v9'),
+('m2','v4'), ('m2','v7'),
+('m3','v6'), ('m4','v2');
+create table module_results(m char(4) not null, v char(4) not null);
+insert into module_results values
+('m1','v4'),
+('m2','v1'), ('m2','v6'),
+('m3','v10'), ('m4','v7');
+set standard_compliant_cte=0;
+with recursive
+reached_objects as
+(
+select v, 'init' as m from objects where v in ('v3','v7','v9')
+union
+select module_results.v, module_results.m from module_results, applied_modules
+where module_results.m = applied_modules.m
+),
+applied_modules as
+(
+select * from modules where 1=0
+union
+select modules.m
+from
+modules
+where
+not exists (select * from module_arguments
+where module_arguments.m = modules.m and
+module_arguments.v not in
+(select v from reached_objects))
+)
+select * from reached_objects;
+v m
+v3 init
+v7 init
+v9 init
+v4 m1
+v1 m2
+v6 m2
+v10 m3
+with recursive
+reached_objects as
+(
+select v, 'init' as m from objects where v in ('v3','v7','v9')
+union
+select module_results.v, module_results.m from module_results, applied_modules
+where module_results.m = applied_modules.m
+),
+applied_modules as
+(
+select * from modules where 1=0
+union
+select modules.m
+from
+modules
+where
+'v6' not in (select v from reached_objects) and
+not exists (select * from module_arguments
+where module_arguments.m = modules.m and
+module_arguments.v not in
+(select v from reached_objects))
+)
+select * from reached_objects;
+v m
+v3 init
+v7 init
+v9 init
+v4 m1
+v1 m2
+v6 m2
+prepare stmt from "
+with recursive
+reached_objects as
+(
+ select v, 'init' as m from objects where v in ('v3','v7','v9')
+ union
+ select module_results.v, module_results.m from module_results, applied_modules
+ where module_results.m = applied_modules.m
+),
+applied_modules as
+(
+ select * from modules where 1=0
+ union
+ select modules.m
+ from
+ modules
+ where
+ 'v6' not in (select v from reached_objects) and
+ not exists (select * from module_arguments
+ where module_arguments.m = modules.m and
+ module_arguments.v not in
+ (select v from reached_objects))
+)
+select * from reached_objects;
+";
+execute stmt;
+v m
+v3 init
+v7 init
+v9 init
+v4 m1
+v1 m2
+v6 m2
+execute stmt;
+v m
+v3 init
+v7 init
+v9 init
+v4 m1
+v1 m2
+v6 m2
+deallocate prepare stmt;
+drop table objects, modules, module_arguments, module_results;
+set standard_compliant_cte=default;
+select @@standard_compliant_cte;
+@@standard_compliant_cte
+1
+#
+# mdev-12554: impossible where in recursive select
+#
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES (1),(2);
+WITH RECURSIVE
+cte(f) AS ( SELECT i FROM t1 UNION SELECT f FROM t1, cte WHERE 1=0 )
+SELECT * FROM cte;
+f
+1
+2
+DROP TABLE t1;
+#
+# mdev-12556: recursive execution uses Aria temporary tables
+#
+CREATE TABLE t (c1 varchar(255), c2 tinytext);
+INSERT INTO t VALUES ('a','a'),('b','b'),('c','c'),('d','d');
+ANALYZE WITH RECURSIVE cte(f) AS (
+SELECT c1 FROM t
+UNION
+SELECT c1 FROM t, cte
+) SELECT COUNT(*) FROM cte;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+2 SUBQUERY t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join)
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
+WITH RECURSIVE cte(f) AS (
+SELECT c1 FROM t
+UNION
+SELECT c1 FROM t, cte
+) SELECT COUNT(*) FROM cte;
+COUNT(*)
+4
+ANALYZE WITH RECURSIVE cte(f) AS (
+SELECT c2 FROM t
+UNION
+SELECT c2 FROM t, cte
+) SELECT COUNT(*) FROM cte;
+id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+2 SUBQUERY t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
+3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join)
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
+WITH RECURSIVE cte(f) AS (
+SELECT c2 FROM t
+UNION
+SELECT c2 FROM t, cte
+) SELECT COUNT(*) FROM cte;
+COUNT(*)
+4
+DROP TABLE t;
+#
+# mdev-12563: no recursive references on the top level of the CTE spec
+#
+CREATE TABLE t (i int);
+INSERT INTO t VALUES (3), (1),(2);
+SET standard_compliant_cte=0;
+WITH RECURSIVE cte(f) AS (
+SELECT i FROM t
+UNION
+SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte )
+) SELECT * FROM cte;
+f
+3
+1
+2
+WITH RECURSIVE cte(f) AS (
+SELECT i FROM t
+UNION
+SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte WHERE i < 2 )
+UNION
+SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte WHERE i > 2 )
+) SELECT * FROM cte;
+f
+3
+1
+2
+WITH RECURSIVE cte(f) AS (
+SELECT i FROM t
+UNION
+SELECT i FROM t
+WHERE i NOT IN ( SELECT * FROM cte WHERE i < 2
+UNION
+SELECT * FROM cte WHERE i > 2)
+) SELECT * FROM cte;
+f
+3
+1
+2
+WITH RECURSIVE cte(f) AS (
+SELECT i FROM t
+UNION
+SELECT i FROM t
+WHERE i NOT IN ( SELECT * FROM t
+WHERE i IN ( SELECT * FROM cte ) GROUP BY i )
+) SELECT * FROM cte;
+f
+3
+1
+2
+WITH RECURSIVE cte(f) AS (
+SELECT i FROM t
+UNION
+SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte )
+UNION
+SELECT * FROM cte WHERE f > 2
+) SELECT * FROM cte;
+f
+3
+1
+2
+set standard_compliant_cte=default;
+DROP TABLE t;
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result
index 548c533c12e..253cb412146 100644
--- a/mysql-test/r/default.result
+++ b/mysql-test/r/default.result
@@ -1932,6 +1932,21 @@ SELECT * FROM t1;
a b c
2003-02-01 2003-05-01 12:05:55 128885
DROP TABLE t1;
+CREATE OR REPLACE TABLE t1 ( col INT DEFAULT ( 1 LIKE ( NOW() BETWEEN '2000-01-01' AND '2012-12-12' ) ) );
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `col` int(11) DEFAULT (1 like (current_timestamp() between '2000-01-01' and '2012-12-12'))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SET timestamp = UNIX_TIMESTAMP( '2004-04-04' );
+INSERT INTO t1 VALUES( DEFAULT );
+SET timestamp = DEFAULT;
+INSERT INTO t1 VALUES( DEFAULT );
+SELECT * FROM t1;
+col
+1
+0
+DROP TABLE t1;
#
# Hybrid type functions
#
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index 34310be1e2a..a662ebba8c5 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -8035,7 +8035,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
- "attached_condition": "sq.i = 2007-05-28 00:00:00",
+ "attached_condition": "sq.i = '2007-05-28 00:00:00'",
"materialized": {
"query_block": {
"select_id": 2,
@@ -8087,7 +8087,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
- "attached_condition": "sq.i = 2007-05-28",
+ "attached_condition": "sq.i = '2007-05-28'",
"materialized": {
"query_block": {
"select_id": 2,
@@ -8139,7 +8139,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
- "attached_condition": "sq.i = 10:00:02",
+ "attached_condition": "sq.i = '10:00:02'",
"materialized": {
"query_block": {
"select_id": 2,
@@ -8366,3 +8366,100 @@ DEALLOCATE PREPARE stmt1;
DEALLOCATE PREPARE stmt2;
DROP VIEW v1;
DROP TABLE t1,t2;
+#
+# MDEV-12373: pushdown into derived with side effects is prohibited
+#
+CREATE TABLE sales_documents (
+id int NOT NULL AUTO_INCREMENT,
+sale_id int NULL DEFAULT NULL,
+type tinyint unsigned NULL DEFAULT NULL,
+data text NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
+date date NULL DEFAULT NULL,
+order_number int unsigned NULL DEFAULT NULL,
+created_at int NULL DEFAULT NULL,
+updated_at int NULL DEFAULT NULL,
+generated tinyint NOT NULL DEFAULT '0',
+synced_at int NOT NULL DEFAULT '0',
+sum decimal(13,2) NOT NULL DEFAULT '0',
+PRIMARY KEY (id)
+);
+INSERT INTO sales_documents
+(id, sale_id, type, order_number, data, created_at,
+updated_at, date, generated, synced_at, sum)
+VALUES
+(555, 165, 3, 5, '{}', 1486538300, 1486722835, '2017-02-17', 0, 1486538313, 2320.00),
+(556, 165, 2, 3, '{}', 1486538304, 1486563125, '2017-02-08', 1, 1486538302, 2320.00),
+(557, 158, 2, 2, '{}', 1486538661, 1486538661, '2017-02-08', 0, 1486538660, 2320.00),
+(558, 171, 1, 3, '{}', 1486539104, 1488203405, '2017-02-08', 1, 1486539102, 23230.00),
+(559, 171, 2, 5, '{}', 1486549233, 1487146010, '2017-02-08', 1, 1486549225, 37690.00),
+(560, 172, 1, 1, '{}', 1486658260, 1488203409, '2017-02-09', 1, 1486658256, 40312.00),
+(561, 172, 2, 1, '{}', 1486711997, 1486711997, '2017-02-10', 1, 1486711996, 40312.00),
+(562, 172, 3, 1, '{}', 1486712104, 1486721395, '2017-02-10', 1, 1486712101, 40312.00),
+(563, 171, 3, 2, '{}', 1486712953, 1486720244, '2017-02-10', 1, 1486712910, 23230.00),
+(564, 170, 1, 2, '{}', 1486715948, 1488203410, '2017-02-10', 1, 1486715930, 28873.00),
+(565, 170, 3, 3, '{}', 1486716782, 1486717426, '2017-02-10', 1, 1486716779, 61948.00),
+(566, 166, 3, 4, '{}', 1486720947, 1486720947, '2017-02-10', 1, 1486720945, 4640.00),
+(567, 167, 3, 5, '{}', 1486722741, 1486722783, '2017-02-26', 0, 1486722738, 14755.00),
+(568, 165, 1, 4, '{}', 1486722849, 1486722849, '2017-02-10', 0, 1486722846, 2320.00),
+(569, 173, 2, 2, '{}', 1486723073, 1487071275, '2017-02-10', 1, 1486723071, 14282.00),
+(570, 173, 1, 4, '{}', 1486723100, 1488203412, '2017-02-10', 1, 1486723099, 14282.00),
+(571, 167, 2, 4, '{}', 1486730859, 1486730859, '2017-02-10', 1, 1486730856, 18655.00),
+(572, 167, 1, 5, '{}', 1486730883, 1488203412, '2017-02-10', 1, 1486730877, 18655.00),
+(573, 174, 2, 51, '{}', 1486731622, 1487060259, '2017-02-10', 1, 1486731620, 7140.00),
+(574, 174, 3, 5, '{}', 1486993472, 1486993472, '2017-02-13', 1, 1488216147, 28020.00),
+(575, 174, 1, 6, '{}', 1486993530, 1488203412, '2017-02-13', 1, 1486993505, 7140.00),
+(576, 173, 3, 6, '{}', 1487071425, 1487071425, '2017-02-14', 0, 1487071422, 14282.00),
+(577, 178, 2, 6, '{}', 1487327372, 1487327372, '2017-02-17', 1, 1487327370, 12321.00),
+(578, 177, 2, 7, '{}', 1487327394, 1487327394, '2017-02-17', 0, 1487327391, 4270.00),
+(579, 182, 3, 6, '{}', 1487750589, 1487751693, '2017-02-22', 1, 1487751688, 4270.00),
+(580, 182, 2, 7, '{}', 1487750601, 1487750663, '2017-02-22', 1, 1487750598, 4270.00),
+(581, 182, 1, 7, '{}', 1487750694, 1488203412, '2017-02-22', 1, 1487750692, 4270.00),
+(582, 185, 3, 7, '{}', 1487774051, 1487774051, '2017-02-22', 0, 1487774043, 8913.00),
+(583, 184, 3, 7, '{}', 1487774071, 1487774235, '2017-02-22', 0, 1487774093, 3285.00),
+(584, 184, 2, 8, '{}', 1487774074, 1487774074, '2017-02-22', 0, 1487774073, 3285.00),
+(585, 184, 1, 8, '{}', 1487774081, 1487774081, '2017-02-22', 0, 1487774075, 3285.00),
+(586, 193, 2, 8, '{}', 1487955294, 1487955318, '2017-02-24', 0, 1487955311, 4270.00),
+(587, 193, 1, 8, '{}', 1487955324, 1487955324, '2017-02-24', 0, 1487955320, 4270.00),
+(588, 193, 3, 7, '{}', 1487955341, 1487955341, '2017-02-24', 0, 1487955325, 4270.00),
+(589, 186, 1, 8, '{}', 1487957291, 1487957464, '2017-02-24', 0, 1487957459, 6960.00),
+(590, 186, 2, 8, '{}', 1487957308, 1487957468, '2017-02-24', 0, 1487957465, 6960.00),
+(591, 186, 3, 7, '{}', 1487957312, 1487957473, '2017-02-24', 0, 1487957469, 6960.00),
+(592, 194, 1, 8, '{}', 1488193293, 1488203412, '2017-02-27', 1, 1488193280, 2320.00),
+(593, 194, 2, 8, '{}', 1488193304, 1488193304, '2017-02-27', 1, 1488193303, 2320.00),
+(594, 210, 1, 9, '{}', 1488198896, 1488198896, '2017-02-27', 0, 1488198885, 4270.00),
+(595, 210, 2, 12, '{}', 1488198901, 1488198901, '2017-02-27', 1, 1488532585, 4270.00),
+(596, 210, 3, 10, '{}', 1488198904, 1488198904, '2017-02-27', 1, 1488532565, 4270.00),
+(597, 209, 2, 9, '{}', 1488200016, 1488450772, '2017-02-27', 1, 1488450449, 4270.00),
+(598, 209, 1, 9, '{}', 1488200020, 1488200063, '2017-02-27', 1, 1488200017, 4271.00),
+(599, 209, 3, 7, '{}', 1488200053, 1488200053, '2017-02-27', 0, 1488200021, 4271.00),
+(600, 211, 2, 10, '{}', 1488216265, 1489402027, '2017-02-27', 1, 1488216264, 2320.00),
+(601, 211, 3, 7, '{}', 1488216281, 1488216281, '2017-02-27', 1, 1488216276, 2320.00),
+(602, 211, 1, 10, '{}', 1488216283, 1488216283, '2017-02-27', 1, 1488216282, 2320.00),
+(603, 198, 2, 11, '{}', 1488280125, 1488280125, '2017-02-28', 0, 1488280095, 4270.00),
+(604, 198, 1, 11, '{}', 1488280160, 1488280160, '2017-02-28', 0, 1488280126, 4270.00),
+(605, 198, 3, 8, '{}', 1488280440, 1488280440, '2017-02-28', 0, 1488280435, 4270.00),
+(606, 212, 1, 12, '{}', 1488286301, 1489402168, '2017-02-28', 1, 1488286295, 13825.00),
+(607, 212, 3, 8, '{}', 1488289644, 1488289690, '2017-02-28', 1, 1488289642, 25295.00),
+(608, 212, 2, 13, '{}', 1488290350, 1488290431, '2017-02-28', 1, 1488290347, 13133.75),
+(609, 213, 1, 11, '{}', 1488529470, 1488529470, '2017-03-03', 1, 1488529461, 5660.00),
+(610, 213, 2, 11, '{}', 1488529484, 1488529484, '2017-03-03', 1, 1488529479, 5660.00),
+(611, 213, 3, 9, '{}', 1488529493, 1488529493, '2017-03-03', 1, 1488529489, 5660.00),
+(612, 197, 2, 13, '{}', 1489400715, 1489400715, '2017-03-13', 0, 1489398959, 4270.00),
+(613, 219, 3, 11, '{}', 1490084337, 1490181958, '2017-03-21', 1, 1490084334, 73526.00),
+(614, 216, 3, 11, '{}', 1490085757, 1490086717, '2017-03-21', 0, 1490085755, 5377.00);
+SELECT * FROM
+(SELECT @row := @row + 1 as row, a.* from (
+SELECT t.order_number
+FROM sales_documents t
+WHERE
+t.type = 2 AND
+t.date >= '2017-01-01' AND
+t.date <= '2017-12-31' AND
+t.order_number IS NOT NULL AND
+t.generated = 1
+GROUP BY t.order_number
+) a, (SELECT @row := 0) r) t
+WHERE row <> order_number;
+row order_number
+14 51
+DROP TABLE sales_documents;
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index 050e0b9cd2b..f33a482dc0b 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -209,10 +209,10 @@ Note 1051 Unknown table 'test.table1'
Note 1051 Unknown table 'test.table2'
DROP VIEW IF EXISTS view1,view2,view3,view4;
Warnings:
-Note 4067 Unknown VIEW: 'test.view1'
-Note 4067 Unknown VIEW: 'test.view2'
-Note 4067 Unknown VIEW: 'test.view3'
-Note 4067 Unknown VIEW: 'test.view4'
+Note 4068 Unknown VIEW: 'test.view1'
+Note 4068 Unknown VIEW: 'test.view2'
+Note 4068 Unknown VIEW: 'test.view3'
+Note 4068 Unknown VIEW: 'test.view4'
# Test error message when trigger does not find table
CREATE TABLE table1(a int);
diff --git a/mysql-test/r/func_json.result b/mysql-test/r/func_json.result
index eff8f5c9c92..997d3e4d062 100644
--- a/mysql-test/r/func_json.result
+++ b/mysql-test/r/func_json.result
@@ -629,3 +629,16 @@ j p json_remove(j, p)
{"a":1,"b":2,"c":3} $.b {"a": 1, "c": 3}
{"a":1,"b":2,"c":3} $.c {"a": 1, "b": 2}
drop table t1;
+SET @str = 'bar', @path = '$';
+SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
+JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path)
+"$.foo"
+SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
+JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]')
+bar
+CREATE TABLE t1 (f INT NOT NULL);
+INSERT INTO t1 VALUES (0);
+SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
+JSON_KEYS(f)
+NULL
+DROP TABLE t1;
diff --git a/mysql-test/r/gis-rt-precise.result b/mysql-test/r/gis-rt-precise.result
index 65583a0ce0d..d3308ed90ba 100644
--- a/mysql-test/r/gis-rt-precise.result
+++ b/mysql-test/r/gis-rt-precise.result
@@ -51,7 +51,7 @@ count(*)
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range g g 34 NULL 1 Using where
+1 SIMPLE t1 range g g 34 NULL 4 Using where
SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
fid AsText(g)
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index b76d02ef1d7..9373237f1d6 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -301,7 +301,7 @@ count(*)
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range g g 34 NULL 1 Using where
+1 SIMPLE t2 range g g 34 NULL 4 Using where
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 593d998754a..3e3c84d4300 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1428,7 +1428,7 @@ Warnings:
Note 1305 FUNCTION test.test_function does not exist
drop view if exists v1;
Warnings:
-Note 4067 Unknown VIEW: 'test.v1'
+Note 4068 Unknown VIEW: 'test.v1'
create table test (col1 varchar(30));
create function test_function() returns varchar(30)
begin
diff --git a/mysql-test/r/keyread.result b/mysql-test/r/keyread.result
new file mode 100644
index 00000000000..d8e9659d4bb
--- /dev/null
+++ b/mysql-test/r/keyread.result
@@ -0,0 +1,6 @@
+create table t1 (f1 int not null, f2 int, f3 int, primary key (f1,f2), key(f2,f3)) engine=innodb;
+create view v1 as select * from t1 where f2 = 1;
+select distinct f1 from v1;
+f1
+drop view v1;
+drop table t1;
diff --git a/mysql-test/r/loadxml.result b/mysql-test/r/loadxml.result
index c3b4c867c98..711fea9e854 100644
--- a/mysql-test/r/loadxml.result
+++ b/mysql-test/r/loadxml.result
@@ -123,3 +123,14 @@ col1 col2 col3
ABC DEF NULL
GHI NULL 123
DROP TABLE t1;
+#
+# MDEV-12696 Crash with LOAD XML and non-updatable VIEW column
+#
+CREATE TABLE t1 (c1 TEXT);
+CREATE VIEW v1 AS SELECT CONCAT(c1,'') AS c1, NULL AS c2 FROM t1;
+LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c1);
+ERROR HY000: Invalid column reference (v1.c1) in LOAD DATA
+LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c2);
+ERROR HY000: Invalid column reference (v1.c2) in LOAD DATA
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 1243c455e6c..66b501e8278 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -5534,3 +5534,52 @@ USE `db1`;
DROP DATABASE db1;
DROP DATABASE db2;
FOUND 1 /Database: mysql/ in bug11505.sql
+#
+# Test for --add-drop-trigger
+#
+use test;
+CREATE TABLE t1 (a int, b int);
+CREATE TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW
+SET NEW.b=NEW.a + 10;
+INSERT INTO t1 (a) VALUES (1),(2),(3);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `test`;
+/*!50003 SET @saved_cs_client = @@character_set_client */ ;
+/*!50003 SET @saved_cs_results = @@character_set_results */ ;
+/*!50003 SET @saved_col_connection = @@collation_connection */ ;
+/*!50003 SET character_set_client = utf8 */ ;
+/*!50003 SET character_set_results = utf8 */ ;
+/*!50003 SET collation_connection = utf8_general_ci */ ;
+/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
+/*!50003 SET sql_mode = '' */ ;
+/*!50032 DROP TRIGGER IF EXISTS tt1_t1 */;
+DELIMITER ;;
+/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW
+SET NEW.b=NEW.a + 10 */;;
+DELIMITER ;
+/*!50003 SET sql_mode = @saved_sql_mode */ ;
+/*!50003 SET character_set_client = @saved_cs_client */ ;
+/*!50003 SET character_set_results = @saved_cs_results */ ;
+/*!50003 SET collation_connection = @saved_col_connection */ ;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TABLE t1;
diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result
index e87bfd49056..32e7e0ddc9d 100644
--- a/mysql-test/r/profiling.result
+++ b/mysql-test/r/profiling.result
@@ -415,7 +415,7 @@ select @@profiling;
drop table if exists t1, t2, t3;
drop view if exists v1;
Warnings:
-Note 4067 Unknown VIEW: 'test.v1'
+Note 4068 Unknown VIEW: 'test.v1'
drop function if exists f1;
set session profiling = OFF;
set global profiling_history_size= @start_value;
diff --git a/mysql-test/r/sp-group.result b/mysql-test/r/sp-group.result
index db118496e9a..0fc8d45c5b1 100644
--- a/mysql-test/r/sp-group.result
+++ b/mysql-test/r/sp-group.result
@@ -3,7 +3,7 @@ Warnings:
Note 1051 Unknown table 'test.t1'
drop view if exists view_t1;
Warnings:
-Note 4067 Unknown VIEW: 'test.view_t1'
+Note 4068 Unknown VIEW: 'test.view_t1'
SET sql_mode=ONLY_FULL_GROUP_BY;
CREATE TABLE t1 (
pk INT,
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 3312a46dc88..5f1f8f92d50 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -3211,7 +3211,7 @@ drop procedure bug10961|
DROP PROCEDURE IF EXISTS bug6866|
DROP VIEW IF EXISTS tv|
Warnings:
-Note 4067 Unknown VIEW: 'test.tv'
+Note 4068 Unknown VIEW: 'test.tv'
DROP TABLE IF EXISTS tt1,tt2,tt3|
Warnings:
Note 1051 Unknown table 'test.tt1'
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 7bdc01a8aa4..b83ee20e784 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -7204,3 +7204,17 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+CREATE TABLE t (
+pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
+) ENGINE=MyISAM;
+INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
+SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
+WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+End of 10.2 tests
diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result
index 8bbe6e3cf70..87f33d1dbf4 100644
--- a/mysql-test/r/subselect_no_exists_to_in.result
+++ b/mysql-test/r/subselect_no_exists_to_in.result
@@ -7204,6 +7204,20 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+CREATE TABLE t (
+pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
+) ENGINE=MyISAM;
+INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
+SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
+WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%exists_to_in=off%';
@@optimizer_switch like '%exists_to_in=off%'
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index 5aab2e75134..626990f2c9e 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -7197,6 +7197,20 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+CREATE TABLE t (
+pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
+) ENGINE=MyISAM;
+INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
+SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
+WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%'
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 3b66d3efdbf..3637604646f 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -7195,4 +7195,18 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+CREATE TABLE t (
+pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
+) ENGINE=MyISAM;
+INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
+SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
+WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+End of 10.2 tests
set @optimizer_switch_for_subselect_test=null;
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index 9f0234015bc..afebd27c192 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -7210,6 +7210,20 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+CREATE TABLE t (
+pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
+) ENGINE=MyISAM;
+INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
+SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
+WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%subquery_cache=on%';
@@optimizer_switch like '%subquery_cache=on%'
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index a43cfd11b23..0f0fc59341e 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -7195,5 +7195,19 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
+#
+# MDEV-12564: IN TO EXISTS transformation for rows after
+# conversion an outer join to inner join
+#
+CREATE TABLE t (
+pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
+) ENGINE=MyISAM;
+INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
+SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
+WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
+pk i c pk i c
+1 10 foo 1 10 foo
+DROP TABLE t;
+End of 10.2 tests
set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL;
diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result
index ee7dcb76a18..3f125598f9b 100644
--- a/mysql-test/r/type_time.result
+++ b/mysql-test/r/type_time.result
@@ -989,7 +989,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 00:00:00
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00'
# TIME cast + DATE literal
SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11';
a
@@ -999,7 +999,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 00:00:00
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00'
# TIME literal + DATE cast
SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11');
a
@@ -1029,7 +1029,7 @@ SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11')
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00' and coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '00:00:00' and coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00'
# TIME-alike string literal + DATE literal
SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11';
a
@@ -1049,7 +1049,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 0 and coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 0 and coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00'
# TIME-alike integer literal + DATE literal
SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11';
a
@@ -1069,7 +1069,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:0
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00'
# DATE cast + TIME literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00';
a
@@ -1079,7 +1079,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00'
# DATE cast + TIME-alike string literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00';
a
@@ -1089,7 +1089,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00'
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00 and coalesce(`test`.`t1`.`a`) = '00:00:00'
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00' and coalesce(`test`.`t1`.`a`) = '00:00:00'
# DATE cast + TIME-alike integer literal
SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0;
a
@@ -1099,7 +1099,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00 and coalesce(`test`.`t1`.`a`) = 0
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce(`test`.`t1`.`a`) = '2015-09-11 00:00:00' and coalesce(`test`.`t1`.`a`) = 0
# DATE literal + TIME cast
SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00');
a
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index a5b727a8a50..14b92e93133 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -5242,7 +5242,7 @@ CREATE TABLE t4 (i4 INT);
INSERT INTO t4 VALUES (1),(2);
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4067 Unknown VIEW: 'test.v1'
+Note 4068 Unknown VIEW: 'test.v1'
CREATE VIEW v1 AS select coalesce(j1,i3) AS v1_field1 from t2 join t3 left join t1 on ( i1 = i2 );
CREATE VIEW v2 AS select v1_field1 from t4 join v1;
prepare my_stmt from "select v1_field1 from v2";
diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result
index 26194bc5990..ec83998aa98 100644
--- a/mysql-test/r/win.result
+++ b/mysql-test/r/win.result
@@ -3055,3 +3055,33 @@ name row_cnt pct_of_total
Fred 2 66.67
Joe 1 33.33
drop table t1;
+#
+# MDEV-11990: window function over min/max aggregation
+#
+create table t1 (id int);
+insert into t1 values (1), (2), (3), (2), (4), (2);
+select sum(max(id)) over (order by max(id)) from t1;
+sum(max(id)) over (order by max(id))
+4
+explain
+select sum(max(id)) over (order by max(id)) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary
+create index idx on t1(id);
+select sum(max(id)) over (order by max(id)) from t1;
+sum(max(id)) over (order by max(id))
+4
+explain
+select sum(max(id)) over (order by max(id)) from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
+select sum(max(id)) over (order by max(id)) from t1 where id < 3;
+sum(max(id)) over (order by max(id))
+2
+select count(max(id)) over (order by max(id)) from t1 where id < 3;
+count(max(id)) over (order by max(id))
+1
+select max(id), rank() over (order by max(id)) from t1 where id < 3;
+max(id) rank() over (order by max(id))
+2 1
+drop table t1;
diff --git a/mysql-test/std_data/loaddata/mdev12696.xml b/mysql-test/std_data/loaddata/mdev12696.xml
new file mode 100644
index 00000000000..a2789acbde5
--- /dev/null
+++ b/mysql-test/std_data/loaddata/mdev12696.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<resultset statement="SELECT 'test' AS c1, NULL AS c2
+" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <row>
+ <field name="c1">test</field>
+ <field name="c2" xsi:nil="true" />
+ </row>
+</resultset>
diff --git a/mysql-test/suite/binlog/r/flashback.result b/mysql-test/suite/binlog/r/flashback.result
index a7973b36ddd..ae8b583fc7a 100644
--- a/mysql-test/suite/binlog/r/flashback.result
+++ b/mysql-test/suite/binlog/r/flashback.result
@@ -502,4 +502,9 @@ a b
2 1
3 2
4 3
+SET binlog_format=statement;
+Warnings:
+Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
+SET GLOBAL binlog_format=statement;
+ERROR HY000: Flashback does not support binlog_format STATEMENT
DROP TABLE t1;
diff --git a/mysql-test/suite/binlog/t/flashback.test b/mysql-test/suite/binlog/t/flashback.test
index 2f395a2a7b1..8ef38dbcb9f 100644
--- a/mysql-test/suite/binlog/t/flashback.test
+++ b/mysql-test/suite/binlog/t/flashback.test
@@ -160,4 +160,8 @@ let $MYSQLD_DATADIR= `select @@datadir`;
SELECT * FROM t1;
+SET binlog_format=statement;
+--error ER_FLASHBACK_NOT_SUPPORTED
+SET GLOBAL binlog_format=statement;
+
DROP TABLE t1;
diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index 294e0695226..dfe46bbf645 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -4314,7 +4314,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
-Note 4067 Unknown VIEW: 'test.v2'
+Note 4068 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@@ -7566,7 +7566,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
-Note 4067 Unknown VIEW: 'test.v1'
+Note 4068 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@@ -21312,7 +21312,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4067 Unknown VIEW: 'test.v1'
+Note 4068 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index 87465035980..b81ea2f309b 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -4315,7 +4315,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
-Note 4067 Unknown VIEW: 'test.v2'
+Note 4068 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@@ -7567,7 +7567,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
-Note 4067 Unknown VIEW: 'test.v1'
+Note 4068 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@@ -21314,7 +21314,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4067 Unknown VIEW: 'test.v1'
+Note 4068 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 20c1cb39f87..6c3efc77e20 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -36,3 +36,25 @@ galera_sst_xtrabackup-v2 : MDEV-11208
galera_sst_xtrabackup-v2_encrypt_with_key : MDEV-11208
mysql-wsrep#33 : TODO: investigate
galera_var_innodb_disallow_writes : MDEV-10949
+MW-258 : MDEV-11229
+galera_as_master : MDEV-11229
+MW-44 : MDEV-11229
+galera_gcs_fc_limit : MDEV-11229
+galera_roles : MDEV-11229
+galera_lock_table : MDEV-11229
+GAL-480 : Investigate
+galera_fk_no_pk :Investigate
+galera_account_management : Investigate
+galera.galera_var_retry_autocommit : MDEV-12319 #Sparodic Faliure
+galera.galera_gcs_fc_limit : MDEV-12319 #Sparodic Faliure
+galera.galera_toi_ddl_nonconflicting : MDEV-12319 #Sparodic Faliure
+galera.mysql-wsrep#198 : MDEV-12319 #Sparodic Faliure
+galera.galera_pc_ignore_sb : MDEV-12319 #Sparodic Faliure
+galera.MW-329 : MDEV-12319 #Sparodic Faliure
+galera.galera_ist_recv_bind : MDEV-12319 #Failed to start mysqld
+galera.galera_ist_restart_joiner : MDEV-12319 #Failed to start mysqld
+galera.galera_ssl_compression : MDEV-12319 #Failed to start mysqld
+galera.galera_wan : MDEV-12319 #Failed to start mysqld
+galera.rpl_row_annotate : MDEV-12319 #Failed to start mysqld
+galera_restart_on_unknown_option : Solve
+galera_kill_applier : Investigate; problem introduced in merge from 10.1
diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf
index e5cf769a910..34bf1fc58fe 100644
--- a/mysql-test/suite/galera/galera_2nodes.cnf
+++ b/mysql-test/suite/galera/galera_2nodes.cnf
@@ -25,7 +25,14 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
-wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gcache.size=10M;evs.suspect_timeout=PT10S'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
+
+# enforce read-committed characteristics across the cluster
+wsrep_causal_reads=ON
+wsrep_sync_wait = 7
+
+wsrep_node_address=127.0.0.1
+wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
diff --git a/mysql-test/suite/galera/galera_2nodes_as_master_slave.cnf b/mysql-test/suite/galera/galera_2nodes_as_master_slave.cnf
new file mode 100644
index 00000000000..716a790fea6
--- /dev/null
+++ b/mysql-test/suite/galera/galera_2nodes_as_master_slave.cnf
@@ -0,0 +1,83 @@
+
+#
+# Let's understand the topology.
+# * Independent Master with server-id = 1
+# * Galera cluster with 2 nodes: node#1 and node#2 with server-id = 2, 3
+# node#1 act as slave to Independent Master with server-id = 1
+# * Independent Slave with server-id = 4 replicating from galera node#2
+#
+
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld]
+log-slave-updates
+log-bin=mysqld-bin
+binlog-format=row
+gtid-mode=on
+enforce-gtid-consistency=true
+
+[mysqld.1]
+server-id=1
+
+[mysqld.2]
+server-id=2
+
+wsrep_provider=@ENV.WSREP_PROVIDER
+wsrep_cluster_address='gcomm://'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.install_timeout = PT15S; evs.max_install_timeouts=1;'
+
+# enforce read-committed characteristics across the cluster
+wsrep_causal_reads=ON
+wsrep_sync_wait = 7
+
+wsrep_node_address=127.0.0.1
+wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
+wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
+
+# Required for Galera
+innodb_autoinc_lock_mode=2
+
+innodb_flush_log_at_trx_commit=2
+
+[mysqld.3]
+server-id=3
+
+wsrep_provider=@ENV.WSREP_PROVIDER
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.2.#galera_port'
+wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.install_timeout = PT15S; evs.max_install_timeouts = 1;'
+
+# enforce read-committed characteristics across the cluster
+wsrep_causal_reads=ON
+wsrep_sync_wait = 7
+
+wsrep_node_address=127.0.0.1
+wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port
+wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
+
+# Required for Galera
+innodb_autoinc_lock_mode=2
+
+innodb_flush_log_at_trx_commit=2
+
+[mysqld.4]
+server-id=4
+
+[ENV]
+NODE_MYPORT_1= @mysqld.1.port
+NODE_MYSOCK_1= @mysqld.1.socket
+
+NODE_MYPORT_2= @mysqld.2.port
+NODE_MYSOCK_2= @mysqld.2.socket
+
+NODE_MYPORT_3= @mysqld.3.port
+NODE_MYSOCK_3= @mysqld.3.socket
+
+NODE_MYPORT_4= @mysqld.4.port
+NODE_MYSOCK_4= @mysqld.4.socket
+
+NODE_GALERAPORT_2= @mysqld.2.#galera_port
+NODE_GALERAPORT_3= @mysqld.3.#galera_port
+
+NODE_SSTPORT_2= @mysqld.2.#sst_port
+NODE_SSTPORT_3= @mysqld.3.#sst_port
diff --git a/mysql-test/suite/galera/galera_2nodes_as_master_with_repl_filter.cnf b/mysql-test/suite/galera/galera_2nodes_as_master_with_repl_filter.cnf
new file mode 100644
index 00000000000..5f0af2e58e5
--- /dev/null
+++ b/mysql-test/suite/galera/galera_2nodes_as_master_with_repl_filter.cnf
@@ -0,0 +1,87 @@
+#
+# This .cnf file creates a setup with a 2-node Galera cluster and one stand-alone MySQL server, to be used as a slave
+#
+
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld]
+default-storage-engine=InnoDB
+
+[mysqld.1]
+server-id=1
+binlog-format=row
+log-bin=mysqld-bin
+log_slave_updates
+gtid-mode=on
+enforce-gtid-consistency=true
+event-scheduler=1
+
+wsrep_provider=@ENV.WSREP_PROVIDER
+wsrep_cluster_address='gcomm://'
+wsrep_provider_options='base_port=@mysqld.1.#galera_port'
+
+# enforce read-committed characteristics across the cluster
+wsrep_causal_reads=ON
+wsrep_sync_wait = 7
+
+wsrep_node_address=127.0.0.1
+wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port
+wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
+
+# Required for Galera
+innodb_autoinc_lock_mode=2
+
+innodb_flush_log_at_trx_commit=2
+
+[mysqld.2]
+server-id=2
+binlog-format=row
+log-bin=mysqld-bin
+log_slave_updates
+gtid-mode=on
+enforce-gtid-consistency=true
+event-scheduler=1
+
+wsrep_provider=@ENV.WSREP_PROVIDER
+wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port'
+
+# enforce read-committed characteristics across the cluster
+wsrep_causal_reads=ON
+wsrep_sync_wait = 7
+
+wsrep_node_address=127.0.0.1
+wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
+wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
+
+# Required for Galera
+innodb_autoinc_lock_mode=2
+
+innodb_flush_log_at_trx_commit=2
+
+[mysqld.3]
+server-id=3
+replicate-ignore-db=test
+replicate-wild-ignore-table=test.%
+log-bin=mysqld-bin
+log_slave_updates
+gtid-mode=on
+enforce-gtid-consistency=true
+event-scheduler=1
+
+[ENV]
+NODE_MYPORT_1= @mysqld.1.port
+NODE_MYSOCK_1= @mysqld.1.socket
+
+NODE_MYPORT_2= @mysqld.2.port
+NODE_MYSOCK_2= @mysqld.2.socket
+
+NODE_MYPORT_3= @mysqld.3.port
+NODE_MYSOCK_3= @mysqld.3.socket
+
+NODE_GALERAPORT_1= @mysqld.1.#galera_port
+NODE_GALERAPORT_2= @mysqld.2.#galera_port
+
+NODE_SSTPORT_1= @mysqld.1.#sst_port
+NODE_SSTPORT_2= @mysqld.2.#sst_port
diff --git a/mysql-test/suite/galera/r/GAL-401.result b/mysql-test/suite/galera/r/GAL-401.result
new file mode 100644
index 00000000000..b2ecd1c2bfa
--- /dev/null
+++ b/mysql-test/suite/galera/r/GAL-401.result
@@ -0,0 +1,24 @@
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+connection node_2;
+SET @@global.wsrep_desync = 1;
+SET SESSION wsrep_dirty_reads=1;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+connection node_2;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+SHOW STATUS LIKE 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 0
+SET @@global.wsrep_desync = 0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` char(1) DEFAULT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CALL mtr.add_suppression("WSREP: Protocol violation. JOIN message sender (.*) is not in state transfer \\(SYNCED\\). Message ignored.");
+connection node_1;
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false';
diff --git a/mysql-test/suite/galera/r/GAL-419.result b/mysql-test/suite/galera/r/GAL-419.result
new file mode 100644
index 00000000000..410c91b4f98
--- /dev/null
+++ b/mysql-test/suite/galera/r/GAL-419.result
@@ -0,0 +1,4 @@
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
diff --git a/mysql-test/suite/galera/r/GAL-480.result b/mysql-test/suite/galera/r/GAL-480.result
new file mode 100644
index 00000000000..b762e07423e
--- /dev/null
+++ b/mysql-test/suite/galera/r/GAL-480.result
@@ -0,0 +1,39 @@
+CREATE TABLE t1 (f1 CHAR(10), f0 integer) ENGINE=InnoDB;
+FLUSH TABLE t1 FOR EXPORT;
+UNLOCK TABLES;
+ALTER TABLE t1 DROP COLUMN f1;
+SET SESSION wsrep_osu_method='RSU';
+ALTER TABLE t1 ADD COLUMN f1 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f1;
+ALTER TABLE t1 ADD COLUMN f2 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f2;
+ALTER TABLE t1 ADD COLUMN f3 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f3;
+ALTER TABLE t1 ADD COLUMN f4 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f4;
+ALTER TABLE t1 ADD COLUMN f5 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f5;
+ALTER TABLE t1 ADD COLUMN f6 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f6;
+ALTER TABLE t1 ADD COLUMN f7 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f7;
+ALTER TABLE t1 ADD COLUMN f8 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f8;
+ALTER TABLE t1 ADD COLUMN f9 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f9;
+ALTER TABLE t1 ADD COLUMN f10 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f10;
+ALTER TABLE t1 ADD COLUMN f11 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f11;
+ALTER TABLE t1 ADD COLUMN f12 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f12;
+ALTER TABLE t1 ADD COLUMN f13 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f13;
+ALTER TABLE t1 ADD COLUMN f14 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f14;
+ALTER TABLE t1 ADD COLUMN f15 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f15;
+ALTER TABLE t1 ADD COLUMN f16 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f16;
+SET SESSION wsrep_osu_method='TOI';
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MW-313.result b/mysql-test/suite/galera/r/MW-313.result
new file mode 100644
index 00000000000..dc605ffc370
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-313.result
@@ -0,0 +1,32 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+SET GLOBAL wsrep_max_ws_rows = 2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SHOW STATUS LIKE '%wsrep%';
+INSERT INTO t1 SELECT * FROM t1;
+ERROR HY000: wsrep_max_ws_rows exceeded
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES (1);
+INSERT INTO t1 (f1) VALUES (2),(3),(4);
+ERROR HY000: wsrep_max_ws_rows exceeded
+ROLLBACK;
+START TRANSACTION;
+DELETE FROM t1;
+ERROR HY000: wsrep_max_ws_rows exceeded
+DROP TABLE t1;
+SET GLOBAL wsrep_max_ws_rows = 0;
diff --git a/mysql-test/suite/galera/r/MW-328A.result b/mysql-test/suite/galera/r/MW-328A.result
new file mode 100644
index 00000000000..db0301b6bf2
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-328A.result
@@ -0,0 +1,27 @@
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES (1);
+CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
+CREATE PROCEDURE proc_update ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4);
+END WHILE;
+END|
+connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1X;
+CALL proc_update();;
+connection node_2;
+SET SESSION wsrep_retry_autocommit = 0;
+have_successes
+1
+have_deadlocks
+1
+connection node_1;
+connection node_1X;
+Got one of the listed errors
+connection node_1;
+DROP PROCEDURE proc_update;
+DROP TABLE t1, t2;
+CALL mtr.add_suppression("conflict state 3 after post commit");
diff --git a/mysql-test/suite/galera/r/MW-328B.result b/mysql-test/suite/galera/r/MW-328B.result
new file mode 100644
index 00000000000..e898e315ca8
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-328B.result
@@ -0,0 +1,23 @@
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES (1);
+CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
+CREATE PROCEDURE proc_update ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4);
+END WHILE;
+END|
+connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1X;
+CALL proc_update();;
+connection node_2;
+SET SESSION wsrep_retry_autocommit = 0;
+connection node_1;
+connection node_1X;
+Got one of the listed errors
+connection node_1;
+DROP PROCEDURE proc_update;
+DROP TABLE t1, t2;
+CALL mtr.add_suppression("conflict state 3 after post commit");
diff --git a/mysql-test/suite/galera/r/MW-328C.result b/mysql-test/suite/galera/r/MW-328C.result
new file mode 100644
index 00000000000..d8e164e7b4a
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-328C.result
@@ -0,0 +1,23 @@
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES (1);
+CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
+CREATE PROCEDURE proc_update ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4);
+END WHILE;
+END|
+connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1X;
+CALL proc_update();;
+connection node_2;
+SET SESSION wsrep_retry_autocommit = 10000;
+connection node_1;
+connection node_1X;
+Got one of the listed errors
+connection node_1;
+DROP PROCEDURE proc_update;
+DROP TABLE t1, t2;
+CALL mtr.add_suppression("conflict state 3 after post commit");
diff --git a/mysql-test/suite/galera/r/MW-328D.result b/mysql-test/suite/galera/r/MW-328D.result
new file mode 100644
index 00000000000..6562136ec27
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-328D.result
@@ -0,0 +1,20 @@
+CREATE TABLE t1 (i INT) ENGINE = InnoDB;
+INSERT INTO t1 (i) VALUES(1);
+CREATE TABLE t2 (i INT) ENGINE = InnoDB;
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SELECT * FROM t1 WHERE i = 1 LOCK IN SHARE MODE;
+i
+1
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT IGNORE INTO t2 SELECT * FROM t1 WHERE i = 1 FOR UPDATE;;
+connection node_1;
+DELETE FROM t1 WHERE i = 1;
+COMMIT;
+connection node_1a;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera/r/MW-328E.result b/mysql-test/suite/galera/r/MW-328E.result
new file mode 100644
index 00000000000..89654ec066a
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-328E.result
@@ -0,0 +1,20 @@
+create table t1 (i int primary key, j int) engine=innodb;
+create table t2 (i int primary key, j int) engine=innodb;
+insert into t1 values (1,0);
+insert into t2 values (2,0);
+set autocommit=off;
+start transaction;
+update t1 set j=1 where i=1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+set autocommit=off;
+start transaction;
+begin;
+update t2 set j=1 where i=2;
+connection node_1;
+insert into t1 select * from t2;;
+connection node_1a;
+insert into t2 select * from t1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera/r/MW-329.result b/mysql-test/suite/galera/r/MW-329.result
new file mode 100644
index 00000000000..655d8e9e291
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-329.result
@@ -0,0 +1,20 @@
+CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES (1),(65535);
+FLUSH STATUS;
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays';
+VARIABLE_VALUE = 0
+1
+CREATE PROCEDURE proc_insert ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f1) VALUES (FLOOR( 1 + RAND( ) * 65535 ));
+END WHILE;
+END|
+CALL proc_insert();;
+SELECT VARIABLE_VALUE > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays';
+VARIABLE_VALUE > 0
+1
+DROP PROCEDURE proc_insert;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/ev51914.result b/mysql-test/suite/galera/r/ev51914.result
new file mode 100644
index 00000000000..3f3d67d01ef
--- /dev/null
+++ b/mysql-test/suite/galera/r/ev51914.result
@@ -0,0 +1,173 @@
+connection node_1;
+SAVEPOINT in a stored function should be forbidden
+CREATE FUNCTION f1 () RETURNS INT BEGIN
+SAVEPOINT s;
+RETURN 1;
+END|
+SELECT f1();
+f1()
+1
+DROP FUNCTION f1;
+ROLLBACK TO SAVEPOINT in a stored function should be forbidden
+CREATE FUNCTION f2 () RETURNS INT BEGIN
+ROLLBACK TO SAVEPOINT s;
+RETURN 1;
+END|
+BEGIN;
+SAVEPOINT s;
+SELECT f2();
+ERROR 42000: SAVEPOINT s does not exist
+COMMIT;
+DROP FUNCTION f2;
+BEGIN;
+SAVEPOINT S;
+ROLLBACK TO SAVEPOINT S;
+COMMIT;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 values (110), (111), (112), (113), (114);
+Direct SAVEPOINT in a trigger should be forbidden
+connection node_2;
+CREATE TRIGGER i1_t1 BEFORE INSERT ON t1 FOR EACH ROW SAVEPOINT s;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+DROP TRIGGER i1_t1;
+CREATE TRIGGER i2_t1 AFTER INSERT ON t1 FOR EACH ROW SAVEPOINT s;
+INSERT INTO t1 VALUES (2);
+DROP TRIGGER i2_t1;
+INSERT INTO t1 VALUES (3);
+CREATE TRIGGER u1_t1 BEFORE UPDATE ON t1 FOR EACH ROW SAVEPOINT s;
+UPDATE t1 SET a=4 WHERE a=3;
+DROP TRIGGER u1_t1;
+CREATE TRIGGER u2_t1 AFTER UPDATE ON t1 FOR EACH ROW SAVEPOINT s;
+UPDATE t1 SET a=4 WHERE a=3;
+DROP TRIGGER u2_t1;
+CREATE TRIGGER d1_t1 BEFORE DELETE ON t1 FOR EACH ROW SAVEPOINT s;
+DELETE FROM t1;
+DROP TRIGGER d1_t1;
+CREATE TRIGGER d1_t1 AFTER DELETE ON t1 FOR EACH ROW SAVEPOINT s;
+DELETE FROM t1;
+DROP TRIGGER d1_t1;
+SAVEPOINT in a compound statement in a trigger should be forbidden
+CREATE TRIGGER i3_t1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN
+SAVEPOINT s;
+END|
+INSERT INTO t1 VALUES (5);
+DROP TRIGGER i3_t1;
+SAVEPOINT in a PS call in a trigger should be forbidden
+CREATE TRIGGER i4_t1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN
+PREPARE set_savepoint FROM "SAVEPOINT s";
+EXECUTE set_savepoint;
+DEALLOCATE PREPARE set_savepoint;
+END|
+ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
+connection node_2;
+SAVEPOINT in SP called from a trigger should be forbidden
+CREATE PROCEDURE p1() BEGIN
+SAVEPOINT s;
+END|
+connection node_1;
+CREATE TRIGGER i5_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p1;
+INSERT INTO t1 VALUES (6);
+DROP TRIGGER i5_t1;
+SAVEPOINT in a SP called from a PS called from a trigger be forbidden
+PREPARE call_p1 FROM "CALL p1";
+CREATE TRIGGER i6_t1 BEFORE INSERT ON t1 FOR EACH ROW EXECUTE call_p1;
+ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
+SAVEPOINT in a function called from a trigger should be forbidden
+CREATE FUNCTION f1 () RETURNS INT BEGIN
+SAVEPOINT s;
+RETURN 1;
+END|
+CREATE TRIGGER i7_t1 BEFORE INSERT ON t1 FOR EACH ROW SET @foo = f1();
+INSERT INTO t1 VALUES (7);
+DROP TRIGGER i7_t1;
+SAVEPOINT in a SP called from a SP called from a trigger should be forbidden
+CREATE PROCEDURE p2() BEGIN
+CALL p1();
+END|
+CREATE TRIGGER i8_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p2;
+INSERT INTO t1 VALUES (8);
+DROP TRIGGER i8_t1;
+SAVEPOINT in a SP called from a trigger called from a SP should be forbidden
+CREATE TRIGGER i9_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p1;
+CREATE PROCEDURE p3() BEGIN
+INSERT INTO t1 VALUES (9);
+END|
+CALL p3();
+DROP TRIGGER i9_t1;
+ROLLBACK TO SAVEPOINT in trigger as a trivial statement should be forbidden
+CREATE TRIGGER i4_t1 BEFORE INSERT ON t1 FOR EACH ROW ROLLBACK TO SAVEPOINT s;
+BEGIN;
+SAVEPOINT s;
+INSERT INTO t1 VALUES (5);
+ERROR 42000: SAVEPOINT s does not exist
+COMMIT;
+DROP TRIGGER i4_t1;
+ROLLBACK TO SAVEPOINT in a trigger in a SP call should be forbidden
+CREATE PROCEDURE p4() BEGIN
+ROLLBACK TO SAVEPOINT s;
+END|
+CREATE TRIGGER i5_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p4;
+BEGIN;
+SAVEPOINT s;
+INSERT INTO t1 VALUES (6);
+ERROR 42000: SAVEPOINT s does not exist
+COMMIT;
+DROP TRIGGER i5_t1;
+SAVEPOINT in a SP next to a trigger should work
+CREATE TRIGGER i6_t1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a = NEW.a + 1;
+CREATE PROCEDURE p5() BEGIN
+SAVEPOINT s;
+INSERT INTO t1 VALUES (10);
+ROLLBACK TO SAVEPOINT s;
+END|
+BEGIN;
+CALL p5();
+COMMIT;
+DROP TRIGGER i6_t1;
+connection node_2;
+create trigger t1 before insert on t1 for each row
+begin
+insert into t2 values (NULL);
+end|
+connection node_1;
+INSERT INTO t1 VALUES (201), (202), (203);
+connection node_1;
+SELECT * FROM t1;
+a
+5
+6
+7
+8
+9
+201
+202
+203
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+3
+connection node_2;
+SELECT * FROM t1;
+a
+5
+6
+7
+8
+9
+201
+202
+203
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+3
+connection node_1;
+DEALLOCATE PREPARE call_p1;
+connection node_2;
+DROP TABLE t1, t2;
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP PROCEDURE p3;
+DROP PROCEDURE p4;
+DROP PROCEDURE p5;
+DROP FUNCTION f1;
diff --git a/mysql-test/suite/galera/r/galera_account_management.result b/mysql-test/suite/galera/r/galera_account_management.result
index 7fb472a5c2d..6c81d401136 100644
--- a/mysql-test/suite/galera/r/galera_account_management.result
+++ b/mysql-test/suite/galera/r/galera_account_management.result
@@ -5,6 +5,15 @@ SELECT COUNT(*) = 2 FROM mysql.user WHERE user IN ('user1', 'user2');
COUNT(*) = 2
1
connection node_1;
+ALTER USER user1 PASSWORD EXPIRE;
+SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
+password_expired = 'Y'
+1
+connection node_2;
+SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
+password_expired = 'Y'
+1
+connection node_1;
RENAME USER user2 TO user3;
connection node_2;
SELECT COUNT(*) = 0 FROM mysql.user WHERE user = 'user2';
diff --git a/mysql-test/suite/galera/r/galera_admin.result b/mysql-test/suite/galera/r/galera_admin.result
new file mode 100644
index 00000000000..ed753247236
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_admin.result
@@ -0,0 +1,56 @@
+DROP TABLE IF EXISTS t1, t2;
+DROP TABLE IF EXISTS x1, x2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
+SET GLOBAL wsrep_replicate_myisam = TRUE;
+CREATE TABLE x1 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE x2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO x1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO t2 (f2) SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4;
+INSERT INTO x2 (f2) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+connection node_2;
+# ANALYZE test
+connection node_2;
+connection node_1;
+ANALYZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+connection node_2;
+# OPTIMIZE test
+connection node_2;
+connection node_1;
+OPTIMIZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t2 optimize status OK
+connection node_2;
+# REPAIR test
+connection node_2;
+connection node_1;
+REPAIR TABLE x1, x2;
+Table Op Msg_type Msg_text
+test.x1 repair status OK
+test.x2 repair status OK
+connection node_2;
+connection node_2;
+SELECT COUNT(*) = 10 FROM t1;
+COUNT(*) = 10
+1
+SELECT COUNT(*) = 10 FROM x1;
+COUNT(*) = 10
+1
+SELECT COUNT(*) = 10000 FROM t2;
+COUNT(*) = 10000
+1
+SELECT COUNT(*) = 10 FROM x2;
+COUNT(*) = 10
+1
+connection node_1;
+DROP TABLE t1, t2;
+DROP TABLE x1, x2;
+SET GLOBAL wsrep_replicate_myisam = FALSE;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort.result b/mysql-test/suite/galera/r/galera_bf_abort.result
index c55f1a4dfcb..cc750f05050 100644
--- a/mysql-test/suite/galera/r/galera_bf_abort.result
+++ b/mysql-test/suite/galera/r/galera_bf_abort.result
@@ -1,9 +1,9 @@
-CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(6)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (1,'node_2');
+INSERT INTO t1 VALUES (1,'node_1');
+INSERT INTO t1 VALUES (2, 'node_2');
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
wsrep_local_aborts_increment
1
diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result
index b6a16f72ec3..cb306734002 100644
--- a/mysql-test/suite/galera/r/galera_defaults.result
+++ b/mysql-test/suite/galera/r/galera_defaults.result
@@ -50,7 +50,7 @@ WSREP_SST_DONOR
WSREP_SST_DONOR_REJECTS_QUERIES OFF
WSREP_SST_METHOD rsync
WSREP_SYNC_WAIT 7
-<BASE_DIR>; <BASE_HOST>; <BASE_PORT>; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.info_log_mask = 0; evs.install_timeout = PT7.5S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT10S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 0; evs.view_forget_timeout = P1D; <GCACHE_DIR>; gcache.keep_pages_size = 0; gcache.mem_size = 0; <GCACHE_NAME>; gcache.page_size = 128M; gcache.size = 10M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; <GCS_RECV_Q_HARD_LIMIT>; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; <GMCAST_LISTEN_ADDR>; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; <IST_RECV_ADDR>; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = P30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 7; socket.checksum = 2; socket.recv_buf_size = 212992;
+<BASE_DIR>; <BASE_HOST>; <BASE_PORT>; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT30S; evs.info_log_mask = 0; evs.install_timeout = PT15S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT10S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 0; evs.view_forget_timeout = P1D; <GCACHE_DIR>; gcache.keep_pages_size = 0; gcache.mem_size = 0; <GCACHE_NAME>; gcache.page_size = 128M; gcache.recover = no; gcache.size = 128M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; <RECV_Q_HARD_LIMIT>;gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; <GMCAST_LISTEN_ADDR>; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; <IST_RECV_ADDR>; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = PT30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 7; socket.checksum = 2; socket.recv_buf_size = 212992;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE 'wsrep_%'
AND VARIABLE_NAME != 'wsrep_debug_sync_waiters';
diff --git a/mysql-test/suite/galera/r/galera_desync_overlapped.result b/mysql-test/suite/galera/r/galera_desync_overlapped.result
new file mode 100644
index 00000000000..f9920e7f7ad
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_desync_overlapped.result
@@ -0,0 +1,50 @@
+connection node_1;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+CREATE TABLE t1 (f1 INTEGER, PRIMARY KEY (f1)) Engine=InnoDB;
+CREATE TABLE t2 (f1 INTEGER, PRIMARY KEY (f1)) Engine=InnoDB;
+SET GLOBAL wsrep_desync = 1;
+show status like 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 1
+SET DEBUG_SYNC='before_execute_sql_command SIGNAL alter1 WAIT_FOR alter2';
+INSERT INTO t1 (f1) SELECT 0000 + (100 * a1.f1) + (10 * a2.f1) + a3.f1 FROM ten AS a1, ten AS a2, ten AS a3;
+connection node_1a;
+SET GLOBAL wsrep_desync = 1;
+Warnings:
+Warning 1231 'wsrep_desync' is already ON.
+show status like 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 1
+SET DEBUG_SYNC='now WAIT_FOR alter1';
+SET DEBUG_SYNC='before_execute_sql_command SIGNAL alter2';
+INSERT INTO t2 (f1) SELECT 0000 + (100 * a1.f1) + (10 * a2.f1) + a3.f1 FROM ten AS a1, ten AS a2, ten AS a3;
+connection node_1;
+connection node_1a;
+connection node_1;
+SET DEBUG_SYNC='RESET';
+SET GLOBAL wsrep_desync = 0;
+show status like 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 0
+SET GLOBAL wsrep_desync = 0;
+Warnings:
+Warning 1231 'wsrep_desync' is already OFF.
+show status like 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 0
+show status like 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 0
+SET GLOBAL wsrep_desync = 0;
+Warnings:
+Warning 1231 'wsrep_desync' is already OFF.
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1000
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+1000
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_gcache_recover.result b/mysql-test/suite/galera/r/galera_gcache_recover.result
new file mode 100644
index 00000000000..127bcba39d8
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gcache_recover.result
@@ -0,0 +1,18 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+INSERT INTO t1 VALUES (2);
+Killing server ...
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+INSERT INTO t1 VALUES (3);
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+include/diff_servers.inc [servers=1 2]
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+include/assert_grep.inc [async IST sender starting to serve]
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+include/assert_grep.inc [Recovering GCache ring buffer: found gapless sequence]
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result b/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result
new file mode 100644
index 00000000000..30ee5772411
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result
@@ -0,0 +1,19 @@
+SET SESSION wsrep_sync_wait = 0;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+Killing server ...
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+include/diff_servers.inc [servers=1 2]
+DROP TABLE t1;
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+include/assert_grep.inc [IST first seqno 2 not found from cache, falling back to SST]
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
diff --git a/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result
new file mode 100644
index 00000000000..868b39bfbd6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result
@@ -0,0 +1,107 @@
+SET SESSION wsrep_sync_wait = 0;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE PROCEDURE insert_simple ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f1, f2) VALUES (DEFAULT,'abcdef');
+END WHILE;
+END|
+CREATE PROCEDURE insert_multi ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f1) VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT);
+END WHILE;
+END|
+CREATE PROCEDURE insert_transaction ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+SET AUTOCOMMIT = OFF;
+WHILE 1 DO
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+COMMIT;
+END WHILE;
+END|
+CREATE PROCEDURE update_simple ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+UPDATE t1 SET f2 = CONCAT(f2,f2);
+END WHILE;
+END|
+CREATE PROCEDURE insert_1k ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024));
+END WHILE;
+END|
+CREATE PROCEDURE insert_1m ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024));
+END WHILE;
+END|
+CREATE PROCEDURE insert_10m ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+END WHILE;
+END|
+CALL insert_simple();;
+CALL insert_multi();;
+CALL insert_transaction ();;
+CALL update_simple ();;
+CALL insert_1k ();;
+CALL insert_1m ();;
+CALL insert_10m ();;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+Killing server ...
+ERROR HY000: Lost connection to MySQL server during query
+ERROR HY000: Lost connection to MySQL server during query
+ERROR HY000: Lost connection to MySQL server during query
+ERROR HY000: Lost connection to MySQL server during query
+ERROR HY000: Lost connection to MySQL server during query
+ERROR HY000: Lost connection to MySQL server during query
+ERROR HY000: Lost connection to MySQL server during query
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+include/diff_servers.inc [servers=1 2]
+DROP TABLE t1;
+DROP TABLE ten;
+DROP PROCEDURE insert_simple;
+DROP PROCEDURE insert_multi;
+DROP PROCEDURE insert_transaction;
+DROP PROCEDURE update_simple;
+DROP PROCEDURE insert_1k;
+DROP PROCEDURE insert_1m;
+CALL mtr.add_suppression("conflict state 7 after post commit");
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+include/assert_grep.inc [async IST sender starting to serve]
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+include/assert_grep.inc [Recovering GCache ring buffer: found gapless sequence]
diff --git a/mysql-test/suite/galera/r/galera_many_tables_pk.result b/mysql-test/suite/galera/r/galera_many_tables_pk.result
index 38cf19a8d8f..ade0cb91344 100644
--- a/mysql-test/suite/galera/r/galera_many_tables_pk.result
+++ b/mysql-test/suite/galera/r/galera_many_tables_pk.result
@@ -1,7 +1,7 @@
connection node_1;
connection node_2;
-SELECT COUNT(*) = 900 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%';
-COUNT(*) = 900
+SELECT COUNT(*) = 100 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%';
+COUNT(*) = 100
1
connection node_1;
SET AUTOCOMMIT=OFF;
@@ -9,8 +9,8 @@ START TRANSACTION;
COMMIT;
connection node_2;
CREATE TABLE sum_table (f1 INTEGER);
-SELECT SUM(f1) = 900 FROM sum_table;
-SUM(f1) = 900
+SELECT SUM(f1) = 100 FROM sum_table;
+SUM(f1) = 100
1
connection node_1;
SET AUTOCOMMIT=OFF;
@@ -18,11 +18,12 @@ START TRANSACTION;
connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
-UPDATE t900 SET f1 = 3;
+UPDATE t100 SET f1 = 3;
connection node_1;
COMMIT;
connection node_2;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+include/diff_servers.inc [servers=1 2]
DROP SCHEMA test;
CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result b/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result
new file mode 100644
index 00000000000..a21b1edf3e7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result
@@ -0,0 +1,40 @@
+CALL mtr.add_suppression("Aborting");
+CALL mtr.add_suppression("unknown option '--galera-unknown-option'");
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a');
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 a
+Shutting down server ...
+UPDATE t1 SET f2 = 'b' WHERE f1 > 1;
+UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+Starting server ...
+Starting server ...
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+Shutting down server ...
+UPDATE t1 SET f2 = 'd' WHERE f1 > 1;
+UPDATE t1 SET f2 = 'd' WHERE f1 > 2;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 d
+3 d
+Starting server ...
+Starting server ...
+SELECT * FROM t1;
+f1 f2
+1 a
+2 d
+3 d
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result b/mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result
new file mode 100644
index 00000000000..8366cfd27c8
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result
@@ -0,0 +1,23 @@
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE parent (
+id INT PRIMARY KEY,
+KEY (id)
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT PRIMARY KEY AUTO_INCREMENT,
+parent_id INT
+) ENGINE=InnoDB;
+INSERT INTO parent VALUES (1);
+INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+ALTER TABLE child ADD FOREIGN KEY (parent_id) REFERENCES parent(id) ON UPDATE CASCADE;;
+UPDATE parent SET id = 2 WHERE id = 1;;
+SELECT COUNT(*) = 10000 FROM child WHERE parent_id = 2;
+COUNT(*) = 10000
+1
+SELECT COUNT(*) = 10000 FROM child WHERE parent_id = 2;
+COUNT(*) = 10000
+1
+DROP TABLE child;
+DROP TABLE parent;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_toi_drop_database.result b/mysql-test/suite/galera/r/galera_toi_drop_database.result
new file mode 100644
index 00000000000..c36d4d3eedd
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_drop_database.result
@@ -0,0 +1,32 @@
+connection node_1;
+CREATE DATABASE database1;
+USE database1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_retry_autocommit = 0;
+INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;;
+connection node_1a;
+USE database1;
+SET SESSION wsrep_retry_autocommit = 0;
+INSERT INTO t2 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;;
+connection node_2;
+DROP DATABASE database1;;
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1a;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+connection node_1;
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database1';
+COUNT(*) = 0
+1
+USE database1;
+ERROR 42000: Unknown database 'database1'
+connection node_2;
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database1';
+COUNT(*) = 0
+1
+USE database1;
+ERROR 42000: Unknown database 'database1'
diff --git a/mysql-test/suite/galera/r/galera_toi_truncate.result b/mysql-test/suite/galera/r/galera_toi_truncate.result
new file mode 100644
index 00000000000..aa407ba7610
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_truncate.result
@@ -0,0 +1,22 @@
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+connection node_2;
+SET SESSION wsrep_retry_autocommit = 0;
+INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;;
+connection node_1;
+TRUNCATE TABLE t1;;
+connection node_1;
+connection node_2;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_var_cluster_address.result b/mysql-test/suite/galera/r/galera_var_cluster_address.result
index 251a73a6f9a..81265f44397 100644
--- a/mysql-test/suite/galera/r/galera_var_cluster_address.result
+++ b/mysql-test/suite/galera/r/galera_var_cluster_address.result
@@ -43,6 +43,7 @@ CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed t
CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)");
CALL mtr.add_suppression("gcs connect failed: Connection timed out");
CALL mtr.add_suppression("WSREP: wsrep::connect\\(foo://\\) failed: 7");
+CALL mtr.add_suppression("WSREP: wsrep::connect\\(gcomm://192.0.2.1\\) failed: 7");
disconnect node_2;
disconnect node_1;
# End of test
diff --git a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
new file mode 100644
index 00000000000..f4d17ad9a41
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
@@ -0,0 +1,32 @@
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f2 = SLEEP(5);
+SET SESSION wsrep_retry_autocommit = 0;
+INSERT INTO t1 (f1) VALUES (1),(2);;
+TRUNCATE TABLE t1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET SESSION wsrep_retry_autocommit = 1;
+INSERT INTO t1 (f1) VALUES (3),(4);;
+TRUNCATE TABLE t1;
+SELECT * FROM test.t1;
+f1 f2
+3 0
+4 0
+CREATE PROCEDURE repeated_truncate ()
+BEGIN
+DECLARE i INT;
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET i = 0;
+WHILE i <= 1000 DO
+TRUNCATE TABLE t1;
+SET i = i + 1;
+END WHILE;
+END|
+CALL repeated_truncate();
+SET SESSION wsrep_retry_autocommit = 1;
+INSERT INTO t1 (f1) VALUES (5),(6);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET SESSION wsrep_retry_autocommit = 1024;
+INSERT INTO t1 (f1) VALUES (7),(8);;
+include/diff_servers.inc [servers=1 2]
+DROP TABLE t1;
+DROP PROCEDURE repeated_truncate;
diff --git a/mysql-test/suite/galera/r/galera_var_slave_threads.result b/mysql-test/suite/galera/r/galera_var_slave_threads.result
index c132c1bb7e2..102f7cb6386 100644
--- a/mysql-test/suite/galera/r/galera_var_slave_threads.result
+++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result
@@ -1,3 +1,4 @@
+CALL mtr.add_suppression("WSREP: Refusing exit for the last slave thread.");
connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result b/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result
new file mode 100644
index 00000000000..18a857d4471
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result
@@ -0,0 +1,25 @@
+CREATE TABLE t1 (
+f1 VARCHAR(255) PRIMARY KEY
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES ('abc');
+connection node_2;
+SELECT f1 = 'abc' FROM t1;
+f1 = 'abc'
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'klm';
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'xyz';
+connection node_1;
+COMMIT;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+include/assert_grep.inc [cluster conflict due to high priority abort for threads]
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result b/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result
new file mode 100644
index 00000000000..f19dc40205b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result
@@ -0,0 +1,5 @@
+call mtr.add_suppression("WSREP\: Unknown parameter 'gmcasts\.segment'");
+call mtr.add_suppression("WSREP\: Set options returned 7");
+SET GLOBAL wsrep_provider_options="gmcasts.segment=1";
+ERROR HY000: Incorrect arguments to SET
+Unhandled exceptions: 0
diff --git a/mysql-test/suite/galera/r/lp1376747-2.result b/mysql-test/suite/galera/r/lp1376747-2.result
new file mode 100644
index 00000000000..dba3eb45af5
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1376747-2.result
@@ -0,0 +1,23 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+FLUSH TABLES t1 FOR EXPORT;
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2,3);
+connection node_2;
+UNLOCK TABLES;
+### t1 should have column f2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `f2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT * from t1;
+id f2
+1 NULL
+2 3
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/lp1376747-3.result b/mysql-test/suite/galera/r/lp1376747-3.result
new file mode 100644
index 00000000000..a2c55b5f1f6
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1376747-3.result
@@ -0,0 +1,27 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+FLUSH TABLE WITH READ LOCK;
+### This shouldn't block.
+FLUSH TABLES t1 FOR EXPORT;
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+UNLOCK TABLES;
+### t1 should have column f2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `f2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+connection node_1;
+INSERT INTO t1 VALUES (2,3);
+connection node_2;
+SELECT * from t1;
+id f2
+1 NULL
+2 3
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/lp1376747-4.result b/mysql-test/suite/galera/r/lp1376747-4.result
new file mode 100644
index 00000000000..f1d32aa8f69
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1376747-4.result
@@ -0,0 +1,47 @@
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SET session wsrep_sync_wait=0;
+SET session wsrep_causal_reads=OFF;
+Warnings:
+Warning 1287 '@@wsrep_causal_reads' is deprecated and will be removed in a future release. Please use '@@wsrep_sync_wait=1' instead
+FLUSH TABLE WITH READ LOCK;
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2,3);
+connection node_2a;
+SET session wsrep_sync_wait=0;
+SET session wsrep_causal_reads=OFF;
+Warnings:
+Warning 1287 '@@wsrep_causal_reads' is deprecated and will be removed in a future release. Please use '@@wsrep_sync_wait=1' instead
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+FLUSH TABLES t1 WITH READ LOCK;;
+connection node_2;
+UNLOCK TABLES;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+connection node_2a;
+UNLOCK TABLES;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `f2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT * from t1;
+id f2
+1 NULL
+2 3
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/lp1376747.result b/mysql-test/suite/galera/r/lp1376747.result
new file mode 100644
index 00000000000..4858835c83f
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1376747.result
@@ -0,0 +1,23 @@
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+FLUSH TABLES t1 WITH READ LOCK;
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2,3);
+connection node_2;
+UNLOCK TABLES;
+### t1 should have column f2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `f2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT * from t1;
+id f2
+1 NULL
+2 3
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/pxc-421.result b/mysql-test/suite/galera/r/pxc-421.result
new file mode 100644
index 00000000000..4fde5a26819
--- /dev/null
+++ b/mysql-test/suite/galera/r/pxc-421.result
@@ -0,0 +1,42 @@
+connection node_1;
+set GLOBAL wsrep_slave_threads=26;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 (f1) SELECT * from t1 as x1;
+connection node_2;
+set GLOBAL wsrep_slave_threads=16;
+SET GLOBAL wsrep_provider='none';
+INSERT INTO t1 VALUES (2);
+connection node_1;
+INSERT INTO t1 VALUES (3);
+connection node_2;
+INSERT INTO t1 VALUES (4);
+set GLOBAL wsrep_slave_threads=5;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_1;
+set GLOBAL wsrep_slave_threads=12;
+SELECT COUNT(*) = 4 FROM t1;
+COUNT(*) = 4
+1
+INSERT INTO t1 VALUES (100), (101), (102);
+connection node_2;
+set GLOBAL wsrep_slave_threads=5;
+INSERT INTO t1 (f1) SELECT * from t1 as x1;
+show global variables like 'wsrep_slave_threads';
+Variable_name Value
+wsrep_slave_threads 5
+SET GLOBAL wsrep_slave_threads = 1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+16
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+15
+show global variables like 'wsrep_slave_threads';
+Variable_name Value
+wsrep_slave_threads 12
+SET GLOBAL wsrep_slave_threads = 1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/GAL-401.test b/mysql-test/suite/galera/t/GAL-401.test
new file mode 100644
index 00000000000..66015f970c9
--- /dev/null
+++ b/mysql-test/suite/galera/t/GAL-401.test
@@ -0,0 +1,51 @@
+# This tests proper desync counter cleanup when DONOR/DESYNC state is cleared.
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Make node 1 tolerate split-brain
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+
+# Desync and disconnect node 2 from the PC:
+--connection node_2
+SET @@global.wsrep_desync = 1;
+SET SESSION wsrep_dirty_reads=1;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+
+# Wait until node 2 disappears from the PC:
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+
+# Modify app state to force node 2 into PRIMARY upon reconnection.
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+
+# Reconnect node 2 to the PC:
+--connection node_2
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# Must return 0:
+SHOW STATUS LIKE 'wsrep_desync_count';
+
+# Resync node_2, should pass:
+SET @@global.wsrep_desync = 0;
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+--source include/wait_condition.inc
+
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CALL mtr.add_suppression("WSREP: Protocol violation. JOIN message sender (.*) is not in state transfer \\(SYNCED\\). Message ignored.");
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false';
diff --git a/mysql-test/suite/galera/t/GAL-419.test b/mysql-test/suite/galera/t/GAL-419.test
new file mode 100644
index 00000000000..e50b948bf35
--- /dev/null
+++ b/mysql-test/suite/galera/t/GAL-419.test
@@ -0,0 +1,35 @@
+#
+# GAL-419 safe_to_bootstrap: boostrap using wsrep_cluster_address=gcomm:// not prevented
+#
+
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+--source include/kill_galera.inc
+
+--connection node_1
+SET SESSION wsrep_sync_wait = 0;
+--source include/kill_galera.inc
+
+--sleep 2
+
+# Node #1 has wsrep_cluster_address=gcomm:// in my.cnf, so should fail to bootstrap
+
+--error 1
+--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf | grep 'This node is not safe to bootstrap the cluster'
+
+# Unless we remove grastate.dat
+
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
+--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+--connection node_1
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--source include/start_mysqld.inc
+--source include/wait_until_connected_again.inc
+
+--connection node_2
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--source include/start_mysqld.inc
diff --git a/mysql-test/suite/galera/t/GAL-480.test b/mysql-test/suite/galera/t/GAL-480.test
new file mode 100644
index 00000000000..c2b34f2a935
--- /dev/null
+++ b/mysql-test/suite/galera/t/GAL-480.test
@@ -0,0 +1,46 @@
+--source include/galera_cluster.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 CHAR(10), f0 integer) ENGINE=InnoDB;
+
+FLUSH TABLE t1 FOR EXPORT;
+UNLOCK TABLES;
+
+ALTER TABLE t1 DROP COLUMN f1;
+
+SET SESSION wsrep_osu_method='RSU';
+ALTER TABLE t1 ADD COLUMN f1 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f1;
+ALTER TABLE t1 ADD COLUMN f2 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f2;
+ALTER TABLE t1 ADD COLUMN f3 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f3;
+ALTER TABLE t1 ADD COLUMN f4 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f4;
+ALTER TABLE t1 ADD COLUMN f5 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f5;
+ALTER TABLE t1 ADD COLUMN f6 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f6;
+ALTER TABLE t1 ADD COLUMN f7 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f7;
+ALTER TABLE t1 ADD COLUMN f8 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f8;
+ALTER TABLE t1 ADD COLUMN f9 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f9;
+ALTER TABLE t1 ADD COLUMN f10 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f10;
+ALTER TABLE t1 ADD COLUMN f11 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f11;
+ALTER TABLE t1 ADD COLUMN f12 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f12;
+ALTER TABLE t1 ADD COLUMN f13 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f13;
+ALTER TABLE t1 ADD COLUMN f14 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f14;
+ALTER TABLE t1 ADD COLUMN f15 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f15;
+ALTER TABLE t1 ADD COLUMN f16 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f16;
+
+SET SESSION wsrep_osu_method='TOI';
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MW-258.test b/mysql-test/suite/galera/t/MW-258.test
index f00b82d6bb4..174dd2c02c6 100644
--- a/mysql-test/suite/galera/t/MW-258.test
+++ b/mysql-test/suite/galera/t/MW-258.test
@@ -34,7 +34,7 @@ UNLOCK TABLES;
--connection node_1
--echo value after RSU:
---sleep 2
+--sleep 3
SHOW STATUS LIKE 'wsrep_desync_count';
SHOW VARIABLES LIKE 'wsrep_desync';
SET GLOBAL wsrep_desync=0;
diff --git a/mysql-test/suite/galera/t/MW-313-master.opt b/mysql-test/suite/galera/t/MW-313-master.opt
new file mode 100644
index 00000000000..8a755e98b00
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-313-master.opt
@@ -0,0 +1 @@
+--log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/MW-313.test b/mysql-test/suite/galera/t/MW-313.test
new file mode 100644
index 00000000000..92fd835c615
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-313.test
@@ -0,0 +1,51 @@
+#
+# MW-313 Enforce wsrep_max_ws_rows also when binlog is enabled
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_binlog_format_row.inc
+
+# No error expected for SELECT and SHOW
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+
+SET GLOBAL wsrep_max_ws_rows = 2;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SELECT * FROM t1 GROUP BY f1;
+SELECT * FROM t1 GROUP BY f1;
+
+--error 0
+SELECT * FROM t1 GROUP BY f1;
+
+--disable_result_log
+--error 0
+SHOW STATUS LIKE '%wsrep%';
+--enable_result_log
+
+# Error expected for DML
+
+--error ER_ERROR_DURING_COMMIT
+INSERT INTO t1 SELECT * FROM t1;
+
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES (1);
+
+--error ER_ERROR_DURING_COMMIT
+INSERT INTO t1 (f1) VALUES (2),(3),(4);
+
+ROLLBACK;
+START TRANSACTION;
+--error ER_ERROR_DURING_COMMIT
+DELETE FROM t1;
+
+DROP TABLE t1;
+SET GLOBAL wsrep_max_ws_rows = 0;
diff --git a/mysql-test/suite/galera/t/MW-328-footer.inc b/mysql-test/suite/galera/t/MW-328-footer.inc
new file mode 100644
index 00000000000..5b736df220f
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-328-footer.inc
@@ -0,0 +1,18 @@
+#
+# Cleanup for MW-328 tests
+#
+
+--connection node_1
+--disable_query_log
+--eval KILL CONNECTION $sp_connection_id
+--enable_query_log
+
+--connection node_1X
+--error 2013,1317
+--reap
+
+--connection node_1
+DROP PROCEDURE proc_update;
+DROP TABLE t1, t2;
+
+CALL mtr.add_suppression("conflict state 3 after post commit");
diff --git a/mysql-test/suite/galera/t/MW-328-header.inc b/mysql-test/suite/galera/t/MW-328-header.inc
new file mode 100644
index 00000000000..f0a6ccaccc6
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-328-header.inc
@@ -0,0 +1,29 @@
+#
+# Initialization for MW-328 tests
+#
+
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES (1);
+
+CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
+
+#
+# Have some random updates going on against t1
+#
+
+DELIMITER |;
+CREATE PROCEDURE proc_update ()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ SET SESSION wsrep_sync_wait = 0;
+ WHILE 1 DO
+ UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4);
+ END WHILE;
+END|
+
+DELIMITER ;|
+
+--connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1X
+--let $sp_connection_id = `SELECT CONNECTION_ID()`
+--send CALL proc_update();
diff --git a/mysql-test/suite/galera/t/MW-328A.test b/mysql-test/suite/galera/t/MW-328A.test
new file mode 100644
index 00000000000..4d6e1ea3625
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-328A.test
@@ -0,0 +1,56 @@
+#
+# MW-328 Fix unnecessary/silent BF aborts
+#
+
+#
+# Attempt to insert into t2 and check if insert actually inserted rows if
+# a success was reported.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source suite/galera/t/MW-328-header.inc
+
+--connection node_2
+--let $count = 100
+--let $successes = 0
+--let $deadlocks = 0
+
+SET SESSION wsrep_retry_autocommit = 0;
+
+--disable_query_log
+
+while ($count)
+{
+ TRUNCATE TABLE t2;
+
+ --error 0,1213
+ INSERT IGNORE INTO t2 SELECT f2 FROM t1;
+ if ($mysql_errno != 1213) {
+ --inc $successes
+ if (`SELECT COUNT(*) = 0 FROM t2`) {
+ --die No rows arrived in table t2
+ }
+ }
+
+ if ($mysql_errno == 1213) {
+ --inc $deadlocks
+
+ }
+
+ --dec $count
+}
+
+--enable_query_log
+
+#
+# Check that the test produced both deadlocks and successes
+#
+
+--disable_query_log
+--eval SELECT $successes > 0 AS have_successes
+--eval SELECT $deadlocks > 0 AS have_deadlocks
+--enable_query_log
+
+
+--source suite/galera/t/MW-328-footer.inc
diff --git a/mysql-test/suite/galera/t/MW-328B.test b/mysql-test/suite/galera/t/MW-328B.test
new file mode 100644
index 00000000000..a7b4053ab0c
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-328B.test
@@ -0,0 +1,36 @@
+#
+# MW-328 Fix unnecessary/silent BF aborts
+#
+
+#
+# Make sure an unrelated SELECT following a BF-aborted query never
+# gets the deadlock error
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source suite/galera/t/MW-328-header.inc
+
+--connection node_2
+--let $count = 100
+
+SET SESSION wsrep_retry_autocommit = 0;
+
+--disable_query_log
+
+while ($count)
+{
+ --error 0,1213
+ INSERT IGNORE INTO t2 SELECT f2 FROM t1;
+
+ --disable_result_log
+ --error 0
+ SELECT 1 FROM DUAL;
+ --enable_result_log
+
+ --dec $count
+}
+
+--enable_query_log
+
+--source suite/galera/t/MW-328-footer.inc
diff --git a/mysql-test/suite/galera/t/MW-328C.test b/mysql-test/suite/galera/t/MW-328C.test
new file mode 100644
index 00000000000..b681e743ab3
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-328C.test
@@ -0,0 +1,36 @@
+#
+# MW-328 Fix unnecessary/silent BF aborts
+#
+
+#
+# Make sure that a high value of wsrep_retry_autocommit
+# masks all deadlock errors
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source suite/galera/t/MW-328-header.inc
+
+--connection node_2
+--let $count = 100
+
+SET SESSION wsrep_retry_autocommit = 10000;
+
+--disable_query_log
+
+while ($count)
+{
+ --error 0
+ INSERT IGNORE INTO t2 SELECT f2 FROM t1;
+
+ --disable_result_log
+ --error 0
+ SELECT 1 FROM DUAL;
+ --enable_result_log
+
+ --dec $count
+}
+
+--enable_query_log
+
+--source suite/galera/t/MW-328-footer.inc
diff --git a/mysql-test/suite/galera/t/MW-328D.test b/mysql-test/suite/galera/t/MW-328D.test
new file mode 100644
index 00000000000..d5cffdb8f47
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-328D.test
@@ -0,0 +1,40 @@
+#
+# MW-328 Fix unnecessary/silent BF aborts
+#
+
+#
+# Test that non-Galera deadlock error still behaves as expected
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (i INT) ENGINE = InnoDB;
+INSERT INTO t1 (i) VALUES(1);
+
+CREATE TABLE t2 (i INT) ENGINE = InnoDB;
+
+# Create a deadlock situation
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SELECT * FROM t1 WHERE i = 1 LOCK IN SHARE MODE;
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+--send INSERT IGNORE INTO t2 SELECT * FROM t1 WHERE i = 1 FOR UPDATE;
+
+--connection node_1
+--sleep 2
+DELETE FROM t1 WHERE i = 1;
+COMMIT;
+
+# We expect that ER_LOCK_DEADLOCK will be delivered even though it was a INSERT INGORE statement
+--connection node_1a
+--error ER_LOCK_DEADLOCK
+--reap
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera/t/MW-328E.test b/mysql-test/suite/galera/t/MW-328E.test
new file mode 100644
index 00000000000..fd4b0bf9039
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-328E.test
@@ -0,0 +1,41 @@
+#
+# MW-328 Fix unnecessary/silent BF aborts
+#
+
+#
+# Test that non-Galera deadlock error still behaves as expected (case #2)
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+create table t1 (i int primary key, j int) engine=innodb;
+create table t2 (i int primary key, j int) engine=innodb;
+
+insert into t1 values (1,0);
+insert into t2 values (2,0);
+
+set autocommit=off;
+start transaction;
+update t1 set j=1 where i=1;
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1a
+set autocommit=off;
+start transaction;
+begin;
+update t2 set j=1 where i=2;
+
+--connection node_1
+# Hang expected here
+--send insert into t1 select * from t2;
+
+--sleep 2
+--connection node_1a
+--error ER_LOCK_DEADLOCK
+insert into t2 select * from t1;
+
+--connection node_1
+--reap
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera/t/MW-329-master.opt b/mysql-test/suite/galera/t/MW-329-master.opt
new file mode 100644
index 00000000000..6565a6af3c4
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-329-master.opt
@@ -0,0 +1 @@
+--wsrep-retry-autocommit=0
diff --git a/mysql-test/suite/galera/t/MW-329.test b/mysql-test/suite/galera/t/MW-329.test
new file mode 100644
index 00000000000..acf6763b396
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-329.test
@@ -0,0 +1,82 @@
+#
+# #MW-329 Fix incorrect affected rows count after replay
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
+
+# We start with a populated table
+INSERT INTO t1 (f1) VALUES (1),(65535);
+
+# Clear the wsrep_local_replays counter
+
+FLUSH STATUS;
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays';
+
+#
+# Run concurrent INSERTs
+#
+
+DELIMITER |;
+CREATE PROCEDURE proc_insert ()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ SET SESSION wsrep_sync_wait = 0;
+ WHILE 1 DO
+ INSERT INTO t1 (f1) VALUES (FLOOR( 1 + RAND( ) * 65535 ));
+ END WHILE;
+END|
+DELIMITER ;|
+
+--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connection node_1b
+--let $connection_id = `SELECT CONNECTION_ID()`
+--send CALL proc_insert();
+
+#
+# Run concurrent UPDATEs. We expect that each UPDATE will report that
+# some rows were matched and updated
+#
+
+--connection node_2
+--let $count = 10
+while ($count)
+{
+ --let $signature = `SELECT LEFT(MD5(RAND()), 10)`
+ --disable_query_log
+ --error 0,ER_LOCK_DEADLOCK
+ --eval UPDATE t1 SET f2 = '$signature'
+ --enable_query_log
+ --let $row_count = `SELECT ROW_COUNT()`
+ if (`SELECT @@error_count = 0`) {
+ if (`SELECT $row_count = 0`) {
+ --die ROW_COUNT() = 0
+ }
+ }
+ --dec $count
+}
+
+#
+# Confirm that some transaction replays occurred
+#
+
+SELECT VARIABLE_VALUE > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays';
+
+#
+# Terminate the stored procedure
+#
+
+--connection node_1
+--disable_query_log
+--eval KILL CONNECTION $connection_id
+--enable_query_log
+
+--connection node_1b
+--error 0,2013,1317
+--reap
+
+--connection node_1
+DROP PROCEDURE proc_insert;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/ev51914.test b/mysql-test/suite/galera/t/ev51914.test
new file mode 100644
index 00000000000..e5edacabe89
--- /dev/null
+++ b/mysql-test/suite/galera/t/ev51914.test
@@ -0,0 +1,214 @@
+# Disable SAVEPOINT and ROLLBACK TO SAVEPOINT in SP, SF, TR.
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+
+--connection node_1
+--echo SAVEPOINT in a stored function should be forbidden
+--delimiter |
+CREATE FUNCTION f1 () RETURNS INT BEGIN
+ SAVEPOINT s;
+ RETURN 1;
+END|
+--delimiter ;
+
+SELECT f1();
+
+DROP FUNCTION f1;
+
+--echo ROLLBACK TO SAVEPOINT in a stored function should be forbidden
+--delimiter |
+CREATE FUNCTION f2 () RETURNS INT BEGIN
+ ROLLBACK TO SAVEPOINT s;
+ RETURN 1;
+END|
+--delimiter ;
+
+BEGIN;
+SAVEPOINT s;
+--error ER_SP_DOES_NOT_EXIST
+SELECT f2();
+COMMIT;
+
+DROP FUNCTION f2;
+
+BEGIN;
+SAVEPOINT S;
+ROLLBACK TO SAVEPOINT S;
+COMMIT;
+
+
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 values (110), (111), (112), (113), (114);
+
+--echo Direct SAVEPOINT in a trigger should be forbidden
+--connection node_2
+CREATE TRIGGER i1_t1 BEFORE INSERT ON t1 FOR EACH ROW SAVEPOINT s;
+
+--connection node_1
+INSERT INTO t1 VALUES (1);
+DROP TRIGGER i1_t1;
+
+CREATE TRIGGER i2_t1 AFTER INSERT ON t1 FOR EACH ROW SAVEPOINT s;
+INSERT INTO t1 VALUES (2);
+DROP TRIGGER i2_t1;
+
+INSERT INTO t1 VALUES (3);
+CREATE TRIGGER u1_t1 BEFORE UPDATE ON t1 FOR EACH ROW SAVEPOINT s;
+UPDATE t1 SET a=4 WHERE a=3;
+DROP TRIGGER u1_t1;
+
+CREATE TRIGGER u2_t1 AFTER UPDATE ON t1 FOR EACH ROW SAVEPOINT s;
+UPDATE t1 SET a=4 WHERE a=3;
+DROP TRIGGER u2_t1;
+
+CREATE TRIGGER d1_t1 BEFORE DELETE ON t1 FOR EACH ROW SAVEPOINT s;
+DELETE FROM t1;
+DROP TRIGGER d1_t1;
+
+CREATE TRIGGER d1_t1 AFTER DELETE ON t1 FOR EACH ROW SAVEPOINT s;
+DELETE FROM t1;
+DROP TRIGGER d1_t1;
+
+--echo SAVEPOINT in a compound statement in a trigger should be forbidden
+--delimiter |
+CREATE TRIGGER i3_t1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN
+ SAVEPOINT s;
+END|
+--delimiter ;
+INSERT INTO t1 VALUES (5);
+DROP TRIGGER i3_t1;
+
+--echo SAVEPOINT in a PS call in a trigger should be forbidden
+# echo handled by SAVEPOINT forbidden in PS
+--delimiter |
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+CREATE TRIGGER i4_t1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN
+ PREPARE set_savepoint FROM "SAVEPOINT s";
+ EXECUTE set_savepoint;
+ DEALLOCATE PREPARE set_savepoint;
+END|
+--delimiter ;
+
+--connection node_2
+--echo SAVEPOINT in SP called from a trigger should be forbidden
+--delimiter |
+CREATE PROCEDURE p1() BEGIN
+ SAVEPOINT s;
+END|
+--delimiter ;
+--connection node_1
+CREATE TRIGGER i5_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p1;
+INSERT INTO t1 VALUES (6);
+DROP TRIGGER i5_t1;
+
+--echo SAVEPOINT in a SP called from a PS called from a trigger be forbidden
+# echo handled by SAVEPOINT forbidden in PS
+PREPARE call_p1 FROM "CALL p1";
+--error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
+CREATE TRIGGER i6_t1 BEFORE INSERT ON t1 FOR EACH ROW EXECUTE call_p1;
+
+--echo SAVEPOINT in a function called from a trigger should be forbidden
+--delimiter |
+CREATE FUNCTION f1 () RETURNS INT BEGIN
+ SAVEPOINT s;
+ RETURN 1;
+END|
+--delimiter ;
+CREATE TRIGGER i7_t1 BEFORE INSERT ON t1 FOR EACH ROW SET @foo = f1();
+INSERT INTO t1 VALUES (7);
+DROP TRIGGER i7_t1;
+
+--echo SAVEPOINT in a SP called from a SP called from a trigger should be forbidden
+--delimiter |
+CREATE PROCEDURE p2() BEGIN
+ CALL p1();
+END|
+--delimiter ;
+CREATE TRIGGER i8_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p2;
+INSERT INTO t1 VALUES (8);
+DROP TRIGGER i8_t1;
+
+--echo SAVEPOINT in a SP called from a trigger called from a SP should be forbidden
+CREATE TRIGGER i9_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p1;
+--delimiter |
+CREATE PROCEDURE p3() BEGIN
+ INSERT INTO t1 VALUES (9);
+END|
+--delimiter ;
+CALL p3();
+DROP TRIGGER i9_t1;
+
+--echo ROLLBACK TO SAVEPOINT in trigger as a trivial statement should be forbidden
+# Trigger activation creates a new savepoint level, making the earlier levels
+# inaccessible. Thus forbidding SAVEPOINT should be enough as then there is
+# no valid savepoint to pass to ROLLBACK TO SAVEPOINT, but we forbid it once
+# more just in case.
+CREATE TRIGGER i4_t1 BEFORE INSERT ON t1 FOR EACH ROW ROLLBACK TO SAVEPOINT s;
+BEGIN;
+SAVEPOINT s;
+--error ER_SP_DOES_NOT_EXIST
+INSERT INTO t1 VALUES (5);
+COMMIT;
+DROP TRIGGER i4_t1;
+
+--echo ROLLBACK TO SAVEPOINT in a trigger in a SP call should be forbidden
+--delimiter |
+CREATE PROCEDURE p4() BEGIN
+ ROLLBACK TO SAVEPOINT s;
+END|
+--delimiter ;
+CREATE TRIGGER i5_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p4;
+BEGIN;
+SAVEPOINT s;
+--error ER_SP_DOES_NOT_EXIST
+INSERT INTO t1 VALUES (6);
+COMMIT;
+DROP TRIGGER i5_t1;
+
+--echo SAVEPOINT in a SP next to a trigger should work
+CREATE TRIGGER i6_t1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a = NEW.a + 1;
+--delimiter |
+CREATE PROCEDURE p5() BEGIN
+ SAVEPOINT s;
+ INSERT INTO t1 VALUES (10);
+ ROLLBACK TO SAVEPOINT s;
+END|
+--delimiter ;
+BEGIN;
+CALL p5();
+COMMIT;
+DROP TRIGGER i6_t1;
+
+--connection node_2
+delimiter |;
+create trigger t1 before insert on t1 for each row
+begin
+ insert into t2 values (NULL);
+end|
+delimiter ;|
+
+--connection node_1
+INSERT INTO t1 VALUES (201), (202), (203);
+
+--connection node_1
+SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+
+--connection node_2
+SELECT * FROM t1;
+SELECT COUNT(*) FROM t2;
+
+--connection node_1
+DEALLOCATE PREPARE call_p1;
+
+--connection node_2
+DROP TABLE t1, t2;
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP PROCEDURE p3;
+DROP PROCEDURE p4;
+DROP PROCEDURE p5;
+DROP FUNCTION f1;
diff --git a/mysql-test/suite/galera/t/galera#414.test b/mysql-test/suite/galera/t/galera#414.test
index 0ee6dcac700..dccb28e4054 100644
--- a/mysql-test/suite/galera/t/galera#414.test
+++ b/mysql-test/suite/galera/t/galera#414.test
@@ -24,10 +24,14 @@ SET SESSION wsrep_on = OFF;
SET SESSION wsrep_on = ON;
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
--connection node_1
CALL mtr.add_suppression("Failed to set packet size");
--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
CALL mtr.add_suppression("Failed to set packet size");
diff --git a/mysql-test/suite/galera/t/galera_account_management.test b/mysql-test/suite/galera/t/galera_account_management.test
index 357319ad106..6dea0fcfa9e 100644
--- a/mysql-test/suite/galera/t/galera_account_management.test
+++ b/mysql-test/suite/galera/t/galera_account_management.test
@@ -18,14 +18,12 @@ SELECT COUNT(*) = 2 FROM mysql.user WHERE user IN ('user1', 'user2');
# ALTER USER
#
-# LP bug 1376269
-#
-#--connection node_1
-#ALTER USER user1 PASSWORD EXPIRE;
-#SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
-#
-#--connection node_2
-#SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
+--connection node_1
+ALTER USER user1 PASSWORD EXPIRE;
+SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
+
+--connection node_2
+SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
#
# RENAME USER
diff --git a/mysql-test/suite/galera/t/galera_admin.test b/mysql-test/suite/galera/t/galera_admin.test
new file mode 100644
index 00000000000..e3c43256ad5
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_admin.test
@@ -0,0 +1,86 @@
+#
+# Test that various admin commands from sql_admin.cc
+# Currently, REPAIR, OPTIMIZE and ANALYZE are tested.
+# Jira: PXC-390
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+DROP TABLE IF EXISTS x1, x2;
+--enable_warnings
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER);
+CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
+SET GLOBAL wsrep_replicate_myisam = TRUE;
+CREATE TABLE x1 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE x2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO x1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO t2 (f2) SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4;
+INSERT INTO x2 (f2) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+# Wait until all the data from t2 has been replicated
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 10 FROM x1;
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 10 FROM x2;
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 10 FROM t1;
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 10000 FROM t2;
+--source include/wait_condition.inc
+
+
+--echo # ANALYZE test
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_1
+ANALYZE TABLE t1, t2;
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE = $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
+--source include/wait_condition.inc
+
+
+
+--echo # OPTIMIZE test
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_1
+OPTIMIZE TABLE t1, t2;
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
+--source include/wait_condition.inc
+
+
+
+--echo # REPAIR test
+--connection node_2
+--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'`
+
+--connection node_1
+REPAIR TABLE x1, x2;
+
+--connection node_2
+--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'
+--source include/wait_condition.inc
+
+
+
+--connection node_2
+SELECT COUNT(*) = 10 FROM t1;
+SELECT COUNT(*) = 10 FROM x1;
+SELECT COUNT(*) = 10000 FROM t2;
+SELECT COUNT(*) = 10 FROM x2;
+
+--connection node_1
+DROP TABLE t1, t2;
+DROP TABLE x1, x2;
+SET GLOBAL wsrep_replicate_myisam = FALSE;
diff --git a/mysql-test/suite/galera/t/galera_bf_abort.test b/mysql-test/suite/galera/t/galera_bf_abort.test
index 69825ea4919..f3476fba490 100644
--- a/mysql-test/suite/galera/t/galera_bf_abort.test
+++ b/mysql-test/suite/galera/t/galera_bf_abort.test
@@ -5,20 +5,25 @@
# Test a local transaction being aborted by a slave one
#
-CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(6)) ENGINE=InnoDB;
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2
--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
SET AUTOCOMMIT=OFF;
START TRANSACTION;
-INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1,'node_2');
--connection node_1
-INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1,'node_1');
+
+--connection node_2a
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'node_1'
+--source include/wait_condition.inc
--connection node_2
--error ER_LOCK_DEADLOCK
-INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (2, 'node_2');
--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
diff --git a/mysql-test/suite/galera/t/galera_desync_overlapped.test b/mysql-test/suite/galera/t/galera_desync_overlapped.test
new file mode 100644
index 00000000000..8b78e8cdeb7
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_desync_overlapped.test
@@ -0,0 +1,59 @@
+#
+# Test for overlapped transactions under manual desync.
+#
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+
+--connection node_1
+
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+CREATE TABLE t1 (f1 INTEGER, PRIMARY KEY (f1)) Engine=InnoDB;
+CREATE TABLE t2 (f1 INTEGER, PRIMARY KEY (f1)) Engine=InnoDB;
+
+SET GLOBAL wsrep_desync = 1;
+show status like 'wsrep_desync_count';
+SET DEBUG_SYNC='before_execute_sql_command SIGNAL alter1 WAIT_FOR alter2';
+send INSERT INTO t1 (f1) SELECT 0000 + (100 * a1.f1) + (10 * a2.f1) + a3.f1 FROM ten AS a1, ten AS a2, ten AS a3;
+
+--connection node_1a
+
+SET GLOBAL wsrep_desync = 1;
+show status like 'wsrep_desync_count';
+SET DEBUG_SYNC='now WAIT_FOR alter1';
+SET DEBUG_SYNC='before_execute_sql_command SIGNAL alter2';
+send INSERT INTO t2 (f1) SELECT 0000 + (100 * a1.f1) + (10 * a2.f1) + a3.f1 FROM ten AS a1, ten AS a2, ten AS a3;
+
+--connection node_1
+reap;
+
+--connection node_1a
+reap;
+
+--connection node_1
+
+SET DEBUG_SYNC='RESET';
+
+SET GLOBAL wsrep_desync = 0;
+show status like 'wsrep_desync_count';
+SET GLOBAL wsrep_desync = 0;
+show status like 'wsrep_desync_count';
+
+--disable_query_log
+call mtr.add_suppression("Trying to make wsrep_desync = OFF on the node that is already synchronized.");
+--enable_query_log
+show status like 'wsrep_desync_count';
+SET GLOBAL wsrep_desync = 0;
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_flush_local.opt b/mysql-test/suite/galera/t/galera_flush_local.opt
index 45a0ca24dc7..5a1fb6748d9 100644
--- a/mysql-test/suite/galera/t/galera_flush_local.opt
+++ b/mysql-test/suite/galera/t/galera_flush_local.opt
@@ -1 +1 @@
---query_cache_type=1 --query_cache_size=1000000 --userstat=1 --wsrep_replicate_myisam=true
+--query_cache_type=1 --query_cache_size=1000000
diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.cnf b/mysql-test/suite/galera/t/galera_gcache_recover.cnf
new file mode 100644
index 00000000000..c7b59b6a27e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gcache_recover.cnf
@@ -0,0 +1,7 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes;pc.ignore_sb=true'
diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.test b/mysql-test/suite/galera/t/galera_gcache_recover.test
new file mode 100644
index 00000000000..e1bfe517d27
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gcache_recover.test
@@ -0,0 +1,77 @@
+#
+# Kill entire cluster while gcache.recover=yes. Expect that node #2 will rejoin using IST
+#
+
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET SESSION wsrep_sync_wait = 0;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) > 0 FROM t1;
+--source include/wait_condition.inc
+
+SET SESSION wsrep_sync_wait = 0;
+--source include/kill_galera.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+INSERT INTO t1 VALUES (2);
+
+--source include/kill_galera.inc
+
+--sleep 1
+
+--connection node_1
+--let $galera_wsrep_recover_server_id=1
+--source suite/galera/include/galera_wsrep_recover.inc
+
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--source include/start_mysqld.inc
+
+INSERT INTO t1 VALUES (3);
+
+--connection node_2
+--let $galera_wsrep_recover_server_id=2
+--source suite/galera/include/galera_wsrep_recover.inc
+
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--source include/start_mysqld.inc
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--let $diff_servers = 1 2
+--source include/diff_servers.inc
+
+--connection node_1
+# Warning happens when the cluster is started for the first time
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+
+# Confirm that IST took place
+--let $assert_text = async IST sender starting to serve
+--let $assert_select = async IST sender starting to serve
+--let $assert_count = 1
+--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
+--let $assert_only_after = starting as process
+--source include/assert_grep.inc
+
+--connection node_2
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+
+# Confirm that gcache recovery took place
+
+--let $assert_text = Recovering GCache ring buffer: found gapless sequence
+--let $assert_select = Recovering GCache ring buffer: found gapless sequence
+--let $assert_count = 1
+--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err
+--let $assert_only_after = starting as process
+--source include/assert_grep.inc
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf
new file mode 100644
index 00000000000..da74ea9fc5d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+max_allowed_packet=10M
+innodb_log_file_size=110M
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true;gcache.size=10M'
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes;pc.ignore_sb=true;gcache.size=10M'
diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test
new file mode 100644
index 00000000000..b7fd9cf3aed
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test
@@ -0,0 +1,59 @@
+#
+# Attempt gcache recovery on a full gcache. Node will not be able to join via IST due to gcache rollover
+#
+
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+SET SESSION wsrep_sync_wait = 0;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+--source include/kill_galera.inc
+
+--connection node_1
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+--source include/kill_galera.inc
+
+--connection node_1
+--let $galera_wsrep_recover_server_id=1
+--source suite/galera/include/galera_wsrep_recover.inc
+
+--let $_expect_file_name = $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--source include/start_mysqld.inc
+--connection node_2
+--let $galera_wsrep_recover_server_id=2
+--source suite/galera/include/galera_wsrep_recover.inc
+
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--source include/start_mysqld.inc
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--let $diff_servers = 1 2
+--source include/diff_servers.inc
+
+--connection node_1
+DROP TABLE t1;
+
+# Warning always happens when the cluster is started for the first time
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+
+# Confirm that IST did not take place
+--let $assert_text = IST first seqno 2 not found from cache, falling back to SST
+--let $assert_select = IST first seqno 2 not found from cache, falling back to SST
+--let $assert_count = 1
+--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
+--let $assert_only_after = starting as process
+--source include/assert_grep.inc
+
+--connection node_2
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf
new file mode 100644
index 00000000000..c08551eae84
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+innodb_log_file_size=110M
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true;'
+
+[mysqld.2]
+innodb_log_file_size=110M
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes;pc.ignore_sb=true;'
diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test
new file mode 100644
index 00000000000..3bfcdc9f117
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test
@@ -0,0 +1,216 @@
+#
+# Kill entire cluster while various transactions are in progress
+# restore the cluster and expect that node #2 will rejoin using IST
+#
+
+--source include/galera_cluster.inc
+--source include/big_test.inc
+
+SET SESSION wsrep_sync_wait = 0;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+DELIMITER |;
+CREATE PROCEDURE insert_simple ()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ SET SESSION wsrep_sync_wait = 0;
+ WHILE 1 DO
+ INSERT INTO t1 (f1, f2) VALUES (DEFAULT,'abcdef');
+ END WHILE;
+END|
+
+CREATE PROCEDURE insert_multi ()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ SET SESSION wsrep_sync_wait = 0;
+ WHILE 1 DO
+ INSERT INTO t1 (f1) VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT);
+ END WHILE;
+END|
+
+CREATE PROCEDURE insert_transaction ()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ SET SESSION wsrep_sync_wait = 0;
+ SET AUTOCOMMIT = OFF;
+ WHILE 1 DO
+ START TRANSACTION;
+ INSERT INTO t1 (f1) VALUES (DEFAULT);
+ INSERT INTO t1 (f1) VALUES (DEFAULT);
+ INSERT INTO t1 (f1) VALUES (DEFAULT);
+ INSERT INTO t1 (f1) VALUES (DEFAULT);
+ INSERT INTO t1 (f1) VALUES (DEFAULT);
+
+ INSERT INTO t1 (f1) VALUES (DEFAULT);
+ INSERT INTO t1 (f1) VALUES (DEFAULT);
+ INSERT INTO t1 (f1) VALUES (DEFAULT);
+ INSERT INTO t1 (f1) VALUES (DEFAULT);
+ INSERT INTO t1 (f1) VALUES (DEFAULT);
+ COMMIT;
+ END WHILE;
+END|
+
+DELIMITER ;|
+DELIMITER |;
+
+CREATE PROCEDURE update_simple ()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ SET SESSION wsrep_sync_wait = 0;
+ WHILE 1 DO
+ UPDATE t1 SET f2 = CONCAT(f2,f2);
+ END WHILE;
+END|
+
+CREATE PROCEDURE insert_1k ()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ SET SESSION wsrep_sync_wait = 0;
+ WHILE 1 DO
+ INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024));
+ END WHILE;
+END|
+
+CREATE PROCEDURE insert_1m ()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ SET SESSION wsrep_sync_wait = 0;
+ WHILE 1 DO
+ INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024));
+ END WHILE;
+END|
+
+CREATE PROCEDURE insert_10m ()
+BEGIN
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+ SET SESSION wsrep_sync_wait = 0;
+ WHILE 1 DO
+ INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+ END WHILE;
+END|
+
+DELIMITER ;|
+
+--connect node_1_insert_simple, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_1_insert_multi, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_1_insert_transaction, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_1_update_simple, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_1_insert_1k, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_1_insert_1m, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_1_insert_10m, 127.0.0.1, root, , test, $NODE_MYPORT_1
+
+--connection node_1_insert_simple
+--send CALL insert_simple();
+
+--connection node_1_insert_multi
+--send CALL insert_multi();
+
+--connection node_1_insert_transaction
+--send CALL insert_transaction ();
+
+--connection node_1_update_simple
+--send CALL update_simple ();
+
+--connection node_1_insert_1k
+--send CALL insert_1k ();
+
+--connection node_1_insert_1m
+--send CALL insert_1m ();
+
+--connection node_1_insert_10m
+--send CALL insert_10m ();
+
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+--source include/kill_galera.inc
+
+--sleep 10
+--connection node_1
+--source include/kill_galera.inc
+
+--connection node_1_insert_simple
+--error 2013
+--reap
+
+--connection node_1_insert_multi
+--error 2013
+--reap
+
+--connection node_1_insert_transaction
+--error 2013
+--reap
+
+--connection node_1_update_simple
+--error 2013
+--reap
+
+--connection node_1_insert_1k
+--error 2013
+--reap
+
+--connection node_1_insert_1m
+--error 2013
+--reap
+
+--connection node_1_insert_10m
+--error 2013
+--reap
+
+--connection node_1
+--let $galera_wsrep_recover_server_id=1
+--source suite/galera/include/galera_wsrep_recover.inc
+
+--let $_expect_file_name = $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--source include/start_mysqld.inc
+--connection node_2
+--let $galera_wsrep_recover_server_id=2
+--source suite/galera/include/galera_wsrep_recover.inc
+
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--source include/start_mysqld.inc
+
+--connection node_1
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+
+--let $diff_servers = 1 2
+--source include/diff_servers.inc
+
+--connection node_1
+DROP TABLE t1;
+DROP TABLE ten;
+DROP PROCEDURE insert_simple;
+DROP PROCEDURE insert_multi;
+DROP PROCEDURE insert_transaction;
+DROP PROCEDURE update_simple;
+DROP PROCEDURE insert_1k;
+DROP PROCEDURE insert_1m;
+
+--connection node_1
+CALL mtr.add_suppression("conflict state 7 after post commit");
+
+# Warning happens when the cluster is started for the first time
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+
+# Confirm that IST took place
+--let $assert_text = async IST sender starting to serve
+--let $assert_select = async IST sender starting to serve
+--let $assert_count = 1
+--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
+--let $assert_only_after = starting as process
+--source include/assert_grep.inc
+
+--connection node_2
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+
+# Confirm that gcache recovery took place
+
+--let $assert_text = Recovering GCache ring buffer: found gapless sequence
+--let $assert_select = Recovering GCache ring buffer: found gapless sequence
+--let $assert_count = 1
+--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err
+--let $assert_only_after = starting as process
+--source include/assert_grep.inc
diff --git a/mysql-test/suite/galera/t/galera_many_tables_pk.test b/mysql-test/suite/galera/t/galera_many_tables_pk.test
index 520459e3210..551307b123f 100644
--- a/mysql-test/suite/galera/t/galera_many_tables_pk.test
+++ b/mysql-test/suite/galera/t/galera_many_tables_pk.test
@@ -7,18 +7,12 @@ if (!`SELECT @@open_files_limit >= 1024`){
}
#
-# This test forces 900 tables with a PK to participate in a single
-# transaction. The reason for 900 is that some linux system has by default
-# a limit of 1024 open files / process
-#
-
-#
-# First, create 900 tables and make sure the DDLs are all propagated
+# First, create 100 tables and make sure the DDLs are all propagated
#
--connection node_1
---let $count = 900
+--let $count = 100
while ($count)
{
--disable_query_log
@@ -29,7 +23,7 @@ while ($count)
}
--connection node_2
-SELECT COUNT(*) = 900 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%';
+SELECT COUNT(*) = 100 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%';
#
# Second, create a transaction that uses all those tables
@@ -39,7 +33,7 @@ SELECT COUNT(*) = 900 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test'
SET AUTOCOMMIT=OFF;
START TRANSACTION;
---let $count = 900
+--let $count = 100
while ($count)
{
--disable_query_log
@@ -58,7 +52,7 @@ COMMIT;
--connection node_2
CREATE TABLE sum_table (f1 INTEGER);
---let $count = 900
+--let $count = 100
while ($count)
{
--disable_query_log
@@ -68,7 +62,7 @@ while ($count)
--dec $count
}
-SELECT SUM(f1) = 900 FROM sum_table;
+SELECT SUM(f1) = 100 FROM sum_table;
#
# Fourth, create a deadlock
@@ -78,7 +72,7 @@ SELECT SUM(f1) = 900 FROM sum_table;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
---let $count = 900
+--let $count = 100
while ($count)
{
--disable_query_log
@@ -91,7 +85,7 @@ while ($count)
--connection node_2
SET AUTOCOMMIT=OFF;
START TRANSACTION;
-UPDATE t900 SET f1 = 3;
+UPDATE t100 SET f1 = 3;
--connection node_1
COMMIT;
@@ -100,5 +94,8 @@ COMMIT;
--error ER_LOCK_DEADLOCK
COMMIT;
+--let $diff_servers = 1 2
+--source include/diff_servers.inc
+
DROP SCHEMA test;
CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test b/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test
new file mode 100644
index 00000000000..2f27678b547
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_restart_on_unknown_option.test
@@ -0,0 +1,150 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+# Suppress expected warnings:
+
+CALL mtr.add_suppression("Aborting");
+CALL mtr.add_suppression("unknown option '--galera-unknown-option'");
+
+#
+# We should count the number of "Assertion failed" warnings
+# in the log file before and after testing. To do this we need
+# to save original log file before testing:
+#
+--let TEST_LOG=$MYSQLTEST_VARDIR/log/mysqld.2.err
+--perl
+ use strict;
+ my $test_log=$ENV{'TEST_LOG'} or die "TEST_LOG not set";
+ my $test_log_copy=$test_log . '.copy';
+ if (-e $test_log_copy) {
+ unlink $test_log_copy;
+ }
+EOF
+--copy_file $TEST_LOG $TEST_LOG.copy
+
+--connection node_2
+
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a');
+
+SELECT * FROM t1;
+
+# Initiate normal shutdown on the node 2 and
+# waiting until shutdown has been completed:
+
+--echo Shutting down server ...
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# Some updates on node 1:
+
+UPDATE t1 SET f2 = 'b' WHERE f1 > 1;
+UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
+
+SELECT * FROM t1;
+
+# Remove the "grastate.dat" file (to initiate new SST)
+# and restart node 2 with unknown option:
+
+--connection node_2
+
+--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+--let $start_mysqld_params=--galera-unknown-option
+
+--echo Starting server ...
+--exec echo "try:$start_mysqld_params" > $_expect_file_name
+
+# Sleep to ensure that server exited...
+
+--sleep 30
+
+# Restart node 2 without unknown option:
+
+--let $start_mysqld_params=
+
+--echo Starting server ...
+--source include/start_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# Sanity check (node 2 is running now and can perform SQL operators):
+
+SELECT * FROM t1;
+
+# Initiate normal shutdown on the node 2 and
+# waiting until shutdown has been completed:
+
+--echo Shutting down server ...
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# Some updates on node 1 - to initiate IST next time:
+
+UPDATE t1 SET f2 = 'd' WHERE f1 > 1;
+UPDATE t1 SET f2 = 'd' WHERE f1 > 2;
+
+SELECT * FROM t1;
+
+# Restart node 2 with unknown option:
+
+--connection node_2
+
+--let $start_mysqld_params=--galera-unknown-option
+
+--echo Starting server ...
+--exec echo "try:$start_mysqld_params" > $_expect_file_name
+
+# Sleep to ensure that server exited...
+
+--sleep 30
+
+# Restart node 2 without unknown option:
+
+--let $start_mysqld_params=
+
+--echo Starting server ...
+--source include/start_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
+# Sanity check (node 2 is running now and can perform SQL operators):
+
+SELECT * FROM t1;
+
+--connection node_1
+
+DROP TABLE t1;
+
+#
+# We should count the number of "Assertion failed" warnings
+# in the log file during test phase - to print the error message
+# if quantity of such warnings in log file increased at the end
+# of the test:
+#
+--perl
+ use strict;
+ my $test_log=$ENV{'TEST_LOG'} or die "TEST_LOG not set";
+ my $test_log_copy=$test_log . '.copy';
+ open(FILE, $test_log_copy) or die("Unable to open $test_log_copy: $!\n");
+ my $initial=grep(/Assertion * failed/gi,<FILE>);
+ close(FILE);
+ open(FILE, $test_log) or die("Unable to open $test_log: $!\n");
+ my $count_warnings=grep(/Assertion * failed/gi,<FILE>);
+ close(FILE);
+ if ($count_warnings != $initial) {
+ my $diff=$count_warnings-$initial;
+ print "Assertion failed $diff times.\n";
+ }
+EOF
+--remove_file $TEST_LOG.copy
diff --git a/mysql-test/suite/galera/t/galera_roles.test b/mysql-test/suite/galera/t/galera_roles.test
index 79951ad10c8..3005562db9c 100644
--- a/mysql-test/suite/galera/t/galera_roles.test
+++ b/mysql-test/suite/galera/t/galera_roles.test
@@ -102,6 +102,7 @@ REVOKE EXECUTE ON PROCEDURE test1.pr1 FROM role1;
--echo # Connect with foo_node_1
--connection foo_node_1
+--sleep 1
--error ER_PROCACCESS_DENIED_ERROR
CALL test1.pr1();
diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_fk_update.test b/mysql-test/suite/galera/t/galera_toi_ddl_fk_update.test
new file mode 100644
index 00000000000..f42fae4ed51
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_ddl_fk_update.test
@@ -0,0 +1,49 @@
+--source include/big_test.inc
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# This test creates a new FK constraint while an UPDATE is running
+#
+
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE parent (
+ id INT PRIMARY KEY,
+ KEY (id)
+) ENGINE=InnoDB;
+
+CREATE TABLE child (
+ id INT PRIMARY KEY AUTO_INCREMENT,
+ parent_id INT
+) ENGINE=InnoDB;
+
+INSERT INTO parent VALUES (1);
+
+INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+
+--connection node_1
+--sleep 1
+--send ALTER TABLE child ADD FOREIGN KEY (parent_id) REFERENCES parent(id) ON UPDATE CASCADE;
+
+--connection node_2
+--sleep 1
+--send UPDATE parent SET id = 2 WHERE id = 1;
+
+--connection node_1
+--reap
+
+--connection node_2
+--reap
+
+--connection node_2
+SELECT COUNT(*) = 10000 FROM child WHERE parent_id = 2;
+
+--connection node_1
+SELECT COUNT(*) = 10000 FROM child WHERE parent_id = 2;
+
+DROP TABLE child;
+DROP TABLE parent;
+
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_toi_drop_database.test b/mysql-test/suite/galera/t/galera_toi_drop_database.test
new file mode 100644
index 00000000000..e790a0ba812
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_drop_database.test
@@ -0,0 +1,56 @@
+#
+# Test the operation of DDLs that affect multiple database objects
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $galera_connection_name = node_1a
+--let $galera_server_number = 1
+--source include/galera_connect.inc
+
+--connection node_1
+CREATE DATABASE database1;
+USE database1;
+
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+
+# Make sure autocommit retrying does not kick in as this will mask the error we expect to get
+SET SESSION wsrep_retry_autocommit = 0;
+# Attemp to insert 1M rows
+--send INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;
+
+--connection node_1a
+USE database1;
+SET SESSION wsrep_retry_autocommit = 0;
+--send INSERT INTO t2 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;
+
+--connection node_2
+--sleep 1
+--send DROP DATABASE database1;
+
+--connection node_1
+--sleep 1
+--error ER_LOCK_DEADLOCK
+--reap
+
+--connection node_1a
+--error ER_LOCK_DEADLOCK
+--reap
+
+--connection node_2
+--reap
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database1';
+--error ER_BAD_DB_ERROR
+USE database1;
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database1';
+--error ER_BAD_DB_ERROR
+USE database1;
diff --git a/mysql-test/suite/galera/t/galera_toi_truncate.test b/mysql-test/suite/galera/t/galera_toi_truncate.test
new file mode 100644
index 00000000000..59ef5c2028f
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_toi_truncate.test
@@ -0,0 +1,43 @@
+#
+# Test the operation of TRUNCATE with concurrent DML.
+# The DML should be BF-aborted if the DDL arrives from another node
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+#
+# INSERT and TRUNCATE on different nodes
+#
+
+--connection node_1
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+# Insert 100K rows
+--connection node_2
+# Prevent autocommit retring from masking the deadlock error we expect to get
+SET SESSION wsrep_retry_autocommit = 0;
+--send INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;
+
+--connection node_1
+--sleep 1
+--send TRUNCATE TABLE t1;
+
+--connection node_1
+--reap
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+--reap
+
+--connection node_2
+SELECT COUNT(*) = 0 FROM t1;
+
+--connection node_1
+SELECT COUNT(*) = 0 FROM t1;
+
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/t/galera_var_cluster_address.test b/mysql-test/suite/galera/t/galera_var_cluster_address.test
index 740c38765f6..0f857eb1aac 100644
--- a/mysql-test/suite/galera/t/galera_var_cluster_address.test
+++ b/mysql-test/suite/galera/t/galera_var_cluster_address.test
@@ -69,9 +69,11 @@ CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed t
CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)");
CALL mtr.add_suppression("gcs connect failed: Connection timed out");
CALL mtr.add_suppression("WSREP: wsrep::connect\\(foo://\\) failed: 7");
+CALL mtr.add_suppression("WSREP: wsrep::connect\\(gcomm://192.0.2.1\\) failed: 7");
# Restore original auto_increment_offset values.
--source include/auto_increment_offset_restore.inc
--source include/galera_end.inc
--echo # End of test
+
diff --git a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
new file mode 100644
index 00000000000..bf4da3234c5
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
@@ -0,0 +1,98 @@
+#
+# Test that the wsrep_retry_autocommit variable is respected. We use an INSERT that
+# proceeds very slowly due to extra SLEEP() in a trigger
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f2 = SLEEP(5);
+
+#
+# With wsrep_retry_autocommit = 0, error is certain
+#
+
+--connection node_1
+SET SESSION wsrep_retry_autocommit = 0;
+--send INSERT INTO t1 (f1) VALUES (1),(2);
+
+--connection node_2
+--sleep 1
+TRUNCATE TABLE t1;
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+--reap
+
+#
+# With wsrep_retry_autocommit = 1, success against one TRUNCATE
+#
+
+--connection node_1
+SET SESSION wsrep_retry_autocommit = 1;
+--send INSERT INTO t1 (f1) VALUES (3),(4);
+
+--connection node_2
+--sleep 1
+TRUNCATE TABLE t1;
+
+--connection node_1
+--error 0
+--reap
+SELECT * FROM test.t1;
+
+#
+# With wsrep_retry_autocommit = 1, failure against multiple TRUNCATEs
+#
+
+--connection node_2
+DELIMITER |;
+CREATE PROCEDURE repeated_truncate ()
+BEGIN
+ DECLARE i INT;
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+
+ SET i = 0;
+ WHILE i <= 1000 DO
+ TRUNCATE TABLE t1;
+ SET i = i + 1;
+ END WHILE;
+END|
+DELIMITER ;|
+
+# Begin streaming TRUNCATEs
+--let $truncate_connection_id = `SELECT CONNECTION_ID()`
+--send CALL repeated_truncate()
+
+--connection node_1
+SET SESSION wsrep_retry_autocommit = 1;
+--sleep 1
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 (f1) VALUES (5),(6);
+
+#
+# With wsrep_retry_autocommit = 1024, success against multiple TRUNCATEs
+#
+
+--connection node_1
+SET SESSION wsrep_retry_autocommit = 1024;
+--send INSERT INTO t1 (f1) VALUES (7),(8);
+
+--sleep 6
+
+# Once he stream of TRUNCATEs is complete
+--connection node_2
+--reap
+
+# the INSERT will eventually be sucessfull
+--connection node_1
+--error 0
+--reap
+
+--let $diff_servers = 1 2
+--source include/diff_servers.inc
+
+DROP TABLE t1;
+DROP PROCEDURE repeated_truncate;
diff --git a/mysql-test/suite/galera/t/galera_var_slave_threads.test b/mysql-test/suite/galera/t/galera_var_slave_threads.test
index 812ba99027f..1c4dd8eba3a 100644
--- a/mysql-test/suite/galera/t/galera_var_slave_threads.test
+++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test
@@ -6,7 +6,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
-
+CALL mtr.add_suppression("WSREP: Refusing exit for the last slave thread.");
--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
--connection node_1
diff --git a/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt b/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt
new file mode 100644
index 00000000000..930c483bd64
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt
@@ -0,0 +1 @@
+--wsrep_log_conflicts=ON
diff --git a/mysql-test/suite/galera/t/galera_wsrep_log_conficts.test b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.test
new file mode 100644
index 00000000000..3af08cbf637
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.test
@@ -0,0 +1,55 @@
+#
+# Test --wsrep_log_conflicts=ON
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (
+ f1 VARCHAR(255) PRIMARY KEY
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES ('abc');
+
+--connection node_2
+SELECT f1 = 'abc' FROM t1;
+
+#
+# Provoke a conflict
+#
+
+--connection node_1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'klm';
+
+--connection node_2
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'xyz';
+
+--connection node_1
+COMMIT;
+
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--connection node_2a
+--let $wait_condition = SELECT f1 = 'klm' FROM t1;
+--source include/wait_condition.inc
+
+--connection node_2
+--error ER_LOCK_DEADLOCK
+COMMIT;
+
+#
+# We can not really check the log output very much because it is quite variable
+#
+
+--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err
+--let $assert_only_after = CURRENT_TEST
+
+--let $assert_text = cluster conflict due to high priority abort for threads
+--let $assert_select = cluster conflict due to high priority abort for threads
+--let $assert_match = cluster conflict due to high priority abort for threads
+--source include/assert_grep.inc
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test b/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test
new file mode 100644
index 00000000000..fe1abcf6c35
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test
@@ -0,0 +1,20 @@
+#
+# PXC-318: Typo in wsrep_provider_options causes an unhandled exception
+#
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+--let LOGF=$MYSQLTEST_VARDIR/log/mysqld.1.err
+--disable_info
+call mtr.add_suppression("WSREP\: Unknown parameter 'gmcasts\.segment'");
+call mtr.add_suppression("WSREP\: Set options returned 7");
+--error ER_WRONG_ARGUMENTS
+SET GLOBAL wsrep_provider_options="gmcasts.segment=1";
+# Search for unhandled exception message.
+perl;
+ use strict;
+ my $logf= $ENV{'LOGF'} or die "LOGF not set";
+ open(FILE, "$logf") or die("Unable to open $logf: $!\n");
+ my $count_warnings=grep(/terminate called after throwing an instance of /gi,<FILE>);
+ print "Unhandled exceptions: $count_warnings\n";
+ close(FILE);
+EOF
diff --git a/mysql-test/suite/galera/t/lp1376747-2.test b/mysql-test/suite/galera/t/lp1376747-2.test
new file mode 100644
index 00000000000..360681d7674
--- /dev/null
+++ b/mysql-test/suite/galera/t/lp1376747-2.test
@@ -0,0 +1,22 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+FLUSH TABLES t1 FOR EXPORT;
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2,3);
+
+--connection node_2
+UNLOCK TABLES;
+
+--echo ### t1 should have column f2
+SHOW CREATE TABLE t1;
+SELECT * from t1;
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/lp1376747-3.test b/mysql-test/suite/galera/t/lp1376747-3.test
new file mode 100644
index 00000000000..75fe7d276cd
--- /dev/null
+++ b/mysql-test/suite/galera/t/lp1376747-3.test
@@ -0,0 +1,28 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+FLUSH TABLE WITH READ LOCK;
+--echo ### This shouldn't block.
+FLUSH TABLES t1 FOR EXPORT;
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+
+--connection node_2
+UNLOCK TABLES;
+
+--echo ### t1 should have column f2
+SHOW CREATE TABLE t1;
+
+--connection node_1
+INSERT INTO t1 VALUES (2,3);
+
+--connection node_2
+SELECT * from t1;
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/lp1376747-4.test b/mysql-test/suite/galera/t/lp1376747-4.test
new file mode 100644
index 00000000000..be56ee5edc1
--- /dev/null
+++ b/mysql-test/suite/galera/t/lp1376747-4.test
@@ -0,0 +1,53 @@
+#
+# Test Flush tables with read lock along with
+# flush tables <table> with read lock for compatibility.
+# Also, making sure all DDL and DMLs are propagated
+# after provider is unpaused
+#
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--let $galera_connection_name = node_2a
+--let $galera_server_number = 2
+--source include/galera_connect.inc
+
+--connection node_1
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+SET session wsrep_sync_wait=0;
+SET session wsrep_causal_reads=OFF;
+FLUSH TABLE WITH READ LOCK;
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2,3);
+
+--connection node_2a
+SET session wsrep_sync_wait=0;
+SET session wsrep_causal_reads=OFF;
+SHOW CREATE TABLE t1;
+--sleep 1
+--send FLUSH TABLES t1 WITH READ LOCK;
+
+--connection node_2
+# let the flush table wait in pause state before we unlock
+# table otherwise there is window where-in flush table is
+# yet to wait in pause and unlock allows alter table to proceed.
+# this is because send in asynchronous.
+--sleep 3
+# this will release existing lock but will not resume
+# the cluster as there is new FTRL that is still pausing it.
+UNLOCK TABLES;
+SHOW CREATE TABLE t1;
+
+--connection node_2a
+--reap
+UNLOCK TABLES;
+--sleep 1
+SHOW CREATE TABLE t1;
+SELECT * from t1;
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/lp1376747.test b/mysql-test/suite/galera/t/lp1376747.test
new file mode 100644
index 00000000000..769bb665c77
--- /dev/null
+++ b/mysql-test/suite/galera/t/lp1376747.test
@@ -0,0 +1,24 @@
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+
+--connection node_2
+FLUSH TABLES t1 WITH READ LOCK;
+
+--connection node_1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2,3);
+
+--sleep 2
+
+--connection node_2
+UNLOCK TABLES;
+
+--echo ### t1 should have column f2
+SHOW CREATE TABLE t1;
+SELECT * from t1;
+
+--connection node_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/pxc-421.test b/mysql-test/suite/galera/t/pxc-421.test
new file mode 100644
index 00000000000..8a360b12f4c
--- /dev/null
+++ b/mysql-test/suite/galera/t/pxc-421.test
@@ -0,0 +1,60 @@
+#
+# PXC-421: Test deadlock involving updates of
+# wsrep_provider, wsrep_cluster_address and wsrep_slave_threads.
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+--connection node_1
+--let $wsrep_slave_1 = `SELECT @@wsrep_slave_threads`
+set GLOBAL wsrep_slave_threads=26;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 (f1) SELECT * from t1 as x1;
+
+--connection node_2
+--let $wsrep_slave_2 = `SELECT @@wsrep_slave_threads`
+set GLOBAL wsrep_slave_threads=16;
+--let $wsrep_provider_orig = `SELECT @@wsrep_provider`
+--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
+
+SET GLOBAL wsrep_provider='none';
+INSERT INTO t1 VALUES (2);
+
+--connection node_1
+INSERT INTO t1 VALUES (3);
+
+--connection node_2
+--disable_query_log
+--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
+--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
+--enable_query_log
+
+--source include/wait_until_connected_again.inc
+--source include/galera_wait_ready.inc
+
+INSERT INTO t1 VALUES (4);
+set GLOBAL wsrep_slave_threads=5;
+
+# Node #2 has all the inserts
+SELECT COUNT(*) = 5 FROM t1;
+
+--connection node_1
+set GLOBAL wsrep_slave_threads=12;
+# Node #1 is missing the insert made while Node #2 was not replicated
+SELECT COUNT(*) = 4 FROM t1;
+INSERT INTO t1 VALUES (100), (101), (102);
+
+--connection node_2
+set GLOBAL wsrep_slave_threads=5;
+INSERT INTO t1 (f1) SELECT * from t1 as x1;
+show global variables like 'wsrep_slave_threads';
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_2
+SELECT COUNT(*) FROM t1;
+
+--connection node_1
+SELECT COUNT(*) FROM t1;
+show global variables like 'wsrep_slave_threads';
+--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
index eaa2899968c..1ed273fdcb5 100644
--- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
@@ -27,7 +27,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
-wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;evs.suspect_timeout=PT10S'
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
+
+wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
@@ -36,7 +38,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
-wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M;evs.suspect_timeout=PT10S'
+wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
+
+wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
diff --git a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result
new file mode 100644
index 00000000000..21f747d280b
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result
@@ -0,0 +1,26 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 1']
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
+SET SESSION wsrep_on = OFF;
+Killing server ...
+safe_to_bootstrap: 1
+safe_to_bootstrap: 0
+safe_to_bootstrap: 0
+CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
+CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test
new file mode 100644
index 00000000000..7c9991e68c4
--- /dev/null
+++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test
@@ -0,0 +1,163 @@
+#
+# Test the safe_to_bootstrap in grastate.dat
+#
+
+--source include/galera_cluster.inc
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+
+#
+# At start, all grastate.dat files have safe_to_boostrap: 0
+#
+
+--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 0'
+--let $assert_select= safe_to_bootstrap: 0
+--let $assert_count= 1
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
+--source include/assert_grep.inc
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+--source include/assert_grep.inc
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
+--source include/assert_grep.inc
+
+#
+# Shut down one node
+#
+
+--connection node_2
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# Still, all grastate.dat files should have safe_to_boostrap: 0
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
+--source include/assert_grep.inc
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+--source include/assert_grep.inc
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
+--source include/assert_grep.inc
+
+#
+# Shut down one more node
+#
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connection node_3
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# Now, nodes 2,3 should have safe_to_boostrap: 0
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+--source include/assert_grep.inc
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
+--source include/assert_grep.inc
+
+# But node #1 should have safe_to_boostrap: 1
+
+--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 1'
+--let $assert_select= safe_to_bootstrap: 1
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
+--source include/assert_grep.inc
+
+# Restart one node
+
+--connection node_2
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--source include/start_mysqld.inc
+
+--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+# All nodes should be back to 'safe_to_bootstrap: 0'
+
+--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 0'
+--let $assert_select= safe_to_bootstrap: 0
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
+--source include/assert_grep.inc
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+--source include/assert_grep.inc
+
+--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
+--source include/assert_grep.inc
+
+#
+# Kill the cluster
+#
+
+--connection node_2
+--source include/shutdown_mysqld.inc
+
+--connection node_1
+SET SESSION wsrep_on = OFF;
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--source include/kill_galera.inc
+
+#
+# Only node #1 should have safe_to_bootstrap: 1
+# include/assert_grep.inc requires a running server, so we revert to simple grep
+#
+
+--error 0
+--exec grep 'safe_to_bootstrap: 1' $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
+
+--error 0
+--exec grep 'safe_to_bootstrap: 0' $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
+
+--error 0
+--exec grep 'safe_to_bootstrap: 0' $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
+
+#
+# Attempt to bootstrap nodes #2, #3, should fail
+#
+
+--error 1
+--exec $MYSQLD --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-new-cluster | grep 'This node is not safe to bootstrap the cluster'
+--error 1
+--exec $MYSQLD --defaults-group-suffix=.3 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-new-cluster | grep 'This node is not safe to bootstrap the cluster'
+
+#
+# Attempt to bootstrap starting from node #1, should succeed
+#
+
+--connection node_1
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--source include/start_mysqld.inc
+--source include/wait_until_connected_again.inc
+
+--connection node_2
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--source include/start_mysqld.inc
+
+--connection node_3
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
+--source include/start_mysqld.inc
+
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
+
+--connection node_2
+CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
+
+--connection node_3
+CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
index f132c2f2f63..ac70701e2cc 100644
--- a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
+++ b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
@@ -198,7 +198,7 @@ drop table t1;
create table t1 (a int, b int generated always as(-b) virtual, c int generated always as (b + 1) virtual);
--error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual);
---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
+--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int);
--echo # Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE
diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result
index c4a54999614..e93d3bf025a 100644
--- a/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_column_def_options_innodb.result
@@ -259,7 +259,7 @@ ERROR 01000: Expression for field `b` is refering to uninitialized field `b`
create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual);
ERROR 01000: Expression for field `b` is refering to uninitialized field `c`
create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int);
-ERROR 01000: Expression for field `col_int_nokey` is refering to uninitialized field `pk`
+ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk`
# Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE
create table t1 (a int, b int generated always as(-a) virtual, c int generated always as (b + 1) stored);
insert into t1(a) values(1),(2);
diff --git a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result
index 0f66b3ad779..563883adce0 100644
--- a/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result
+++ b/mysql-test/suite/gcol/r/gcol_column_def_options_myisam.result
@@ -259,7 +259,7 @@ ERROR 01000: Expression for field `b` is refering to uninitialized field `b`
create table t1 (a int, b int generated always as(-c) virtual, c int generated always as (b + 1) virtual);
ERROR 01000: Expression for field `b` is refering to uninitialized field `c`
create table t1 (pk int auto_increment primary key, col_int_nokey int generated always as (pk + col_int_key) stored, col_int_key int);
-ERROR 01000: Expression for field `col_int_nokey` is refering to uninitialized field `pk`
+ERROR HY000: Function or expression 'AUTO_INCREMENT' cannot be used in the GENERATED ALWAYS AS clause of `pk`
# Bug#20339347: FAIL TO USE CREATE ....SELECT STATEMENT TO CREATE A NEW TABLE
create table t1 (a int, b int generated always as(-a) virtual, c int generated always as (b + 1) stored);
insert into t1(a) values(1),(2);
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_debug.result b/mysql-test/suite/gcol/r/innodb_virtual_debug.result
index a80ec95a2ca..af220c7cd17 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_debug.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_debug.result
@@ -223,5 +223,35 @@ vbcol
11
ac
drop table ibstd_14;
+#
+# Bug#22018745 CORRUPTION IN ONLINE TABLE REBUILD
+# (ROW_FORMAT=REDUNDANT, INDEXED VIRTUAL COLUMN)
+#
+CREATE TABLE t (
+b char(5) PRIMARY KEY,
+v char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, KEY(v)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT;
+connection con1;
+SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL prepared WAIT_FOR apply';
+OPTIMIZE TABLE t;
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR prepared';
+INSERT INTO t SET b='fubar';
+BEGIN;
+DELETE FROM t;
+ROLLBACK;
+SET DEBUG_SYNC='now SIGNAL apply';
+connection con1;
+Table Op Msg_type Msg_text
+test.t optimize note Table does not support optimize, doing recreate + analyze instead
+test.t optimize status OK
+connection default;
+CHECK TABLE t;
+Table Op Msg_type Msg_text
+test.t check status OK
+SELECT * FROM t;
+b v
+fubar fub
+DROP TABLE t;
disconnect con1;
SET DEBUG_SYNC = 'RESET';
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk.result b/mysql-test/suite/gcol/r/innodb_virtual_fk.result
index 17ea0341049..1584c433009 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_fk.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_fk.result
@@ -590,3 +590,101 @@ SELECT * FROM t2;
fld1 fld2
1 1
DROP TABLE t2, t1;
+CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY)ENGINE=INNODB;
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT AS (f1) VIRTUAL,
+KEY (f1, f2), FOREIGN KEY(f1) REFERENCES t1(f1))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+EXPLAIN SELECT f1, f2 FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL f1 9 NULL 1 Using index
+SELECT f1, f2 FROM t2;
+f1 f2
+1 1
+INSERT INTO t2(f1) VALUES(2);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`))
+DROP TABLE t2, t1;
+CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY)ENGINE=INNODB;
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT AS (f1) VIRTUAL,
+KEY (f1, f2), FOREIGN KEY(f1) REFERENCES t1(f1)
+ON UPDATE CASCADE)ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+EXPLAIN SELECT f1, f2 FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL f1 9 NULL 1 Using index
+SELECT f1, f2 FROM t2;
+f1 f2
+1 1
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+EXPLAIN SELECT f1, f2 FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL f1 9 NULL 1 Using index
+SELECT f1, f2 FROM t2;
+f1 f2
+2 2
+DROP TABLE t2, t1;
+CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY)ENGINE=INNODB;
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT AS (f1) VIRTUAL,
+KEY (f1, f2))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+SET FOREIGN_KEY_CHECKS = 0;
+ALTER TABLE t2 ADD FOREIGN KEY (f1) REFERENCES t1(f1)
+ON UPDATE CASCADE, ALGORITHM=INPLACE;
+SET FOREIGN_KEY_CHECKS = 1;
+UPDATE t1 SET f1 = 3;
+EXPLAIN SELECT f1, f2 FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL f1 9 NULL 1 Using index
+SELECT f1, f2 FROM t2;
+f1 f2
+3 3
+DROP TABLE t2, t1;
+CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY)ENGINE=INNODB;
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT AS (f1) VIRTUAL,
+KEY (f1, f2))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+ALTER TABLE t2 ADD FOREIGN KEY (f1) REFERENCES t1(f1)
+ON UPDATE CASCADE, ALGORITHM=COPY;
+UPDATE t1 SET f1 = 3;
+EXPLAIN SELECT f1, f2 FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL f1 9 NULL 1 Using index
+SELECT f1, f2 FROM t2;
+f1 f2
+3 3
+DROP TABLE t2, t1;
+CREATE TABLE t1(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=INNODB;
+CREATE TABLE t2(f1 INT NOT NULL, f2 INT AS (1) VIRTUAL,
+f3 INT AS (2) VIRTUAL,
+FOREIGN KEY idx (f1) REFERENCES t1(f1) ON UPDATE CASCADE,
+KEY idx1 (f2, f1, f3))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+ALTER TABLE t2 DROP COLUMN f2, ALGORITHM=INPLACE;
+UPDATE t1 SET f1 = 3;
+EXPLAIN SELECT f1, f3 FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL idx1 9 NULL 1 Using index
+SELECT f1, f3 FROM t2;
+f1 f3
+3 2
+DROP TABLE t2, t1;
+CREATE TABLE t1(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=INNODB;
+CREATE TABLE t2(f1 INT NOT NULL, f2 INT AS (1) VIRTUAL,
+f3 INT AS (2) VIRTUAL,
+FOREIGN KEY idx (f1) REFERENCES t1(f1) ON UPDATE CASCADE,
+KEY idx1 (f2, f1, f3))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+ALTER TABLE t2 DROP COLUMN f2, ALGORITHM=COPY;
+UPDATE t1 SET f1 = 3;
+EXPLAIN SELECT f1, f3 FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL idx1 9 NULL 1 Using index
+SELECT f1, f3 FROM t2;
+f1 f3
+3 2
+DROP TABLE t2, t1;
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug.test b/mysql-test/suite/gcol/t/innodb_virtual_debug.test
index 72be27775ed..7ccf0fb8fc7 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_debug.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_debug.test
@@ -233,6 +233,36 @@ select vbcol from ibstd_14;
drop table ibstd_14;
+--echo #
+--echo # Bug#22018745 CORRUPTION IN ONLINE TABLE REBUILD
+--echo # (ROW_FORMAT=REDUNDANT, INDEXED VIRTUAL COLUMN)
+--echo #
+
+CREATE TABLE t (
+ b char(5) PRIMARY KEY,
+ v char(3) GENERATED ALWAYS AS (substr(b,1,3)) VIRTUAL, KEY(v)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT;
+
+connection con1;
+SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL prepared WAIT_FOR apply';
+--send OPTIMIZE TABLE t
+connection default;
+
+SET DEBUG_SYNC='now WAIT_FOR prepared';
+INSERT INTO t SET b='fubar';
+BEGIN;
+DELETE FROM t;
+ROLLBACK;
+SET DEBUG_SYNC='now SIGNAL apply';
+
+connection con1;
+reap;
+
+connection default;
+CHECK TABLE t;
+SELECT * FROM t;
+DROP TABLE t;
+
disconnect con1;
SET DEBUG_SYNC = 'RESET';
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_fk.test b/mysql-test/suite/gcol/t/innodb_virtual_fk.test
index 78b2159e020..6b02b0adbbe 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_fk.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_fk.test
@@ -490,3 +490,89 @@ UPDATE t1 SET fld1= 2;
SELECT fld2 FROM t2;
SELECT * FROM t2;
DROP TABLE t2, t1;
+
+# Foreign key constraint references to virtual index
+CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY)ENGINE=INNODB;
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT AS (f1) VIRTUAL,
+ KEY (f1, f2), FOREIGN KEY(f1) REFERENCES t1(f1))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+EXPLAIN SELECT f1, f2 FROM t2;
+SELECT f1, f2 FROM t2;
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO t2(f1) VALUES(2);
+DROP TABLE t2, t1;
+
+# Update foreign key constraint references to virtual index
+CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY)ENGINE=INNODB;
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT AS (f1) VIRTUAL,
+ KEY (f1, f2), FOREIGN KEY(f1) REFERENCES t1(f1)
+ ON UPDATE CASCADE)ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+EXPLAIN SELECT f1, f2 FROM t2;
+SELECT f1, f2 FROM t2;
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+EXPLAIN SELECT f1, f2 FROM t2;
+SELECT f1, f2 FROM t2;
+DROP TABLE t2, t1;
+
+# Add foreign key constraint via inplace alter references to virtual index
+
+CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY)ENGINE=INNODB;
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT AS (f1) VIRTUAL,
+ KEY (f1, f2))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+SET FOREIGN_KEY_CHECKS = 0;
+ALTER TABLE t2 ADD FOREIGN KEY (f1) REFERENCES t1(f1)
+ ON UPDATE CASCADE, ALGORITHM=INPLACE;
+SET FOREIGN_KEY_CHECKS = 1;
+UPDATE t1 SET f1 = 3;
+EXPLAIN SELECT f1, f2 FROM t2;
+SELECT f1, f2 FROM t2;
+DROP TABLE t2, t1;
+
+# Add foreign key constraint via copy alter references to virtual index
+
+CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY)ENGINE=INNODB;
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT AS (f1) VIRTUAL,
+ KEY (f1, f2))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+ALTER TABLE t2 ADD FOREIGN KEY (f1) REFERENCES t1(f1)
+ ON UPDATE CASCADE, ALGORITHM=COPY;
+UPDATE t1 SET f1 = 3;
+EXPLAIN SELECT f1, f2 FROM t2;
+SELECT f1, f2 FROM t2;
+DROP TABLE t2, t1;
+
+# Drop column via inplace alter which triggers to remove the FK index idx
+
+CREATE TABLE t1(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=INNODB;
+CREATE TABLE t2(f1 INT NOT NULL, f2 INT AS (1) VIRTUAL,
+ f3 INT AS (2) VIRTUAL,
+ FOREIGN KEY idx (f1) REFERENCES t1(f1) ON UPDATE CASCADE,
+ KEY idx1 (f2, f1, f3))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+ALTER TABLE t2 DROP COLUMN f2, ALGORITHM=INPLACE;
+UPDATE t1 SET f1 = 3;
+EXPLAIN SELECT f1, f3 FROM t2;
+SELECT f1, f3 FROM t2;
+DROP TABLE t2, t1;
+
+# Drop column via copy alter which triggers to remove the FK index idx
+
+CREATE TABLE t1(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=INNODB;
+CREATE TABLE t2(f1 INT NOT NULL, f2 INT AS (1) VIRTUAL,
+ f3 INT AS (2) VIRTUAL,
+ FOREIGN KEY idx (f1) REFERENCES t1(f1) ON UPDATE CASCADE,
+ KEY idx1 (f2, f1, f3))ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(f1) VALUES(1);
+ALTER TABLE t2 DROP COLUMN f2, ALGORITHM=COPY;
+UPDATE t1 SET f1 = 3;
+EXPLAIN SELECT f1, f3 FROM t2;
+SELECT f1, f3 FROM t2;
+DROP TABLE t2, t1;
diff --git a/mysql-test/suite/innodb/include/innodb_isolation_selects.inc b/mysql-test/suite/innodb/include/innodb_isolation_selects.inc
new file mode 100644
index 00000000000..922f5c1c42c
--- /dev/null
+++ b/mysql-test/suite/innodb/include/innodb_isolation_selects.inc
@@ -0,0 +1,15 @@
+# These same selects are used many times in innodb_isolation.test
+
+--echo ########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(c1) FROM t1;
+SELECT COUNT(c2) FROM t1; # Uses secondary index k2
+SELECT COUNT(c3) FROM t1; # Uses clustered index
+SELECT SUM(c1) FROM t1; # Uses secondary index
+SELECT SUM(c2) FROM t1; # Uses secondary index
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; # Uses clustered index
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+--echo ###############################################
diff --git a/mysql-test/suite/innodb/r/autoinc_debug.result b/mysql-test/suite/innodb/r/autoinc_debug.result
new file mode 100644
index 00000000000..eb9dfc2a028
--- /dev/null
+++ b/mysql-test/suite/innodb/r/autoinc_debug.result
@@ -0,0 +1,100 @@
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY)ENGINE=INNODB;
+# SETTING auto_increment_increment IN CONNECTION DEFAULT
+SET AUTO_INCREMENT_INCREMENT = 1;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+id
+1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
+# SETTING auto_increment_increment IN CONNECTION1
+SET AUTO_INCREMENT_INCREMENT = 2;
+SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL opened WAIT_FOR flushed1';
+INSERT INTO t1 VALUES(NULL);
+connect con1, localhost, root,,;
+SET AUTO_INCREMENT_INCREMENT = 2;
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+SET DEBUG_SYNC= 'ib_after_row_insert_step SIGNAL flushed1 WAIT_FOR opened1';
+insert into t1 values(NULL);
+connection default;
+SELECT * FROM t1;
+id
+1
+3
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
+SET DEBUG_SYNC= 'now SIGNAL opened1';
+connection con1;
+SELECT * FROM t1;
+id
+1
+3
+5
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
+connection default;
+disconnect con1;
+DROP TABLE t1;
+CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY)ENGINE=INNODB;
+# SETTING auto_increment_increment IN CONNECTION DEFAULT
+SET AUTO_INCREMENT_INCREMENT = 1;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+id
+1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
+SET DEBUG_SYNC = 'now SIGNAL flushed';
+connect con1, localhost, root,,;
+# SETTING auto_increment_increment in connection1
+SET AUTO_INCREMENT_INCREMENT = 2;
+SET DEBUG_SYNC= 'now WAIT_FOR flushed';
+SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL opened WAIT_FOR flushed1';
+INSERT INTO t1 values(NULL);
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+SET DEBUG_SYNC= 'ib_after_row_insert_step SIGNAL flushed1 WAIT_FOR opened1';
+INSERT INTO t1 VALUES(NULL);
+connection con1;
+SELECT * FROM t1;
+id
+1
+3
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
+SET DEBUG_SYNC= 'now SIGNAL opened1';
+disconnect con1;
+connection default;
+SELECT * FROM t1;
+id
+1
+3
+5
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+SET DEBUG_SYNC='RESET';
diff --git a/mysql-test/suite/innodb/r/autoinc_persist.result b/mysql-test/suite/innodb/r/autoinc_persist.result
index e61262076ed..083db5f7c3d 100644
--- a/mysql-test/suite/innodb/r/autoinc_persist.result
+++ b/mysql-test/suite/innodb/r/autoinc_persist.result
@@ -953,8 +953,24 @@ INSERT INTO t32 VALUES(0), (0);
SELECT MAX(a) AS `Expect 6` FROM t32;
Expect 6
6
+FLUSH TABLES t33 FOR EXPORT;
+backup: t33
+UNLOCK TABLES;
+DROP TABLE t33;
+CREATE TABLE t33 (
+a BIGINT NOT NULL PRIMARY KEY,
+b BIGINT NOT NULL AUTO_INCREMENT,
+KEY(b)) ENGINE = InnoDB;
+ALTER TABLE t33 DISCARD TABLESPACE;
+restore: t33 .ibd and .cfg files
+ALTER TABLE t33 IMPORT TABLESPACE;
INSERT INTO t33 VALUES(3, NULL);
SELECT MAX(b) AS `Expect 4` FROM t33;
Expect 4
4
+SELECT * FROM t33;
+a b
+10 1
+2 2
+3 4
DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33;
diff --git a/mysql-test/suite/innodb/r/deadlock_detect.result b/mysql-test/suite/innodb/r/deadlock_detect.result
new file mode 100644
index 00000000000..c3e3794ed21
--- /dev/null
+++ b/mysql-test/suite/innodb/r/deadlock_detect.result
@@ -0,0 +1,30 @@
+SET GLOBAL innodb_deadlock_detect=OFF;
+SET GLOBAL innodb_lock_wait_timeout=2;
+connection default;
+CREATE TABLE t1(
+id INT,
+PRIMARY KEY(id)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1), (2), (3);
+BEGIN;
+SELECT * FROM t1 WHERE id = 1 FOR UPDATE;
+id
+1
+connect con1,localhost,root,,;
+BEGIN;
+SELECT * FROM t1 WHERE id = 2 FOR UPDATE;
+id
+2
+SELECT * FROM t1 WHERE id = 1 FOR UPDATE;
+connection default;
+SELECT * FROM t1 WHERE id = 2 FOR UPDATE;
+connection con1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ROLLBACK;
+connection default;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ROLLBACK;
+DROP TABLE t1;
+disconnect con1;
+SET GLOBAL innodb_lock_wait_timeout=default;
+SET GLOBAL innodb_deadlock_detect=default;
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result
new file mode 100644
index 00000000000..c0a6b37c1a0
--- /dev/null
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@ -0,0 +1,152 @@
+#
+# Bug #19027905 ASSERT RET.SECOND DICT_CREATE_FOREIGN_CONSTRAINTS_LOW
+# DICT_CREATE_FOREIGN_CONSTR
+#
+create table t1 (f1 int primary key) engine=InnoDB;
+create table t2 (f1 int primary key,
+constraint c1 foreign key (f1) references t1(f1),
+constraint c1 foreign key (f1) references t1(f1)) engine=InnoDB;
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+create table t2 (f1 int primary key,
+constraint c1 foreign key (f1) references t1(f1)) engine=innodb;
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 121 "Duplicate key on write or update")
+set foreign_key_checks = 0;
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+ERROR HY000: Duplicate FOREIGN KEY constraint name 'test/c1'
+drop table t2, t1;
+#
+# Bug #20031243 CREATE TABLE FAILS TO CHECK IF FOREIGN KEY COLUMN
+# NULL/NOT NULL MISMATCH
+#
+set foreign_key_checks = 1;
+show variables like 'foreign_key_checks';
+Variable_name Value
+foreign_key_checks ON
+CREATE TABLE t1
+(a INT NOT NULL,
+b INT NOT NULL,
+INDEX idx(a)) ENGINE=InnoDB;
+CREATE TABLE t2
+(a INT KEY,
+b INT,
+INDEX ind(b),
+FOREIGN KEY (b) REFERENCES t1(a) ON DELETE CASCADE ON UPDATE CASCADE)
+ENGINE=InnoDB;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL,
+ KEY `idx` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ `b` int(11) DEFAULT NULL,
+ PRIMARY KEY (`a`),
+ KEY `ind` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1, 80);
+INSERT INTO t1 VALUES (2, 81);
+INSERT INTO t1 VALUES (3, 82);
+INSERT INTO t1 VALUES (4, 83);
+INSERT INTO t1 VALUES (5, 84);
+INSERT INTO t2 VALUES (51, 1);
+INSERT INTO t2 VALUES (52, 2);
+INSERT INTO t2 VALUES (53, 3);
+INSERT INTO t2 VALUES (54, 4);
+INSERT INTO t2 VALUES (55, 5);
+SELECT a, b FROM t1 ORDER BY a;
+a b
+1 80
+2 81
+3 82
+4 83
+5 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+51 1
+52 2
+53 3
+54 4
+55 5
+INSERT INTO t2 VALUES (56, 6);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE)
+ALTER TABLE t1 CHANGE a id INT;
+SELECT id, b FROM t1 ORDER BY id;
+id b
+1 80
+2 81
+3 82
+4 83
+5 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+51 1
+52 2
+53 3
+54 4
+55 5
+# Operations on child table
+INSERT INTO t2 VALUES (56, 6);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
+UPDATE t2 SET b = 99 WHERE a = 51;
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
+DELETE FROM t2 WHERE a = 53;
+SELECT id, b FROM t1 ORDER BY id;
+id b
+1 80
+2 81
+3 82
+4 83
+5 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+51 1
+52 2
+54 4
+55 5
+# Operations on parent table
+DELETE FROM t1 WHERE id = 1;
+UPDATE t1 SET id = 50 WHERE id = 5;
+SELECT id, b FROM t1 ORDER BY id;
+id b
+2 81
+3 82
+4 83
+50 84
+SELECT a, b FROM t2 ORDER BY a;
+a b
+52 2
+54 4
+55 50
+DROP TABLE t2, t1;
+#
+# bug#25126722 FOREIGN KEY CONSTRAINT NAME IS NULL AFTER RESTART
+# base bug#24818604 [GR]
+#
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (c1 INT PRIMARY KEY, FOREIGN KEY (c1) REFERENCES t1(c1))
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+unique_constraint_name
+PRIMARY
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+unique_constraint_name
+PRIMARY
+SELECT * FROM t1;
+c1
+1
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+unique_constraint_name
+PRIMARY
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/ibuf_not_empty.result b/mysql-test/suite/innodb/r/ibuf_not_empty.result
new file mode 100644
index 00000000000..2c898b8916d
--- /dev/null
+++ b/mysql-test/suite/innodb/r/ibuf_not_empty.result
@@ -0,0 +1,25 @@
+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;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check Warning InnoDB: Index 'b' contains #### entries, should be 4096.
+test.t1 check error Corrupt
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-index-online-norebuild.result b/mysql-test/suite/innodb/r/innodb-index-online-norebuild.result
new file mode 100644
index 00000000000..b9077643870
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-index-online-norebuild.result
@@ -0,0 +1,26 @@
+# INPLACE ALTER WITH INPLACE_IGNORE FLAG AND CHANGE CREATE OPTION
+# CHANGE THE COLUMN DEFAULT (INPLACE_IGNORE)
+# AND TABLE CHARSET(CHANGE CREATE)
+CREATE TABLE t1(
+id INT PRIMARY KEY,
+f1 INT NOT NULL DEFAULT 0)ENGINE=INNODB;
+INSERT INTO t1 VALUES(1, 2);
+SET SQL_MODE='STRICT_ALL_TABLES';
+ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL DEFAULT 0,
+DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;
+DROP TABLE t1;
+# CHANGE THE COMMENT OF COLUMN(INPLACE IGNORE)
+# AND TABLE CHARSET(CHANGE CREATE)
+CREATE TABLE t1(id INT COMMENT 'independence day')ENGINE=INNODB;
+INSERT INTO t1 values(1);
+ALTER TABLE t1 MODIFY COLUMN id INT COMMENT 'identifier',
+DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;
+DROP TABLE t1;
+# RENAME THE TABLE(INPLACE IGNORE)
+# AND CHANGE TABLE CHARSET(CHANGE CREATE)
+CREATE TABLE t1(
+f1 INT NOT NULL,
+f2 INT NOT NULL)ENGINE=INNODB;
+INSERT INTO t1 VALUES(1, 2);
+ALTER TABLE t1 RENAME t2, DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;
+DROP TABLE t2;
diff --git a/mysql-test/suite/innodb/r/innodb-isolation.result b/mysql-test/suite/innodb/r/innodb-isolation.result
new file mode 100644
index 00000000000..2248d25b39a
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-isolation.result
@@ -0,0 +1,1411 @@
+#
+# WL#6742 - Test the interaction of multiple transactions using
+# different isolation levels to make sure that the value returned
+# by count(*) always reflects the correct view of the table according
+# to the transaction's selected isolation level.
+#
+#
+# Traverse various indexes to get the right counts.
+# This especially tests count(*) which is pushed down to InnoDB in WL#6742.
+#
+CREATE TABLE t1 (
+c1 INT AUTO_INCREMENT PRIMARY KEY,
+c2 INT,
+c3 INT,
+c4 INT,
+INDEX k2(c2)
+) Engine=InnoDB;
+INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1);
+INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1);
+INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1);
+INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1);
+INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1);
+INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1);
+INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1);
+INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1);
+INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1);
+INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1);
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t2 (SELECT * FROM t1);
+affected rows: 10
+info: Records: 10 Duplicates: 0 Warnings: 0
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 1 1 1
+2 1 1 1
+3 1 1 1
+4 1 1 1
+5 1 1 1
+6 1 1 1
+7 1 1 1
+8 1 1 1
+9 1 1 1
+10 1 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+10
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+10
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+10
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+55
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+10
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+5.5000 10 1 1.0000 10
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+6 1
+7 1
+8 1
+9 1
+10 1
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+5
+###############################################
+#
+# Do some DML in the default connection and leave the transaction pending.
+#
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
+UPDATE t1 SET c2 = c2 * 3 WHERE c1 = 1;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+DELETE FROM t1 WHERE c1 = 6;
+affected rows: 1
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 3 1 1
+2 1 1 1
+3 1 1 1
+4 1 1 1
+5 1 1 1
+7 1 1 1
+8 1 1 1
+9 1 1 1
+10 1 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+9
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+9
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+9
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+49
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+5.4444 10 1 1.0000 9
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+5 1
+7 1
+8 1
+9 1
+10 1
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+#
+# Start transactions of Repeatable Read, Read Committed, and Read Uncommitted
+#
+# Connection 1 REPEATABLE READ
+#
+connect con1,localhost,root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 1 1 1
+2 1 1 1
+3 1 1 1
+4 1 1 1
+5 1 1 1
+6 1 1 1
+7 1 1 1
+8 1 1 1
+9 1 1 1
+10 1 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+10
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+10
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+10
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+55
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+10
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+5.5000 10 1 1.0000 10
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+6 1
+7 1
+8 1
+9 1
+10 1
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+5
+###############################################
+UPDATE t1 SET c2 = c2 * 5 WHERE c1 = 2;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+DELETE FROM t1 WHERE c1 = 7;
+affected rows: 1
+INSERT INTO t1(c2,c3,c4) VALUES (100, 1, 1);
+affected rows: 1
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 1 1 1
+2 5 1 1
+3 1 1 1
+4 1 1 1
+5 1 1 1
+6 1 1 1
+8 1 1 1
+9 1 1 1
+10 1 1 1
+11 100 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+10
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+10
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+10
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+59
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+113
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+5.9000 11 1 1.0000 10
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+6 1
+8 1
+9 1
+10 1
+11 100
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+5
+###############################################
+#
+# Test a lock wait timeout during COUNT(*)
+#
+SET innodb_lock_wait_timeout = 1;
+SELECT COUNT(*) FROM t1 FOR UPDATE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+#
+# Connection 2 READ COMMITTED
+#
+connect con2,localhost,root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+BEGIN;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 1 1 1
+2 1 1 1
+3 1 1 1
+4 1 1 1
+5 1 1 1
+6 1 1 1
+7 1 1 1
+8 1 1 1
+9 1 1 1
+10 1 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+10
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+10
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+10
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+55
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+10
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+5.5000 10 1 1.0000 10
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+6 1
+7 1
+8 1
+9 1
+10 1
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+5
+###############################################
+UPDATE t1 SET c2 = c2 * 7 WHERE c1 = 3;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+DELETE FROM t1 WHERE c1 = 8;
+affected rows: 1
+INSERT INTO t1(c2,c3,c4) VALUES (1000, 1, 1);
+affected rows: 1
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 1 1 1
+2 1 1 1
+3 7 1 1
+4 1 1 1
+5 1 1 1
+6 1 1 1
+7 1 1 1
+9 1 1 1
+10 1 1 1
+12 1000 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+10
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+10
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+10
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+59
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+1015
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+5.9000 12 1 1.0000 10
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+6 1
+7 1
+9 1
+10 1
+12 1000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+5
+###############################################
+#
+# Connection 3 READ UNCOMMITTED
+#
+connect con3,localhost,root,,;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+BEGIN;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 3 1 1
+2 5 1 1
+3 7 1 1
+4 1 1 1
+5 1 1 1
+9 1 1 1
+10 1 1 1
+11 100 1 1
+12 1000 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+9
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+9
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+9
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+57
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+1119
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+6.3333 12 1 1.0000 9
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+5 1
+9 1
+10 1
+11 100
+12 1000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+UPDATE t1 SET c2 = c2 * 11 WHERE c1 = 4;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+INSERT INTO t1(c2,c3,c4) VALUES (10000, 1, 1);
+affected rows: 1
+DELETE FROM t1 WHERE c1 in(9);
+affected rows: 1
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 3 1 1
+2 5 1 1
+3 7 1 1
+4 11 1 1
+5 1 1 1
+10 1 1 1
+11 100 1 1
+12 1000 1 1
+13 10000 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+9
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+9
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+9
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+61
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11128
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+6.7778 13 1 1.0000 9
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+5 1
+10 1
+11 100
+12 1000
+13 10000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+#
+# Connection default REPEATABLE READ
+#
+connection default;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 3 1 1
+2 1 1 1
+3 1 1 1
+4 1 1 1
+5 1 1 1
+7 1 1 1
+8 1 1 1
+9 1 1 1
+10 1 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+9
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+9
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+9
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+49
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+5.4444 10 1 1.0000 9
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+5 1
+7 1
+8 1
+9 1
+10 1
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+#
+# Commit the 3 extra connections
+#
+# Connection 1 REPEATABLE READ
+#
+connection con1;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 1 1 1
+2 5 1 1
+3 1 1 1
+4 1 1 1
+5 1 1 1
+6 1 1 1
+8 1 1 1
+9 1 1 1
+10 1 1 1
+11 100 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+10
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+10
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+10
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+59
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+113
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+5.9000 11 1 1.0000 10
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+6 1
+8 1
+9 1
+10 1
+11 100
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+5
+###############################################
+#
+# Connection 2 READ COMMITTED
+#
+connection con2;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 1 1 1
+2 1 1 1
+3 7 1 1
+4 1 1 1
+5 1 1 1
+6 1 1 1
+7 1 1 1
+9 1 1 1
+10 1 1 1
+12 1000 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+10
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+10
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+10
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+59
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+1015
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+5.9000 12 1 1.0000 10
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+6 1
+7 1
+9 1
+10 1
+12 1000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+5
+###############################################
+#
+# Connection 3 READ UNCOMMITTED
+#
+connection con3;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 3 1 1
+2 5 1 1
+3 7 1 1
+4 11 1 1
+5 1 1 1
+10 1 1 1
+11 100 1 1
+12 1000 1 1
+13 10000 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+9
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+9
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+9
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+61
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11128
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+6.7778 13 1 1.0000 9
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+5 1
+10 1
+11 100
+12 1000
+13 10000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+COMMIT;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 3 1 1
+2 5 1 1
+3 7 1 1
+4 11 1 1
+5 1 1 1
+10 1 1 1
+11 100 1 1
+12 1000 1 1
+13 10000 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+9
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+9
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+9
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+61
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11128
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+6.7778 13 1 1.0000 9
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+5 1
+10 1
+11 100
+12 1000
+13 10000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+#
+# Connection 2 READ COMMITTED
+#
+connection con2;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 1 1 1
+2 1 1 1
+3 7 1 1
+4 11 1 1
+5 1 1 1
+6 1 1 1
+7 1 1 1
+10 1 1 1
+12 1000 1 1
+13 10000 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+10
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+10
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+10
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+63
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11024
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+6.3000 13 1 1.0000 10
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+6 1
+7 1
+10 1
+12 1000
+13 10000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+COMMIT;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 1 1 1
+2 1 1 1
+3 7 1 1
+4 11 1 1
+5 1 1 1
+6 1 1 1
+7 1 1 1
+10 1 1 1
+12 1000 1 1
+13 10000 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+10
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+10
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+10
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+63
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11024
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+6.3000 13 1 1.0000 10
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+6 1
+7 1
+10 1
+12 1000
+13 10000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+#
+# Connection 1 REPEATABLE READ
+#
+connection con1;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 1 1 1
+2 5 1 1
+3 1 1 1
+4 1 1 1
+5 1 1 1
+6 1 1 1
+8 1 1 1
+9 1 1 1
+10 1 1 1
+11 100 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+10
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+10
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+10
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+59
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+113
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+5.9000 11 1 1.0000 10
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+6 1
+8 1
+9 1
+10 1
+11 100
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+5
+###############################################
+#
+# Select the first 5 records FOR UPDATE using count(*) in a subquery.
+# The second record is still pending so we get a lock timeout.
+#
+SET innodb_lock_wait_timeout = 1;
+SELECT c1, c2 FROM t1 WHERE c1 < ((SELECT COUNT(*) FROM t1) / 2) FOR UPDATE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT COUNT(*) FROM t1 FOR UPDATE;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+COMMIT;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 1 1 1
+2 5 1 1
+3 7 1 1
+4 11 1 1
+5 1 1 1
+6 1 1 1
+10 1 1 1
+11 100 1 1
+12 1000 1 1
+13 10000 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+10
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+10
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+10
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+67
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11127
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+6.7000 13 1 1.0000 10
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+6 1
+10 1
+11 100
+12 1000
+13 10000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+#
+# Show The EXPLAIN output for these queries;
+#
+EXPLAIN SELECT * FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 12 #
+EXPLAIN SELECT COUNT(*) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k2 5 NULL 12 Using index
+EXPLAIN SELECT COUNT(c1) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k2 5 NULL 12 Using index
+EXPLAIN SELECT COUNT(c2) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k2 5 NULL 12 #
+EXPLAIN SELECT COUNT(c3) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 12 #
+EXPLAIN SELECT SUM(c1) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k2 5 NULL 12 #
+EXPLAIN SELECT SUM(c2) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL k2 5 NULL 12 #
+EXPLAIN SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 12 #
+EXPLAIN SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 8 #
+2 SUBQUERY t1 index NULL k2 5 NULL 12 #
+EXPLAIN SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 8 #
+2 SUBQUERY t1 index NULL k2 5 NULL 12 #
+EXPLAIN SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 7 #
+2 SUBQUERY t1 index NULL k2 5 NULL 12 #
+#
+# Make all indexes in t2 obsolete to the active repeatable read transaction
+# in the default connection.
+#
+ALTER TABLE t2 row_format=redundant;
+#
+# Connection default REPEATABLE READ
+# Do more DML in the default REPEATABLE READ transaction in order to use recently committed records.
+#
+connection default;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 3 1 1
+2 1 1 1
+3 1 1 1
+4 1 1 1
+5 1 1 1
+7 1 1 1
+8 1 1 1
+9 1 1 1
+10 1 1 1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+9
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+9
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+9
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+49
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+5.4444 10 1 1.0000 9
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+5 1
+7 1
+8 1
+9 1
+10 1
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+UPDATE t1 SET c4 = c2 * 10;
+affected rows: 9
+info: Rows matched: 9 Changed: 9 Warnings: 0
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 3 1 30
+2 5 1 50
+3 7 1 70
+4 11 1 110
+5 1 1 10
+7 1 1 1
+8 1 1 1
+9 1 1 1
+10 1 1 10
+11 100 1 1000
+12 1000 1 10000
+13 10000 1 100000
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+12
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+12
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+12
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+12
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+85
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11131
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+7.0833 13 1 1.0000 111283
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+7 1
+8 1
+9 1
+10 1
+11 100
+12 1000
+13 10000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+7
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+6
+###############################################
+#
+# Table t2 has been altered to a new row format.
+# The index should not be useable.
+#
+SELECT COUNT(*) FROM t2;
+ERROR HY000: Table definition has changed, please retry transaction
+SELECT * FROM t2;
+ERROR HY000: Table definition has changed, please retry transaction
+COMMIT;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+10
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 3 1 30
+2 5 1 50
+3 7 1 70
+4 11 1 110
+5 1 1 10
+10 1 1 10
+11 100 1 1000
+12 1000 1 10000
+13 10000 1 100000
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+9
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+9
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+9
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+61
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11128
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+6.7778 13 1 1.0000 111280
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+5 1
+10 1
+11 100
+12 1000
+13 10000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+#
+# Connection 2
+#
+connection con2;
+########## innodb_isolation_selects.inc ##########
+SELECT * FROM t1;
+c1 c2 c3 c4
+1 3 1 30
+2 5 1 50
+3 7 1 70
+4 11 1 110
+5 1 1 10
+10 1 1 10
+11 100 1 1000
+12 1000 1 10000
+13 10000 1 100000
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9
+SELECT COUNT(c1) FROM t1;
+COUNT(c1)
+9
+SELECT COUNT(c2) FROM t1;
+COUNT(c2)
+9
+SELECT COUNT(c3) FROM t1;
+COUNT(c3)
+9
+SELECT SUM(c1) FROM t1;
+SUM(c1)
+61
+SELECT SUM(c2) FROM t1;
+SUM(c2)
+11128
+SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+AVG(c1) MAX(c1) MIN(c2) AVG(c3) SUM(c4)
+6.7778 13 1 1.0000 111280
+SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+c1 c2
+5 1
+10 1
+11 100
+12 1000
+13 10000
+SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+COUNT(c2)
+5
+SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+COUNT(*)
+4
+###############################################
+#
+# Try COUNT(*) on a DISCARDED table.
+#
+connection default;
+CREATE TABLE t4 LIKE t1;
+INSERT INTO t4 (SELECT * FROM t1);
+SELECT COUNT(*) FROM t4;
+COUNT(*)
+9
+ALTER TABLE t4 DISCARD TABLESPACE;
+SELECT COUNT(*) FROM t4;
+ERROR HY000: Tablespace has been discarded for table `t4`
+#
+# Test the interaction of a repeatable read transaction
+# to changes that happen outside its view.
+#
+CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, aa INT, bb TEXT) Engine=InnoDB;
+INSERT INTO t5(b) VALUES ("inserted by client 1");
+INSERT INTO t5(b) VALUES ("inserted by client 1");
+INSERT INTO t5(b) VALUES ("inserted by client 1");
+INSERT INTO t5(b) VALUES ("inserted by client 1");
+UPDATE t5 SET aa=a, bb=b;
+CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, aa INT, bb TEXT) Engine=InnoDB;
+INSERT INTO t6(b) VALUES ("inserted by client 1");
+INSERT INTO t6(b) VALUES ("inserted by client 1");
+INSERT INTO t6(b) VALUES ("inserted by client 1");
+INSERT INTO t6(b) VALUES ("inserted by client 1");
+UPDATE t6 SET aa=a, bb=b;
+CREATE TABLE t7 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, aa INT, bb TEXT) Engine=InnoDB;
+INSERT INTO t7(b) VALUES ("inserted by client 1");
+INSERT INTO t7(b) VALUES ("inserted by client 1");
+INSERT INTO t7(b) VALUES ("inserted by client 1");
+INSERT INTO t7(b) VALUES ("inserted by client 1");
+UPDATE t7 SET aa=a, bb=b;
+BEGIN;
+SELECT * FROM t5;
+a b aa bb
+1 inserted by client 1 1 inserted by client 1
+2 inserted by client 1 2 inserted by client 1
+3 inserted by client 1 3 inserted by client 1
+4 inserted by client 1 4 inserted by client 1
+SELECT COUNT(*) FROM t5;
+COUNT(*)
+4
+SELECT * FROM t6;
+a b aa bb
+1 inserted by client 1 1 inserted by client 1
+2 inserted by client 1 2 inserted by client 1
+3 inserted by client 1 3 inserted by client 1
+4 inserted by client 1 4 inserted by client 1
+SELECT COUNT(*) FROM t6;
+COUNT(*)
+4
+SELECT * FROM t7;
+a b aa bb
+1 inserted by client 1 1 inserted by client 1
+2 inserted by client 1 2 inserted by client 1
+3 inserted by client 1 3 inserted by client 1
+4 inserted by client 1 4 inserted by client 1
+SELECT COUNT(*) FROM t7;
+COUNT(*)
+4
+#
+# Connection 1
+#
+connection con1;
+INSERT INTO t5(b) VALUES ("inserted by client 2");
+UPDATE t5 SET a = 10 where a = 1;
+UPDATE t5 SET b = "updated by client 2" where a = 2;
+DELETE FROM t5 WHERE a = 3;
+SELECT * FROM t5;
+a b aa bb
+2 updated by client 2 2 inserted by client 1
+4 inserted by client 1 4 inserted by client 1
+5 inserted by client 2 NULL NULL
+10 inserted by client 1 1 inserted by client 1
+SELECT COUNT(*) FROM t5;
+COUNT(*)
+4
+INSERT INTO t6(b) VALUES ("inserted by client 2");
+UPDATE t6 SET a = 10 where a = 1;
+UPDATE t6 SET b = "updated by client 2" where a = 2;
+DELETE FROM t6 WHERE a = 3;
+SELECT * FROM t6;
+a b aa bb
+2 updated by client 2 2 inserted by client 1
+4 inserted by client 1 4 inserted by client 1
+5 inserted by client 2 NULL NULL
+10 inserted by client 1 1 inserted by client 1
+SELECT COUNT(*) FROM t6;
+COUNT(*)
+4
+INSERT INTO t7(b) VALUES ("inserted by client 2");
+UPDATE t7 SET a = 10 where a = 1;
+UPDATE t7 SET b = "updated by client 2" where a = 2;
+DELETE FROM t7 WHERE a = 3;
+SELECT * FROM t7;
+a b aa bb
+2 updated by client 2 2 inserted by client 1
+4 inserted by client 1 4 inserted by client 1
+5 inserted by client 2 NULL NULL
+10 inserted by client 1 1 inserted by client 1
+SELECT COUNT(*) FROM t7;
+COUNT(*)
+4
+#
+# Connection default
+#
+connection default;
+SELECT * FROM t5;
+a b aa bb
+1 inserted by client 1 1 inserted by client 1
+2 inserted by client 1 2 inserted by client 1
+3 inserted by client 1 3 inserted by client 1
+4 inserted by client 1 4 inserted by client 1
+INSERT INTO t5(b) VALUES ("inserted by client 1");
+SELECT * FROM t5;
+a b aa bb
+1 inserted by client 1 1 inserted by client 1
+2 inserted by client 1 2 inserted by client 1
+3 inserted by client 1 3 inserted by client 1
+4 inserted by client 1 4 inserted by client 1
+11 inserted by client 1 NULL NULL
+UPDATE t5 SET a = a + 100;
+SELECT * FROM t5;
+a b aa bb
+1 inserted by client 1 1 inserted by client 1
+3 inserted by client 1 3 inserted by client 1
+102 updated by client 2 2 inserted by client 1
+104 inserted by client 1 4 inserted by client 1
+105 inserted by client 2 NULL NULL
+110 inserted by client 1 1 inserted by client 1
+111 inserted by client 1 NULL NULL
+SELECT COUNT(*) FROM t5;
+COUNT(*)
+7
+UPDATE t6 SET b = "updated by client 2";
+SELECT * FROM t6;
+a b aa bb
+1 inserted by client 1 1 inserted by client 1
+2 updated by client 2 2 inserted by client 1
+3 inserted by client 1 3 inserted by client 1
+4 updated by client 2 4 inserted by client 1
+5 updated by client 2 NULL NULL
+10 updated by client 2 1 inserted by client 1
+SELECT COUNT(*) FROM t6;
+COUNT(*)
+6
+DELETE FROM t7;
+SELECT * FROM t7;
+a b aa bb
+1 inserted by client 1 1 inserted by client 1
+3 inserted by client 1 3 inserted by client 1
+SELECT COUNT(*) FROM t7;
+COUNT(*)
+2
+COMMIT;
+SELECT * FROM t5;
+a b aa bb
+102 updated by client 2 2 inserted by client 1
+104 inserted by client 1 4 inserted by client 1
+105 inserted by client 2 NULL NULL
+110 inserted by client 1 1 inserted by client 1
+111 inserted by client 1 NULL NULL
+SELECT COUNT(*) FROM t5;
+COUNT(*)
+5
+SELECT * FROM t6;
+a b aa bb
+2 updated by client 2 2 inserted by client 1
+4 updated by client 2 4 inserted by client 1
+5 updated by client 2 NULL NULL
+10 updated by client 2 1 inserted by client 1
+SELECT COUNT(*) FROM t6;
+COUNT(*)
+4
+SELECT * FROM t7;
+a b aa bb
+SELECT COUNT(*) FROM t7;
+COUNT(*)
+0
+#
+# Cleanup
+#
+DROP TABLE t1,t2,t4,t5,t6,t7;
+disconnect con1;
+disconnect con2;
+disconnect con3;
+#
+# Bug #23596760: FORCE INDEX IS SKIPPED WHILE EXECUTING SELECT COUNT(*)
+#
+CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY,
+c2 INT NOT NULL DEFAULT 1,
+c3 char(20) DEFAULT '',
+KEY c2_idx (c2)) ENGINE=InnoDB;
+INSERT INTO t1(c1) VALUES (1), (2), (3);
+INSERT INTO t1(c1) SELECT c1 + 10 FROM t1;
+INSERT INTO t1(c1) SELECT c1 + 100 FROM t1;
+CREATE TABLE t2 SELECT * FROM t1;
+EXPLAIN SELECT COUNT(*) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL c2_idx 4 NULL 12 Using index
+EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(c2_idx);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL c2_idx 4 NULL 12 Using index
+EXPLAIN SELECT COUNT(*) FROM t1, t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL c2_idx 4 NULL 12 Using index
+1 SIMPLE t2 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join)
+EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(c2_idx), t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL c2_idx 4 NULL 12 Using index
+1 SIMPLE t2 ALL NULL NULL NULL NULL 12 Using join buffer (flat, BNL join)
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522,xtradb.rdiff-disabled b/mysql-test/suite/innodb/r/innodb-wl5522,xtradb.rdiff-disabled
deleted file mode 100644
index 4aea0b451ec..00000000000
--- a/mysql-test/suite/innodb/r/innodb-wl5522,xtradb.rdiff-disabled
+++ /dev/null
@@ -1,56 +0,0 @@
---- suite/innodb/r/innodb-wl5522.result
-+++ suite/innodb/r/innodb-wl5522.reject
-@@ -580,7 +580,7 @@
- ERROR HY000: Tablespace has been discarded for table 't1'
- restore: t1 .ibd and .cfg files
- ALTER TABLE t1 IMPORT TABLESPACE;
--ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x0)
-+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x0)
- unlink: t1.ibd
- unlink: t1.cfg
- DROP TABLE t1;
-@@ -592,7 +592,7 @@
- ERROR HY000: Tablespace has been discarded for table 't1'
- restore: t1 .ibd and .cfg files
- ALTER TABLE t1 IMPORT TABLESPACE;
--ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x0)
-+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x0)
- unlink: t1.ibd
- unlink: t1.cfg
- DROP TABLE t1;
-@@ -766,7 +766,7 @@
- ERROR HY000: Tablespace has been discarded for table 't1'
- restore: t1 .ibd and .cfg files
- ALTER TABLE t1 IMPORT TABLESPACE;
--ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x1)
-+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x1)
- unlink: t1.ibd
- unlink: t1.cfg
- DROP TABLE t1;
-@@ -778,7 +778,7 @@
- ERROR HY000: Tablespace has been discarded for table 't1'
- restore: t1 .ibd and .cfg files
- ALTER TABLE t1 IMPORT TABLESPACE;
--ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x1)
-+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1)
- unlink: t1.ibd
- unlink: t1.cfg
- DROP TABLE t1;
-@@ -955,7 +955,7 @@
- ERROR HY000: Tablespace has been discarded for table 't1'
- restore: t1 .ibd and .cfg files
- ALTER TABLE t1 IMPORT TABLESPACE;
--ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x21)
-+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x21)
- unlink: t1.ibd
- unlink: t1.cfg
- DROP TABLE t1;
-@@ -967,7 +967,7 @@
- ERROR HY000: Tablespace has been discarded for table 't1'
- restore: t1 .ibd and .cfg files
- ALTER TABLE t1 IMPORT TABLESPACE;
--ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x21)
-+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x21)
- unlink: t1.ibd
- unlink: t1.cfg
- DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
index 27909b57df8..4d748d6ebed 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result
@@ -796,7 +796,7 @@ t1 CREATE TABLE `t1` (
DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
INSERT IGNORE INTO test_wl5522.t1 VALUES
-(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200));
+(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 2731));
Warnings:
Warning 1265 Data truncated for column 'c2' at row 1
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
diff --git a/mysql-test/suite/innodb/r/innodb-wl5522.result b/mysql-test/suite/innodb/r/innodb-wl5522.result
index e5782755dd8..4ef92cdfed9 100644
--- a/mysql-test/suite/innodb/r/innodb-wl5522.result
+++ b/mysql-test/suite/innodb/r/innodb-wl5522.result
@@ -109,7 +109,7 @@ ALTER TABLE t2 DISCARD TABLESPACE;
# List after t2 DISCARD
t2.frm
ALTER TABLE t2 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x4 and the meta-data file has 0x1)
+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1)
ALTER TABLE t2 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Expected FSP_SPACE_FLAGS=0x*, .ibd file contains 0x*.)
DROP TABLE t2;
@@ -589,7 +589,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x0)
+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x0)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
@@ -601,7 +601,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x0)
+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x0)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
@@ -775,7 +775,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x1)
+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x1)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
@@ -787,7 +787,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x1)
+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
@@ -964,7 +964,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x21)
+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x21)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
@@ -976,7 +976,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x21)
+ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x21)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery.result b/mysql-test/suite/innodb/r/innodb_force_recovery.result
new file mode 100644
index 00000000000..e405a79dd53
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_force_recovery.result
@@ -0,0 +1,90 @@
+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;
+# Restart the server with innodb_force_recovery as 4.
+select * from t1;
+f1 f2
+1 2
+insert into t1 values(2, 3);
+ERROR HY000: Running in read-only mode
+alter table t1 add f3 int not null, algorithm=copy;
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
+alter table t1 add f3 int not null, algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Operation not allowed when innodb_forced_recovery > 0.. Try ALGORITHM=COPY
+drop index idx on t1;
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
+alter table t1 drop index idx, algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Operation not allowed when innodb_forced_recovery > 0.. Try ALGORITHM=COPY
+update t1 set f1=3 where f2=2;
+ERROR HY000: Running in read-only mode
+create table t3(f1 int not null)engine=innodb;
+ERROR HY000: Can't create table `test`.`t3` (errno: 165 "Table is read only")
+drop table t3;
+ERROR 42S02: Unknown table 'test.t3'
+rename table t1 to t3;
+ERROR HY000: Error on rename of './test/t1' to './test/t3' (errno: 165 "Table is read only")
+truncate table t1;
+ERROR HY000: Table 't1' is read only
+drop table t1;
+show tables;
+Tables_in_test
+t2
+# Restart the server with innodb_force_recovery as 5.
+select * from t2;
+f1 f2
+1 2
+insert into t2 values(2, 3);
+ERROR HY000: Running in read-only mode
+alter table t2 add f3 int not null, algorithm=copy;
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
+alter table t2 add f3 int not null, algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Operation not allowed when innodb_forced_recovery > 0.. Try ALGORITHM=COPY
+drop index idx on t2;
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
+update t2 set f1=3 where f2=2;
+ERROR HY000: Running in read-only mode
+create table t1(f1 int not null)engine=innodb;
+ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
+drop table t1;
+ERROR 42S02: Unknown table 'test.t1'
+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 HY000: Table 't2' is read only
+show tables;
+Tables_in_test
+t2
+# Restart the server with innodb_force_recovery as 6.
+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: Table 't2' is read only
+alter table t2 add f3 int not null, algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Operation not allowed when innodb_forced_recovery > 0.. Try ALGORITHM=COPY
+drop index idx on t2;
+ERROR HY000: Table 't2' is read only
+update t2 set f1=3 where f2=2;
+ERROR HY000: Table 't2' is read only
+create table t1(f1 int not null)engine=innodb;
+ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
+drop table t1;
+ERROR 42S02: Unknown table 'test.t1'
+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 HY000: Table 't2' is read only
+show tables;
+Tables_in_test
+t2
+drop table t2;
+show tables;
+Tables_in_test
diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result
index baae47d4544..a99d7dd72a5 100644
--- a/mysql-test/suite/innodb/r/innodb_gis.result
+++ b/mysql-test/suite/innodb/r/innodb_gis.result
@@ -599,3 +599,12 @@ create unique index a on t1(a);
drop table t1;
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
drop table t1;
+create table t1(id int not null primary key, g1 geometry not null, spatial index(g1));
+insert into t1 values(1, polygonfromtext('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'));
+explain select id from t1 where contains(g1, pointfromtext('POINT(1 1)'));
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range g1 g1 34 NULL 1 Using where
+select id from t1 where contains(g1, pointfromtext('POINT(1 1)'));
+id
+1
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_del_mark.result b/mysql-test/suite/innodb/r/innodb_stats_del_mark.result
new file mode 100644
index 00000000000..67538bf8eb3
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_del_mark.result
@@ -0,0 +1,91 @@
+#
+# Bug 23333990 PERSISTENT INDEX STATISTICS UPDATE BEFORE
+# TRANSACTION IS COMMITTED
+#
+"Test 1:- Uncommited delete test"
+CREATE TABLE t1 (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+val INT UNSIGNED NOT NULL,
+INDEX (val)) ENGINE=INNODB
+STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
+INSERT INTO t1 (val) VALUES (CEIL(RAND()*20));
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+262144
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+connect con1, localhost, root,,;
+START TRANSACTION;
+DELETE FROM t1;
+SELECT COUNT(*) FROM t1;
+connection default;
+Test correctly estimates the number of rows as > 20000
+even when in other uncommmited transaction
+all rows have been deleted.
+connection con1;
+COUNT(*)
+0
+commit;
+connection default;
+Test 2:- Insert and rollback test
+CREATE TABLE t2 (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+val INT UNSIGNED NOT NULL,
+INDEX (val)) ENGINE=INNODB
+STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
+connection con1;
+START TRANSACTION;
+INSERT INTO t2 (val) VALUES (CEIL(RAND()*20));
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+SELECT COUNT(*) FROM t2;
+connection default;
+select count(*) from t2;
+count(*)
+0
+Test correctly estimates the number of rows as > 20000
+even when in other uncommited transaction
+many rows are inserted.
+connection con1;
+COUNT(*)
+262144
+Rollback the insert
+rollback;
+disconnect con1;
+connection default;
+Test correctly estimates the number of rows as 1
+after rollback.
+DROP TABLE t1,t2;
diff --git a/mysql-test/suite/innodb/r/insert_debug.result b/mysql-test/suite/innodb/r/insert_debug.result
index 0d176afa116..3ac9df58c16 100644
--- a/mysql-test/suite/innodb/r/insert_debug.result
+++ b/mysql-test/suite/innodb/r/insert_debug.result
@@ -9,3 +9,23 @@ PARTITION BY HASH (c1) PARTITIONS 15;
DROP TABLE t1;
SET GLOBAL innodb_change_buffering_debug=0;
SET GLOBAL innodb_limit_optimistic_insert_debug=0;
+#
+# Bug#25082593 FOREIGN KEY VALIDATION DOESN'T NEED
+# TO ACQUIRE GAP LOCK IN READ COMMITTED
+#
+SET GLOBAL innodb_limit_optimistic_insert_debug=2;
+CREATE TABLE t1(col1 INT PRIMARY KEY) ENGINE=INNODB;
+CREATE TABLE t2(col1 INT PRIMARY KEY, col2 INT NOT NULL,
+FOREIGN KEY(col2) REFERENCES t1(col1)) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1), (3), (4);
+connect con1,localhost,root;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+INSERT INTO t2 VALUES(1, 3);
+connection default;
+START TRANSACTION;
+INSERT INTO t1 VALUES(2);
+disconnect con1;
+SET GLOBAL innodb_limit_optimistic_insert_debug=0;
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/readahead.result b/mysql-test/suite/innodb/r/readahead.result
new file mode 100644
index 00000000000..f7d6e6fae31
--- /dev/null
+++ b/mysql-test/suite/innodb/r/readahead.result
@@ -0,0 +1,6 @@
+# Bug#25330449 ASSERT SIZE==SPACE->SIZE DURING BUF_READ_AHEAD_RANDOM
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=INNODB ROW_FORMAT=COMPRESSED;
+SET @saved = @@GLOBAL.innodb_random_read_ahead;
+SET GLOBAL innodb_random_read_ahead = 1;
+DROP TABLE t1;
+SET GLOBAL innodb_random_read_ahead = @saved;
diff --git a/mysql-test/suite/innodb/r/redo_log_during_checkpoint.result b/mysql-test/suite/innodb/r/redo_log_during_checkpoint.result
new file mode 100644
index 00000000000..efe48682a6f
--- /dev/null
+++ b/mysql-test/suite/innodb/r/redo_log_during_checkpoint.result
@@ -0,0 +1,25 @@
+SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
+SET GLOBAL innodb_dict_stats_disabled_debug = 1;
+SET GLOBAL innodb_master_thread_disabled_debug = 1;
+SET GLOBAL innodb_log_checkpoint_now = 1;
+CREATE DATABASE very_long_database_name;
+USE very_long_database_name;
+set debug_dbug = '+d,increase_mtr_checkpoint_size';
+set debug_dbug = '+d,crash_after_checkpoint';
+set global innodb_log_checkpoint_now = 1;
+ERROR HY000: Lost connection to MySQL server during query
+# Skip MLOG_FILE_NAME redo records during recovery
+DROP DATABASE very_long_database_name;
+SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
+SET GLOBAL innodb_dict_stats_disabled_debug = 1;
+SET GLOBAL innodb_master_thread_disabled_debug = 1;
+SET GLOBAL innodb_log_checkpoint_now = 1;
+# Commit the multi-rec mini transaction if mtr size
+# exceeds LOG_CHECKPOINT_FREE_PER_THREAD size during checkpoint.
+CREATE DATABASE very_long_database_name;
+USE very_long_database_name;
+set debug_dbug = '+d,crash_after_checkpoint';
+set global innodb_log_checkpoint_now = 1;
+ERROR HY000: Lost connection to MySQL server during query
+# Skip MLOG_FILE_NAME redo records during recovery
+DROP DATABASE very_long_database_name;
diff --git a/mysql-test/suite/innodb/r/truncate_debug.result b/mysql-test/suite/innodb/r/truncate_debug.result
new file mode 100644
index 00000000000..47316fed2f7
--- /dev/null
+++ b/mysql-test/suite/innodb/r/truncate_debug.result
@@ -0,0 +1,86 @@
+#
+# Bug #23070734 CONCURRENT TRUNCATE TABLES CAUSE STALLS
+#
+Test_1 :- Check if DDL operations are possible on
+table being truncated. Also check if
+DDL operations on other tables succeed.
+create table t1 (f1 int,f2 int,key(f2),f3 int) engine=innodb;
+create index idx1 on t1(f3);
+create table t2 (f1 int,f2 int,key(f2),f3 int) engine=innodb;
+create table t3 (f1 int,f2 int,key(f2)) engine=innodb;
+insert into t1 values (10,20,30),(30,40,50),(50,60,70);
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t2 values (10,20,30),(30,40,50),(50,60,70);
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+insert into t3 values (10,20),(30,40),(50,50);
+insert into t3 select * from t3;
+insert into t3 select * from t3;
+SET session lock_wait_timeout = 1;
+connect con1,localhost,root,,;
+SET DEBUG_SYNC= 'buffer_pool_scan SIGNAL started WAIT_FOR finish_scan';
+truncate table t1;
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR started';
+Check Analyze table. Gives lock time out error.
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze Error Lock wait timeout exceeded; try restarting transaction
+test.t1 analyze status Operation failed
+Check if we can turn off auto recalculation.
+alter table t1 STATS_AUTO_RECALC=0;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+Check if we can turn off persistent stats on the table
+alter table t1 STATS_PERSISTENT=0;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+Check if DML is possible on table being truncated
+insert into t1 values (10,89,99);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+Check if DDL is possible on table being truncated
+alter table t1 add column f4 int;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+check if table can be created with the same name
+create table t1 (bd int) engine=innodb;
+Got one of the listed errors
+check if index can be created on table being truncated
+create index idx1 on t1(f1);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+Check if DROP of table is possible during truncate
+drop table t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+Check if select is possible during truncate
+select * from t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t2 where t2.f1=t1.f1;
+ERROR 42S22: Unknown column 't1.f1' in 'where clause'
+Check concurrent truncate operation on table;
+truncate table t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+Check concurrent selects and inserts on the other table
+insert into t3 values (10,20),(30,40),(50,50);
+select * from t3 where f1=40;
+f1 f2
+Concurrent truncate on other tables
+truncate table t2;
+Concurrent alters on the other tables
+alter table t2 add column f4 int;
+check if index can be created on the other table
+create index idx1 on t2(f3);
+Check if we can turn off persistent stats off entire instance
+SET GLOBAL innodb_stats_persistent=off;
+connect con2,localhost,root,,;
+set global innodb_adaptive_hash_index=off;
+connection default;
+SET DEBUG_SYNC= 'now SIGNAL finish_scan';
+SET DEBUG_SYNC= 'RESET';
+connection con1;
+disconnect con1;
+connection con2;
+disconnect con2;
+connection default;
+SET session lock_wait_timeout=default;
+set global innodb_adaptive_hash_index=on;
+drop table t1,t2,t3;
diff --git a/mysql-test/suite/innodb/r/truncate_purge_debug.result b/mysql-test/suite/innodb/r/truncate_purge_debug.result
new file mode 100644
index 00000000000..edece3019bc
--- /dev/null
+++ b/mysql-test/suite/innodb/r/truncate_purge_debug.result
@@ -0,0 +1,29 @@
+#
+# Bug #23070734 CONCURRENT TRUNCATE TABLES CAUSE STALLS
+#
+create table t1 (f1 int ,f2 int,key(f2)) engine=innodb;
+begin;
+insert into t1 values (10,45),(20,78),(30,88),(40,23),(50,78),(60,11),(70,56),(80,90);
+delete from t1;
+connect con2,localhost,root,,;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
+commit;
+connect con1,localhost,root,,;
+SET DEBUG_SYNC= 'buffer_pool_scan SIGNAL started WAIT_FOR finish_scan';
+truncate table t1;
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR started';
+COMMIT;
+disconnect con2;
+connection default;
+InnoDB 0 transactions not purged
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
+SET DEBUG_SYNC = 'now SIGNAL finish_scan';
+SET DEBUG_SYNC = 'RESET';
+connection con1;
+disconnect con1;
+connection default;
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/autoinc_debug.test b/mysql-test/suite/innodb/t/autoinc_debug.test
new file mode 100644
index 00000000000..2e662565490
--- /dev/null
+++ b/mysql-test/suite/innodb/t/autoinc_debug.test
@@ -0,0 +1,85 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/not_embedded.inc
+
+# Two parallel connection with autoinc column after restart.
+
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY)ENGINE=INNODB;
+
+--echo # SETTING auto_increment_increment IN CONNECTION DEFAULT
+SET AUTO_INCREMENT_INCREMENT = 1;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+
+--source include/restart_mysqld.inc
+
+--echo # SETTING auto_increment_increment IN CONNECTION1
+SET AUTO_INCREMENT_INCREMENT = 2;
+
+SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL opened WAIT_FOR flushed1';
+
+SEND INSERT INTO t1 VALUES(NULL);
+
+connect(con1, localhost, root,,);
+SET AUTO_INCREMENT_INCREMENT = 2;
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+SET DEBUG_SYNC= 'ib_after_row_insert_step SIGNAL flushed1 WAIT_FOR opened1';
+send insert into t1 values(NULL);
+
+connection default;
+reap;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+SET DEBUG_SYNC= 'now SIGNAL opened1';
+
+connection con1;
+reap;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+connection default;
+disconnect con1;
+
+DROP TABLE t1;
+
+# Two parallel connection with autoinc column without restart.
+
+CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY)ENGINE=INNODB;
+
+--echo # SETTING auto_increment_increment IN CONNECTION DEFAULT
+SET AUTO_INCREMENT_INCREMENT = 1;
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+SET DEBUG_SYNC = 'now SIGNAL flushed';
+
+connect(con1, localhost, root,,);
+
+--echo # SETTING auto_increment_increment in connection1
+SET AUTO_INCREMENT_INCREMENT = 2;
+
+SET DEBUG_SYNC= 'now WAIT_FOR flushed';
+SET DEBUG_SYNC= 'ib_after_row_insert SIGNAL opened WAIT_FOR flushed1';
+
+send INSERT INTO t1 values(NULL);
+
+connection default;
+
+SET DEBUG_SYNC= 'now WAIT_FOR opened';
+SET DEBUG_SYNC= 'ib_after_row_insert_step SIGNAL flushed1 WAIT_FOR opened1';
+
+send INSERT INTO t1 VALUES(NULL);
+
+connection con1;
+reap;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+SET DEBUG_SYNC= 'now SIGNAL opened1';
+disconnect con1;
+
+connection default;
+reap;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+SET DEBUG_SYNC='RESET';
diff --git a/mysql-test/suite/innodb/t/autoinc_persist.test b/mysql-test/suite/innodb/t/autoinc_persist.test
index 904ed51f718..fd85b45fbfa 100644
--- a/mysql-test/suite/innodb/t/autoinc_persist.test
+++ b/mysql-test/suite/innodb/t/autoinc_persist.test
@@ -520,7 +520,28 @@ SELECT MAX(a) AS `Expect 2` FROM t32;
INSERT INTO t32 VALUES(0), (0);
SELECT MAX(a) AS `Expect 6` FROM t32;
+FLUSH TABLES t33 FOR EXPORT;
+let MYSQLD_DATADIR=`select @@datadir`;
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
+ib_backup_tablespaces("test", "t33");
+EOF
+UNLOCK TABLES;
+DROP TABLE t33;
+CREATE TABLE t33 (
+a BIGINT NOT NULL PRIMARY KEY,
+b BIGINT NOT NULL AUTO_INCREMENT,
+KEY(b)) ENGINE = InnoDB;
+ALTER TABLE t33 DISCARD TABLESPACE;
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
+ib_discard_tablespaces("test", "t33");
+ib_restore_tablespaces("test", "t33");
+EOF
+ALTER TABLE t33 IMPORT TABLESPACE;
+
INSERT INTO t33 VALUES(3, NULL);
SELECT MAX(b) AS `Expect 4` FROM t33;
+SELECT * FROM t33;
DROP TABLE t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t30, t32, t33;
diff --git a/mysql-test/suite/innodb/t/deadlock_detect.test b/mysql-test/suite/innodb/t/deadlock_detect.test
new file mode 100644
index 00000000000..85d8c1f67f2
--- /dev/null
+++ b/mysql-test/suite/innodb/t/deadlock_detect.test
@@ -0,0 +1,55 @@
+#
+# wl#9383 INNODB: ADD AN OPTION TO TURN OFF/ON DEADLOCK CHECKER
+#
+
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+--source include/count_sessions.inc
+
+SET GLOBAL innodb_deadlock_detect=OFF;
+SET GLOBAL innodb_lock_wait_timeout=2;
+
+connection default;
+
+CREATE TABLE t1(
+ id INT,
+ PRIMARY KEY(id)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES(1), (2), (3);
+
+BEGIN;
+
+SELECT * FROM t1 WHERE id = 1 FOR UPDATE;
+
+connect (con1,localhost,root,,);
+
+BEGIN;
+
+SELECT * FROM t1 WHERE id = 2 FOR UPDATE;
+
+send SELECT * FROM t1 WHERE id = 1 FOR UPDATE;
+
+connection default;
+send SELECT * FROM t1 WHERE id = 2 FOR UPDATE;
+
+connection con1;
+--error ER_LOCK_WAIT_TIMEOUT
+reap;
+
+ROLLBACK;
+
+connection default;
+--error ER_LOCK_WAIT_TIMEOUT
+reap;
+
+ROLLBACK;
+
+DROP TABLE t1;
+
+disconnect con1;
+
+--source include/wait_until_count_sessions.inc
+
+SET GLOBAL innodb_lock_wait_timeout=default;
+SET GLOBAL innodb_deadlock_detect=default;
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
new file mode 100644
index 00000000000..750465f2b85
--- /dev/null
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -0,0 +1,115 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # Bug #19027905 ASSERT RET.SECOND DICT_CREATE_FOREIGN_CONSTRAINTS_LOW
+--echo # DICT_CREATE_FOREIGN_CONSTR
+--echo #
+
+create table t1 (f1 int primary key) engine=InnoDB;
+--error ER_CANT_CREATE_TABLE
+create table t2 (f1 int primary key,
+constraint c1 foreign key (f1) references t1(f1),
+constraint c1 foreign key (f1) references t1(f1)) engine=InnoDB;
+create table t2 (f1 int primary key,
+ constraint c1 foreign key (f1) references t1(f1)) engine=innodb;
+
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+
+set foreign_key_checks = 0;
+--error ER_DUP_CONSTRAINT_NAME
+alter table t2 add constraint c1 foreign key (f1) references t1(f1);
+
+drop table t2, t1;
+
+--echo #
+--echo # Bug #20031243 CREATE TABLE FAILS TO CHECK IF FOREIGN KEY COLUMN
+--echo # NULL/NOT NULL MISMATCH
+--echo #
+
+set foreign_key_checks = 1;
+show variables like 'foreign_key_checks';
+
+CREATE TABLE t1
+(a INT NOT NULL,
+ b INT NOT NULL,
+ INDEX idx(a)) ENGINE=InnoDB;
+
+CREATE TABLE t2
+(a INT KEY,
+ b INT,
+ INDEX ind(b),
+ FOREIGN KEY (b) REFERENCES t1(a) ON DELETE CASCADE ON UPDATE CASCADE)
+ ENGINE=InnoDB;
+
+show create table t1;
+show create table t2;
+
+INSERT INTO t1 VALUES (1, 80);
+INSERT INTO t1 VALUES (2, 81);
+INSERT INTO t1 VALUES (3, 82);
+INSERT INTO t1 VALUES (4, 83);
+INSERT INTO t1 VALUES (5, 84);
+
+INSERT INTO t2 VALUES (51, 1);
+INSERT INTO t2 VALUES (52, 2);
+INSERT INTO t2 VALUES (53, 3);
+INSERT INTO t2 VALUES (54, 4);
+INSERT INTO t2 VALUES (55, 5);
+
+SELECT a, b FROM t1 ORDER BY a;
+SELECT a, b FROM t2 ORDER BY a;
+
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO t2 VALUES (56, 6);
+
+ALTER TABLE t1 CHANGE a id INT;
+
+SELECT id, b FROM t1 ORDER BY id;
+SELECT a, b FROM t2 ORDER BY a;
+
+--echo # Operations on child table
+--error ER_NO_REFERENCED_ROW_2
+INSERT INTO t2 VALUES (56, 6);
+--error ER_NO_REFERENCED_ROW_2
+UPDATE t2 SET b = 99 WHERE a = 51;
+DELETE FROM t2 WHERE a = 53;
+SELECT id, b FROM t1 ORDER BY id;
+SELECT a, b FROM t2 ORDER BY a;
+
+--echo # Operations on parent table
+DELETE FROM t1 WHERE id = 1;
+UPDATE t1 SET id = 50 WHERE id = 5;
+SELECT id, b FROM t1 ORDER BY id;
+SELECT a, b FROM t2 ORDER BY a;
+
+DROP TABLE t2, t1;
+
+--echo #
+--echo # bug#25126722 FOREIGN KEY CONSTRAINT NAME IS NULL AFTER RESTART
+--echo # base bug#24818604 [GR]
+--echo #
+
+CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (c1 INT PRIMARY KEY, FOREIGN KEY (c1) REFERENCES t1(c1))
+ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+
+--source include/restart_mysqld.inc
+
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+
+SELECT * FROM t1;
+
+SELECT unique_constraint_name FROM information_schema.referential_constraints
+WHERE table_name = 't2';
+
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/ibuf_not_empty.test b/mysql-test/suite/innodb/t/ibuf_not_empty.test
new file mode 100644
index 00000000000..a1a2da1f903
--- /dev/null
+++ b/mysql-test/suite/innodb/t/ibuf_not_empty.test
@@ -0,0 +1,54 @@
+--source include/have_innodb.inc
+# innodb_change_buffering_debug option is debug only
+--source include/have_debug.inc
+# Embedded server tests do not support restarting
+--source include/not_embedded.inc
+# The test is not big enough to use change buffering with larger page size.
+--source include/have_innodb_max_16k.inc
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: Failed to find tablespace for table `test`\\.`t1` in the cache\\. Attempting to load the tablespace with space id");
+call mtr.add_suppression("InnoDB: Allocated tablespace ID \\d+ for test.t1, old maximum was");
+--enable_query_log
+
+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;
+
+--let $restart_parameters= --innodb-force-recovery=6
+--source include/restart_mysqld.inc
+
+--replace_regex /contains \d+ entries/contains #### entries/
+check table t1;
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+# Cleanup
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-index-online-norebuild.opt b/mysql-test/suite/innodb/t/innodb-index-online-norebuild.opt
new file mode 100644
index 00000000000..39b93371503
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-index-online-norebuild.opt
@@ -0,0 +1 @@
+--loose-innodb-sys-tables
diff --git a/mysql-test/suite/innodb/t/innodb-index-online-norebuild.test b/mysql-test/suite/innodb/t/innodb-index-online-norebuild.test
new file mode 100644
index 00000000000..518b4efe1df
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-index-online-norebuild.test
@@ -0,0 +1,71 @@
+--source include/have_innodb.inc
+
+--echo # INPLACE ALTER WITH INPLACE_IGNORE FLAG AND CHANGE CREATE OPTION
+
+--echo # CHANGE THE COLUMN DEFAULT (INPLACE_IGNORE)
+--echo # AND TABLE CHARSET(CHANGE CREATE)
+
+CREATE TABLE t1(
+ id INT PRIMARY KEY,
+ f1 INT NOT NULL DEFAULT 0)ENGINE=INNODB;
+
+INSERT INTO t1 VALUES(1, 2);
+
+let id_before_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;
+
+# Allow the following operation to report errors.
+SET SQL_MODE='STRICT_ALL_TABLES';
+ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL DEFAULT 0,
+ DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;
+
+let id_after_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;
+
+if ($id_before_alter != $id_after_alter)
+{
+ --echo "Table rebuild happened";
+}
+
+DROP TABLE t1;
+
+--echo # CHANGE THE COMMENT OF COLUMN(INPLACE IGNORE)
+--echo # AND TABLE CHARSET(CHANGE CREATE)
+
+CREATE TABLE t1(id INT COMMENT 'independence day')ENGINE=INNODB;
+
+INSERT INTO t1 values(1);
+
+let id_before_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;
+
+ALTER TABLE t1 MODIFY COLUMN id INT COMMENT 'identifier',
+ DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;
+
+let id_after_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;
+
+if ($id_before_alter != $id_after_alter)
+{
+ --echo "Table rebuild happened";
+}
+
+DROP TABLE t1;
+
+--echo # RENAME THE TABLE(INPLACE IGNORE)
+--echo # AND CHANGE TABLE CHARSET(CHANGE CREATE)
+
+CREATE TABLE t1(
+ f1 INT NOT NULL,
+ f2 INT NOT NULL)ENGINE=INNODB;
+
+INSERT INTO t1 VALUES(1, 2);
+
+let id_before_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;
+
+ALTER TABLE t1 RENAME t2, DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;
+
+let id_after_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t2"`;
+
+if ($id_before_alter != $id_after_alter)
+{
+ --echo "Table rebuild happened";
+}
+
+DROP TABLE t2;
diff --git a/mysql-test/suite/innodb/t/innodb-isolation.test b/mysql-test/suite/innodb/t/innodb-isolation.test
new file mode 100644
index 00000000000..56cd668b305
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-isolation.test
@@ -0,0 +1,354 @@
+
+#Note:- WL6742 has been removed from 5.7 (Bug 23046302),
+# but we are keeping this test since it tests
+# count(*) correctness for various isolation
+# levels.
+
+--echo #
+--echo # WL#6742 - Test the interaction of multiple transactions using
+--echo # different isolation levels to make sure that the value returned
+--echo # by count(*) always reflects the correct view of the table according
+--echo # to the transaction's selected isolation level.
+--echo #
+
+--source include/have_innodb.inc
+
+--disable_query_log
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $initial_timeout=`select @@innodb_lock_wait_timeout`;
+--enable_query_log
+
+--echo #
+--echo # Traverse various indexes to get the right counts.
+--echo # This especially tests count(*) which is pushed down to InnoDB in WL#6742.
+--echo #
+CREATE TABLE t1 (
+ c1 INT AUTO_INCREMENT PRIMARY KEY,
+ c2 INT,
+ c3 INT,
+ c4 INT,
+ INDEX k2(c2)
+) Engine=InnoDB;
+let $1=10;
+while ($1 > 0) {
+ INSERT INTO t1(c2,c3,c4) VALUES (1, 1, 1);
+ dec $1;
+}
+
+CREATE TABLE t2 LIKE t1;
+--enable_info
+INSERT INTO t2 (SELECT * FROM t1);
+--disable_info
+
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Do some DML in the default connection and leave the transaction pending.
+--echo #
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
+--enable_info
+UPDATE t1 SET c2 = c2 * 3 WHERE c1 = 1;
+DELETE FROM t1 WHERE c1 = 6;
+--disable_info
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Start transactions of Repeatable Read, Read Committed, and Read Uncommitted
+--echo #
+--echo # Connection 1 REPEATABLE READ
+--echo #
+connect (con1,localhost,root,,);
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
+--source suite/innodb/include/innodb_isolation_selects.inc
+--enable_info
+UPDATE t1 SET c2 = c2 * 5 WHERE c1 = 2;
+DELETE FROM t1 WHERE c1 = 7;
+INSERT INTO t1(c2,c3,c4) VALUES (100, 1, 1);
+--disable_info
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Test a lock wait timeout during COUNT(*)
+--echo #
+SET innodb_lock_wait_timeout = 1;
+--error ER_LOCK_WAIT_TIMEOUT
+SELECT COUNT(*) FROM t1 FOR UPDATE;
+
+
+--echo #
+--echo # Connection 2 READ COMMITTED
+--echo #
+connect (con2,localhost,root,,);
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+BEGIN;
+--source suite/innodb/include/innodb_isolation_selects.inc
+--enable_info
+UPDATE t1 SET c2 = c2 * 7 WHERE c1 = 3;
+DELETE FROM t1 WHERE c1 = 8;
+INSERT INTO t1(c2,c3,c4) VALUES (1000, 1, 1);
+--disable_info
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Connection 3 READ UNCOMMITTED
+--echo #
+connect (con3,localhost,root,,);
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+BEGIN;
+--source suite/innodb/include/innodb_isolation_selects.inc
+--enable_info
+UPDATE t1 SET c2 = c2 * 11 WHERE c1 = 4;
+INSERT INTO t1(c2,c3,c4) VALUES (10000, 1, 1);
+DELETE FROM t1 WHERE c1 in(9);
+--disable_info
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Connection default REPEATABLE READ
+--echo #
+connection default;
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Commit the 3 extra connections
+--echo #
+--echo # Connection 1 REPEATABLE READ
+--echo #
+connection con1;
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Connection 2 READ COMMITTED
+--echo #
+connection con2;
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Connection 3 READ UNCOMMITTED
+--echo #
+connection con3;
+--source suite/innodb/include/innodb_isolation_selects.inc
+COMMIT;
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Connection 2 READ COMMITTED
+--echo #
+connection con2;
+--source suite/innodb/include/innodb_isolation_selects.inc
+COMMIT;
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Connection 1 REPEATABLE READ
+--echo #
+connection con1;
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Select the first 5 records FOR UPDATE using count(*) in a subquery.
+--echo # The second record is still pending so we get a lock timeout.
+--echo #
+SET innodb_lock_wait_timeout = 1;
+--error ER_LOCK_WAIT_TIMEOUT
+SELECT c1, c2 FROM t1 WHERE c1 < ((SELECT COUNT(*) FROM t1) / 2) FOR UPDATE;
+--error ER_LOCK_WAIT_TIMEOUT
+SELECT COUNT(*) FROM t1 FOR UPDATE;
+COMMIT;
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Show The EXPLAIN output for these queries;
+--echo #
+# column 10 is the row count provided by handler::info(). In InnoDB, this is
+# a statistical estimate. After the multi-transactional changes above,
+# Solaris reports 10 rows which is correct, but other OSes report 9.
+--replace_column 10 #
+EXPLAIN SELECT * FROM t1;
+EXPLAIN SELECT COUNT(*) FROM t1;
+EXPLAIN SELECT COUNT(c1) FROM t1;
+--replace_column 10 #
+EXPLAIN SELECT COUNT(c2) FROM t1;
+--replace_column 10 #
+EXPLAIN SELECT COUNT(c3) FROM t1;
+--replace_column 10 #
+EXPLAIN SELECT SUM(c1) FROM t1;
+--replace_column 10 #
+EXPLAIN SELECT SUM(c2) FROM t1;
+--replace_column 10 #
+EXPLAIN SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1;
+--replace_column 10 #
+EXPLAIN SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+--replace_column 10 #
+EXPLAIN SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2);
+--replace_column 10 #
+EXPLAIN SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1);
+
+--echo #
+--echo # Make all indexes in t2 obsolete to the active repeatable read transaction
+--echo # in the default connection.
+--echo #
+ALTER TABLE t2 row_format=redundant;
+
+--echo #
+--echo # Connection default REPEATABLE READ
+--echo # Do more DML in the default REPEATABLE READ transaction in order to use recently committed records.
+--echo #
+connection default;
+--source suite/innodb/include/innodb_isolation_selects.inc
+--enable_info
+UPDATE t1 SET c4 = c2 * 10;
+--disable_info
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Table t2 has been altered to a new row format.
+--echo # The index should not be useable.
+--echo #
+--error ER_TABLE_DEF_CHANGED
+SELECT COUNT(*) FROM t2;
+--error ER_TABLE_DEF_CHANGED
+SELECT * FROM t2;
+
+COMMIT;
+SELECT COUNT(*) FROM t2;
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Connection 2
+--echo #
+connection con2;
+--source suite/innodb/include/innodb_isolation_selects.inc
+
+--echo #
+--echo # Try COUNT(*) on a DISCARDED table.
+--echo #
+connection default;
+CREATE TABLE t4 LIKE t1;
+INSERT INTO t4 (SELECT * FROM t1);
+SELECT COUNT(*) FROM t4;
+ALTER TABLE t4 DISCARD TABLESPACE;
+--error ER_TABLESPACE_DISCARDED
+SELECT COUNT(*) FROM t4;
+
+
+--echo #
+--echo # Test the interaction of a repeatable read transaction
+--echo # to changes that happen outside its view.
+--echo #
+
+CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, aa INT, bb TEXT) Engine=InnoDB;
+INSERT INTO t5(b) VALUES ("inserted by client 1");
+INSERT INTO t5(b) VALUES ("inserted by client 1");
+INSERT INTO t5(b) VALUES ("inserted by client 1");
+INSERT INTO t5(b) VALUES ("inserted by client 1");
+UPDATE t5 SET aa=a, bb=b;
+CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, aa INT, bb TEXT) Engine=InnoDB;
+INSERT INTO t6(b) VALUES ("inserted by client 1");
+INSERT INTO t6(b) VALUES ("inserted by client 1");
+INSERT INTO t6(b) VALUES ("inserted by client 1");
+INSERT INTO t6(b) VALUES ("inserted by client 1");
+UPDATE t6 SET aa=a, bb=b;
+CREATE TABLE t7 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, aa INT, bb TEXT) Engine=InnoDB;
+INSERT INTO t7(b) VALUES ("inserted by client 1");
+INSERT INTO t7(b) VALUES ("inserted by client 1");
+INSERT INTO t7(b) VALUES ("inserted by client 1");
+INSERT INTO t7(b) VALUES ("inserted by client 1");
+UPDATE t7 SET aa=a, bb=b;
+BEGIN;
+SELECT * FROM t5;
+SELECT COUNT(*) FROM t5;
+SELECT * FROM t6;
+SELECT COUNT(*) FROM t6;
+SELECT * FROM t7;
+SELECT COUNT(*) FROM t7;
+
+--echo #
+--echo # Connection 1
+--echo #
+connection con1;
+INSERT INTO t5(b) VALUES ("inserted by client 2");
+UPDATE t5 SET a = 10 where a = 1;
+UPDATE t5 SET b = "updated by client 2" where a = 2;
+DELETE FROM t5 WHERE a = 3;
+SELECT * FROM t5;
+SELECT COUNT(*) FROM t5;
+INSERT INTO t6(b) VALUES ("inserted by client 2");
+UPDATE t6 SET a = 10 where a = 1;
+UPDATE t6 SET b = "updated by client 2" where a = 2;
+DELETE FROM t6 WHERE a = 3;
+SELECT * FROM t6;
+SELECT COUNT(*) FROM t6;
+INSERT INTO t7(b) VALUES ("inserted by client 2");
+UPDATE t7 SET a = 10 where a = 1;
+UPDATE t7 SET b = "updated by client 2" where a = 2;
+DELETE FROM t7 WHERE a = 3;
+SELECT * FROM t7;
+SELECT COUNT(*) FROM t7;
+
+--echo #
+--echo # Connection default
+--echo #
+connection default;
+SELECT * FROM t5;
+INSERT INTO t5(b) VALUES ("inserted by client 1");
+SELECT * FROM t5;
+UPDATE t5 SET a = a + 100;
+SELECT * FROM t5;
+SELECT COUNT(*) FROM t5;
+
+UPDATE t6 SET b = "updated by client 2";
+SELECT * FROM t6;
+SELECT COUNT(*) FROM t6;
+
+DELETE FROM t7;
+SELECT * FROM t7;
+SELECT COUNT(*) FROM t7;
+
+COMMIT;
+SELECT * FROM t5;
+SELECT COUNT(*) FROM t5;
+SELECT * FROM t6;
+SELECT COUNT(*) FROM t6;
+SELECT * FROM t7;
+SELECT COUNT(*) FROM t7;
+
+--echo #
+--echo # Cleanup
+--echo #
+DROP TABLE t1,t2,t4,t5,t6,t7;
+disconnect con1;
+disconnect con2;
+disconnect con3;
+--disable_query_log
+eval set global innodb_lock_wait_timeout=$initial_timeout;
+--enable_query_log
+
+--echo #
+--echo # Bug #23596760: FORCE INDEX IS SKIPPED WHILE EXECUTING SELECT COUNT(*)
+--echo #
+
+CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY,
+ c2 INT NOT NULL DEFAULT 1,
+ c3 char(20) DEFAULT '',
+ KEY c2_idx (c2)) ENGINE=InnoDB;
+
+INSERT INTO t1(c1) VALUES (1), (2), (3);
+INSERT INTO t1(c1) SELECT c1 + 10 FROM t1;
+INSERT INTO t1(c1) SELECT c1 + 100 FROM t1;
+
+CREATE TABLE t2 SELECT * FROM t1;
+
+let query1= SELECT COUNT(*) FROM t1;
+let query2= SELECT COUNT(*) FROM t1 FORCE INDEX(c2_idx);
+let query3= SELECT COUNT(*) FROM t1, t2;
+let query4= SELECT COUNT(*) FROM t1 FORCE INDEX(c2_idx), t2;
+
+eval EXPLAIN $query1;
+eval EXPLAIN $query2;
+eval EXPLAIN $query3;
+eval EXPLAIN $query4;
+
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
index 68c5d3000cb..6b6506e8481 100644
--- a/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug.test
@@ -1164,7 +1164,7 @@ DROP TABLE test_wl5522.t1;
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb;
INSERT IGNORE INTO test_wl5522.t1 VALUES
- (100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200));
+ (100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 2731));
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery.test b/mysql-test/suite/innodb/t/innodb_force_recovery.test
new file mode 100644
index 00000000000..31b9660e872
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_force_recovery.test
@@ -0,0 +1,139 @@
+# Not supported in embedded
+--source include/not_embedded.inc
+
+# This test case needs InnoDB.
+-- source include/have_innodb.inc
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: Failed to find tablespace for table .* in the cache. Attempting to load the tablespace with space id");
+call mtr.add_suppression("InnoDB: Allocated tablespace ID \\d+ for test.t[12], old maximum was");
+--enable_query_log
+
+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;
+
+--echo # Restart the server with innodb_force_recovery as 4.
+--let $restart_parameters= --innodb-force-recovery=4
+--source include/restart_mysqld.inc
+
+select * from t1;
+
+--error ER_READ_ONLY_MODE
+insert into t1 values(2, 3);
+
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+alter table t1 add f3 int not null, algorithm=copy;
+
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+alter table t1 add f3 int not null, algorithm=inplace;
+
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+drop index idx on t1;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+alter table t1 drop index idx, algorithm=inplace;
+
+--error ER_READ_ONLY_MODE
+update t1 set f1=3 where f2=2;
+
+--error ER_CANT_CREATE_TABLE
+create table t3(f1 int not null)engine=innodb;
+
+--error ER_BAD_TABLE_ERROR
+drop table t3;
+
+--error ER_ERROR_ON_RENAME
+rename table t1 to t3;
+
+--error ER_OPEN_AS_READONLY
+truncate table t1;
+
+drop table t1;
+show tables;
+
+--echo # Restart the server with innodb_force_recovery as 5.
+--let $restart_parameters= --innodb-force-recovery=5
+--source include/restart_mysqld.inc
+
+select * from t2;
+
+--error ER_READ_ONLY_MODE
+insert into t2 values(2, 3);
+
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+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;
+
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+drop index idx on t2;
+
+--error ER_READ_ONLY_MODE
+update t2 set f1=3 where f2=2;
+
+--error ER_CANT_CREATE_TABLE
+create table t1(f1 int not null)engine=innodb;
+
+--error ER_BAD_TABLE_ERROR
+drop table t1;
+
+--error ER_ERROR_ON_RENAME
+rename table t2 to t3;
+
+--error ER_OPEN_AS_READONLY
+truncate table t2;
+
+--error ER_OPEN_AS_READONLY
+drop table t2;
+show tables;
+
+--echo # Restart the server with innodb_force_recovery as 6.
+--let $restart_parameters= --innodb-force-recovery=6
+--source include/restart_mysqld.inc
+
+select * from t2;
+
+--error ER_OPEN_AS_READONLY
+insert into t2 values(2, 3);
+
+--error ER_OPEN_AS_READONLY
+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_OPEN_AS_READONLY
+drop index idx on t2;
+
+--error ER_OPEN_AS_READONLY
+update t2 set f1=3 where f2=2;
+
+--error ER_CANT_CREATE_TABLE
+create table t1(f1 int not null)engine=innodb;
+
+--error ER_BAD_TABLE_ERROR
+drop table t1;
+
+--error ER_ERROR_ON_RENAME
+rename table t2 to t3;
+
+--error ER_OPEN_AS_READONLY
+truncate table t2;
+
+--error ER_OPEN_AS_READONLY
+drop table t2;
+show tables;
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+drop table t2;
+show tables;
diff --git a/mysql-test/suite/innodb/t/innodb_gis.test b/mysql-test/suite/innodb/t/innodb_gis.test
index 45d66d95002..cb04c15f0b6 100644
--- a/mysql-test/suite/innodb/t/innodb_gis.test
+++ b/mysql-test/suite/innodb/t/innodb_gis.test
@@ -11,3 +11,12 @@ SET storage_engine=innodb;
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
drop table t1;
+#
+# MDEV-12462 SPATIAL index fails to work with CONTAINS
+#
+
+create table t1(id int not null primary key, g1 geometry not null, spatial index(g1));
+insert into t1 values(1, polygonfromtext('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'));
+explain select id from t1 where contains(g1, pointfromtext('POINT(1 1)'));
+select id from t1 where contains(g1, pointfromtext('POINT(1 1)'));
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_del_mark-master.opt b/mysql-test/suite/innodb/t/innodb_stats_del_mark-master.opt
new file mode 100644
index 00000000000..145ee2b4264
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_del_mark-master.opt
@@ -0,0 +1 @@
+--innodb_stats_include_delete_marked=on
diff --git a/mysql-test/suite/innodb/t/innodb_stats_del_mark.test b/mysql-test/suite/innodb/t/innodb_stats_del_mark.test
new file mode 100644
index 00000000000..36f7a2ea099
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_del_mark.test
@@ -0,0 +1,113 @@
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+--echo #
+--echo # Bug 23333990 PERSISTENT INDEX STATISTICS UPDATE BEFORE
+--echo # TRANSACTION IS COMMITTED
+--echo #
+
+--echo "Test 1:- Uncommited delete test"
+CREATE TABLE t1 (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ val INT UNSIGNED NOT NULL,
+ INDEX (val)) ENGINE=INNODB
+ STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
+
+
+INSERT INTO t1 (val) VALUES (CEIL(RAND()*20));
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
+
+SELECT COUNT(*) FROM t1;
+ANALYZE TABLE t1;
+
+connect(con1, localhost, root,,);
+START TRANSACTION;
+DELETE FROM t1;
+send SELECT COUNT(*) FROM t1;
+
+connection default;
+let $row_count= query_get_value(EXPLAIN SELECT * FROM t1 WHERE val=4, rows,1);
+if ($row_count > 20000)
+{
+--echo Test correctly estimates the number of rows as > 20000
+--echo even when in other uncommmited transaction
+--echo all rows have been deleted.
+}
+
+connection con1;
+reap;
+commit;
+
+connection default;
+
+--echo Test 2:- Insert and rollback test
+CREATE TABLE t2 (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ val INT UNSIGNED NOT NULL,
+ INDEX (val)) ENGINE=INNODB
+ STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
+
+connection con1;
+
+START TRANSACTION;
+INSERT INTO t2 (val) VALUES (CEIL(RAND()*20));
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
+send SELECT COUNT(*) FROM t2;
+
+connection default;
+select count(*) from t2;
+let $row_count= query_get_value(EXPLAIN SELECT * FROM t2 WHERE val=4, rows,1);
+if ($row_count > 20000)
+{
+--echo Test correctly estimates the number of rows as > 20000
+--echo even when in other uncommited transaction
+--echo many rows are inserted.
+}
+
+connection con1;
+reap;
+--echo Rollback the insert
+rollback;
+disconnect con1;
+
+connection default;
+let $row_count= query_get_value(EXPLAIN SELECT * FROM t2 WHERE val=4, rows,1);
+if ($row_count <= 1)
+{
+--echo Test correctly estimates the number of rows as $row_count
+--echo after rollback.
+}
+
+DROP TABLE t1,t2;
diff --git a/mysql-test/suite/innodb/t/insert_debug.test b/mysql-test/suite/innodb/t/insert_debug.test
index 36ceba2ee8b..c370c402ac7 100644
--- a/mysql-test/suite/innodb/t/insert_debug.test
+++ b/mysql-test/suite/innodb/t/insert_debug.test
@@ -15,3 +15,35 @@ DROP TABLE t1;
SET GLOBAL innodb_change_buffering_debug=0;
SET GLOBAL innodb_limit_optimistic_insert_debug=0;
+
+--echo #
+--echo # Bug#25082593 FOREIGN KEY VALIDATION DOESN'T NEED
+--echo # TO ACQUIRE GAP LOCK IN READ COMMITTED
+--echo #
+
+SET GLOBAL innodb_limit_optimistic_insert_debug=2;
+
+CREATE TABLE t1(col1 INT PRIMARY KEY) ENGINE=INNODB;
+
+CREATE TABLE t2(col1 INT PRIMARY KEY, col2 INT NOT NULL,
+FOREIGN KEY(col2) REFERENCES t1(col1)) ENGINE=INNODB;
+
+INSERT INTO t1 VALUES(1), (3), (4);
+
+connect (con1,localhost,root);
+
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+START TRANSACTION;
+INSERT INTO t2 VALUES(1, 3);
+
+connection default;
+START TRANSACTION;
+
+INSERT INTO t1 VALUES(2);
+
+disconnect con1;
+
+SET GLOBAL innodb_limit_optimistic_insert_debug=0;
+
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/readahead.test b/mysql-test/suite/innodb/t/readahead.test
new file mode 100644
index 00000000000..b4b8e8e38f0
--- /dev/null
+++ b/mysql-test/suite/innodb/t/readahead.test
@@ -0,0 +1,22 @@
+--source include/have_innodb.inc
+--source include/have_innodb_max_16k.inc
+# Embedded server tests do not support restarting
+--source include/not_embedded.inc
+
+--echo # Bug#25330449 ASSERT SIZE==SPACE->SIZE DURING BUF_READ_AHEAD_RANDOM
+
+let $MYSQLD_DATADIR=`SELECT @@datadir`;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=INNODB ROW_FORMAT=COMPRESSED;
+
+--source include/shutdown_mysqld.inc
+--remove_file $MYSQLD_DATADIR/ib_buffer_pool
+
+--write_file $MYSQLD_DATADIR/ib_buffer_pool
+EOF
+
+--source include/start_mysqld.inc
+SET @saved = @@GLOBAL.innodb_random_read_ahead;
+SET GLOBAL innodb_random_read_ahead = 1;
+
+DROP TABLE t1;
+SET GLOBAL innodb_random_read_ahead = @saved;
diff --git a/mysql-test/suite/innodb/t/redo_log_during_checkpoint.test b/mysql-test/suite/innodb/t/redo_log_during_checkpoint.test
new file mode 100644
index 00000000000..9ff01739f60
--- /dev/null
+++ b/mysql-test/suite/innodb/t/redo_log_during_checkpoint.test
@@ -0,0 +1,75 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/big_test.inc
+# Embedded server tests do not support restarting
+--source include/not_embedded.inc
+# We are crashing the server on purpose
+--source include/not_valgrind.inc
+--source include/not_crashrep.inc
+
+# The test does work with any page size, but we want to reduce the
+# test running time by limiting the combinations. The redo log format
+# is independent of the page size.
+--source include/have_innodb_16k.inc
+
+SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
+SET GLOBAL innodb_dict_stats_disabled_debug = 1;
+SET GLOBAL innodb_master_thread_disabled_debug = 1;
+SET GLOBAL innodb_log_checkpoint_now = 1;
+
+CREATE DATABASE very_long_database_name;
+USE very_long_database_name;
+let $i=1300;
+--disable_query_log
+while ($i)
+{
+ eval CREATE TABLE veryLongTableNameToCreateMLOG_FILE_NAMErecords$i (a SERIAL)
+ ENGINE=InnoDB;
+ dec $i;
+}
+--enable_query_log
+
+--let $_server_id= `SELECT @@server_id`
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
+--exec echo "wait" > $_expect_file_name
+
+set debug_dbug = '+d,increase_mtr_checkpoint_size';
+set debug_dbug = '+d,crash_after_checkpoint';
+--error 2013
+set global innodb_log_checkpoint_now = 1;
+
+--echo # Skip MLOG_FILE_NAME redo records during recovery
+--source include/start_mysqld.inc
+
+DROP DATABASE very_long_database_name;
+
+SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
+SET GLOBAL innodb_dict_stats_disabled_debug = 1;
+SET GLOBAL innodb_master_thread_disabled_debug = 1;
+SET GLOBAL innodb_log_checkpoint_now = 1;
+
+--echo # Commit the multi-rec mini transaction if mtr size
+--echo # exceeds LOG_CHECKPOINT_FREE_PER_THREAD size during checkpoint.
+
+CREATE DATABASE very_long_database_name;
+USE very_long_database_name;
+let $i=1300;
+--disable_query_log
+while ($i)
+{
+ eval CREATE TABLE veryLongTableNameToCreateMLOG_FILE_NAMErecords$i (a SERIAL)
+ ENGINE=InnoDB;
+ dec $i;
+}
+--enable_query_log
+
+--exec echo "wait" > $_expect_file_name
+set debug_dbug = '+d,crash_after_checkpoint';
+--error 2013
+set global innodb_log_checkpoint_now = 1;
+
+--echo # Skip MLOG_FILE_NAME redo records during recovery
+--let $restart_parameters = --debug-dbug=d,reduce_recv_parsing_buf
+--source include/start_mysqld.inc
+
+DROP DATABASE very_long_database_name;
diff --git a/mysql-test/suite/innodb/t/truncate_debug.test b/mysql-test/suite/innodb/t/truncate_debug.test
new file mode 100644
index 00000000000..fed5cf9392b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/truncate_debug.test
@@ -0,0 +1,122 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+--source include/count_sessions.inc
+
+--echo #
+--echo # Bug #23070734 CONCURRENT TRUNCATE TABLES CAUSE STALLS
+--echo #
+
+--echo Test_1 :- Check if DDL operations are possible on
+--echo table being truncated. Also check if
+--echo DDL operations on other tables succeed.
+
+create table t1 (f1 int,f2 int,key(f2),f3 int) engine=innodb;
+create index idx1 on t1(f3);
+create table t2 (f1 int,f2 int,key(f2),f3 int) engine=innodb;
+create table t3 (f1 int,f2 int,key(f2)) engine=innodb;
+
+insert into t1 values (10,20,30),(30,40,50),(50,60,70);
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t2 values (10,20,30),(30,40,50),(50,60,70);
+
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+
+insert into t3 values (10,20),(30,40),(50,50);
+insert into t3 select * from t3;
+insert into t3 select * from t3;
+
+SET session lock_wait_timeout = 1;
+
+connect (con1,localhost,root,,);
+SET DEBUG_SYNC= 'buffer_pool_scan SIGNAL started WAIT_FOR finish_scan';
+send truncate table t1;
+
+connection default;
+SET DEBUG_SYNC= 'now WAIT_FOR started';
+
+--echo Check Analyze table. Gives lock time out error.
+analyze table t1;
+
+--echo Check if we can turn off auto recalculation.
+--error ER_LOCK_WAIT_TIMEOUT
+alter table t1 STATS_AUTO_RECALC=0;
+
+--echo Check if we can turn off persistent stats on the table
+--error ER_LOCK_WAIT_TIMEOUT
+alter table t1 STATS_PERSISTENT=0;
+
+--echo Check if DML is possible on table being truncated
+--error ER_LOCK_WAIT_TIMEOUT
+insert into t1 values (10,89,99);
+
+--echo Check if DDL is possible on table being truncated
+--error ER_LOCK_WAIT_TIMEOUT
+alter table t1 add column f4 int;
+
+--echo check if table can be created with the same name
+--error ER_TABLE_EXISTS_ERROR,ER_LOCK_WAIT_TIMEOUT
+create table t1 (bd int) engine=innodb;
+
+--echo check if index can be created on table being truncated
+--error ER_LOCK_WAIT_TIMEOUT
+create index idx1 on t1(f1);
+
+--echo Check if DROP of table is possible during truncate
+--error ER_LOCK_WAIT_TIMEOUT
+drop table t1;
+
+--echo Check if select is possible during truncate
+--error ER_LOCK_WAIT_TIMEOUT
+select * from t1;
+
+--error ER_BAD_FIELD_ERROR
+select * from t2 where t2.f1=t1.f1;
+
+--echo Check concurrent truncate operation on table;
+--error ER_LOCK_WAIT_TIMEOUT
+truncate table t1;
+
+--echo Check concurrent selects and inserts on the other table
+insert into t3 values (10,20),(30,40),(50,50);
+select * from t3 where f1=40;
+
+--echo Concurrent truncate on other tables
+truncate table t2;
+
+--echo Concurrent alters on the other tables
+alter table t2 add column f4 int;
+
+--echo check if index can be created on the other table
+create index idx1 on t2(f3);
+
+--echo Check if we can turn off persistent stats off entire instance
+SET GLOBAL innodb_stats_persistent=off;
+
+connect (con2,localhost,root,,);
+send set global innodb_adaptive_hash_index=off;
+
+connection default;
+SET DEBUG_SYNC= 'now SIGNAL finish_scan';
+SET DEBUG_SYNC= 'RESET';
+
+connection con1;
+reap;
+disconnect con1;
+
+connection con2;
+reap;
+disconnect con2;
+
+connection default;
+
+SET session lock_wait_timeout=default;
+set global innodb_adaptive_hash_index=on;
+
+drop table t1,t2,t3;
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/truncate_purge_debug.opt b/mysql-test/suite/innodb/t/truncate_purge_debug.opt
new file mode 100644
index 00000000000..8bed7e46166
--- /dev/null
+++ b/mysql-test/suite/innodb/t/truncate_purge_debug.opt
@@ -0,0 +1,3 @@
+--innodb-purge-threads=1
+--innodb-purge-batch-size=1
+--innodb-stats-persistent=OFF
diff --git a/mysql-test/suite/innodb/t/truncate_purge_debug.test b/mysql-test/suite/innodb/t/truncate_purge_debug.test
new file mode 100644
index 00000000000..70ebd28024d
--- /dev/null
+++ b/mysql-test/suite/innodb/t/truncate_purge_debug.test
@@ -0,0 +1,66 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/count_sessions.inc
+
+--echo #
+--echo # Bug #23070734 CONCURRENT TRUNCATE TABLES CAUSE STALLS
+--echo #
+
+create table t1 (f1 int ,f2 int,key(f2)) engine=innodb;
+begin;
+insert into t1 values (10,45),(20,78),(30,88),(40,23),(50,78),(60,11),(70,56),(80,90);
+delete from t1;
+
+connect (con2,localhost,root,,);
+# Stop the purge thread
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+
+connection default;
+# Ensure that the history list length will actually be decremented by purge.
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
+commit;
+
+connect (con1,localhost,root,,);
+SET DEBUG_SYNC= 'buffer_pool_scan SIGNAL started WAIT_FOR finish_scan';
+send truncate table t1;
+
+connection con2;
+SET DEBUG_SYNC= 'now WAIT_FOR started';
+# Allow purge to proceed, by discarding our read view.
+COMMIT;
+disconnect con2;
+
+connection default;
+
+# Wait for everything to be purged.
+
+let $wait_counter= 300;
+while ($wait_counter)
+{
+ --replace_regex /.*History list length ([0-9]+).*/\1/
+ let $remaining= `SHOW ENGINE INNODB STATUS`;
+ if ($remaining == 'InnoDB 0')
+ {
+ let $wait_counter= 0;
+ }
+ if ($wait_counter)
+ {
+ real_sleep 0.1;
+ dec $wait_counter;
+ }
+}
+echo $remaining transactions not purged;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
+
+SET DEBUG_SYNC = 'now SIGNAL finish_scan';
+SET DEBUG_SYNC = 'RESET';
+
+connection con1;
+reap;
+disconnect con1;
+
+connection default;
+drop table t1;
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb_gis/r/0.result b/mysql-test/suite/innodb_gis/r/0.result
index 41d560e7d95..e5b285e519a 100644
--- a/mysql-test/suite/innodb_gis/r/0.result
+++ b/mysql-test/suite/innodb_gis/r/0.result
@@ -610,7 +610,7 @@ set @g1 = ST_GeomFromText('Polygon((0 0,0 100,100 100,100 0,0 0))');
set transaction isolation level read uncommitted;
select count(*) from t1 where ST_Within(t1.c2, @g1);
count(*)
-0
+1
disconnect con1;
connection a;
commit;
diff --git a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
index 973377cb141..abc3c5b5f05 100644
--- a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
+++ b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
@@ -66,6 +66,7 @@ c1 ST_Astext(c2) ST_Astext(c4)
SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)');
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1);
c1 ST_Astext(c2) ST_Astext(c4)
+4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
UPDATE tab SET C2 = ST_GeomFromText('POINT(100 100)')
WHERE MBRContains(tab.c4, @g1);
DELETE FROM tab WHERE MBRContains(tab.c4, @g1);
@@ -230,7 +231,6 @@ Table Op Msg_type Msg_text
test.tab check status OK
SELECT c1,ST_Astext(c2),ST_Astext(c4) FROM tab ORDER BY c1;
c1 ST_Astext(c2) ST_Astext(c4)
-4 POINT(50 50) POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
6 POINT(3 3) POLYGON((2010 2010,2020 2020,2030 2030,2040 2030,2020 2010,2010 2010))
7 POINT(60 70) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
8 POINT(0 0) POLYGON((3010 3010,3020 3020,3030 3030,3040 3030,3020 3010,3010 3010))
diff --git a/mysql-test/suite/innodb_gis/r/create_spatial_index.result b/mysql-test/suite/innodb_gis/r/create_spatial_index.result
index 9629fa03fef..fe46ef2e2f8 100644
--- a/mysql-test/suite/innodb_gis/r/create_spatial_index.result
+++ b/mysql-test/suite/innodb_gis/r/create_spatial_index.result
@@ -76,6 +76,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
c1 ST_Astext(c4)
+4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
WHERE MBRContains(tab.c4, @g1);
id select_type table type possible_keys key key_len ref rows Extra
@@ -399,6 +400,7 @@ test.tab check status OK
SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)');
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
c1 ST_Astext(c4)
+4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
DELETE FROM tab WHERE MBRContains(tab.c4, @g1);
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
c1 ST_Astext(c4)
@@ -408,7 +410,6 @@ test.tab check status OK
SET @g1 = ST_GeomFromText('POLYGON((100 200,1010 1010,1020 1020,500 300,300 200,100 300,100 200))');
SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1;
c1 ST_Astext(c4)
-4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
5 POLYGON((1010 1010,1020 1020,1030 1030,1040 1030,1020 1010,1010 1010))
DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1);
SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1;
@@ -503,6 +504,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
c1 ST_Astext(c4)
+4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
WHERE MBRContains(tab.c4, @g1);
id select_type table type possible_keys key key_len ref rows Extra
@@ -919,6 +921,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE tab range idx3 idx3 34 NULL 1 Using where; Using filesort
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1;
c1 ST_Astext(c4)
+4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300))
EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)')
WHERE MBRContains(tab.c4, @g1);
id select_type table type possible_keys key key_len ref rows Extra
diff --git a/mysql-test/suite/innodb_gis/r/rt_precise.result b/mysql-test/suite/innodb_gis/r/rt_precise.result
index e52f2ab5aa3..9e2c6adc2d9 100644
--- a/mysql-test/suite/innodb_gis/r/rt_precise.result
+++ b/mysql-test/suite/innodb_gis/r/rt_precise.result
@@ -55,5 +55,8 @@ count(*)
SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g,
ST_GeomFromText('Polygon((40 40,60 40,60 60,40 40))')) ORDER BY fid;
fid ST_AsText(g)
+45 LINESTRING(51 51,60 60)
+46 LINESTRING(51 41,60 50)
+56 LINESTRING(41 41,50 50)
DROP TABLE t1;
End of 5.5 tests.
diff --git a/mysql-test/suite/innodb_gis/r/rtree.result b/mysql-test/suite/innodb_gis/r/rtree.result
index a2b685f1747..285a499b16c 100644
--- a/mysql-test/suite/innodb_gis/r/rtree.result
+++ b/mysql-test/suite/innodb_gis/r/rtree.result
@@ -10,9 +10,12 @@ test.t1 analyze status OK
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range g g 34 NULL 1 Using where
+1 SIMPLE t1 ALL g NULL NULL NULL 5 Using where
select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
ST_astext(t1.g)
+POINT(1 1)
+POINT(1.5 1.5)
+POINT(3 3)
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
delete from t1 where MBRWithin(t1.g, @g1);
check table t1;
@@ -20,9 +23,6 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
-POINT(1 1)
-POINT(1.5 1.5)
-POINT(3 3)
POINT(3.1 3.1)
POINT(5 5)
set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))');
@@ -32,9 +32,6 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
-POINT(1 1)
-POINT(1.5 1.5)
-POINT(3 3)
POINT(3.1 3.1)
POINT(2 2)
show indexes from t1;
@@ -59,7 +56,6 @@ INSERT INTO t1 VALUES("left3", ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1
SET @p = ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))');
SELECT name, ST_AsText(square) from t1 where MBRContains(@p, square);
name ST_AsText(square)
-small POLYGON((0 0,0 1,1 1,1 0,0 0))
SELECT name, ST_AsText(square) from t1 where MBRDisjoint(@p, square);
name ST_AsText(square)
up3 POLYGON((0 3,0 5,2 5,2 3,0 3))
@@ -94,7 +90,6 @@ down2 POLYGON((0 -2,0 0,2 0,2 -2,0 -2))
left2 POLYGON((-2 0,-2 2,0 2,0 0,-2 0))
SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square);
name ST_AsText(square)
-big POLYGON((0 0,0 3,3 3,3 0,0 0))
SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
@@ -157,9 +152,12 @@ test.t1 analyze status OK
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range g g 34 NULL 1 Using where
+1 SIMPLE t1 ALL g NULL NULL NULL 5 Using where
select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1);
ST_astext(t1.g)
+POINT(1 1)
+POINT(1.5 1.5)
+POINT(3 3)
set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))');
delete from t1 where MBRWithin(t1.g, @g1);
check table t1;
@@ -167,9 +165,6 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
-POINT(1 1)
-POINT(1.5 1.5)
-POINT(3 3)
POINT(3.1 3.1)
POINT(5 5)
set @g1 = ST_GeomFromText('Polygon((5 5,5 5,5 5,5 5,5 5))');
@@ -179,9 +174,6 @@ Table Op Msg_type Msg_text
test.t1 check status OK
select ST_astext(t1.g) from t1;
ST_astext(t1.g)
-POINT(1 1)
-POINT(1.5 1.5)
-POINT(3 3)
POINT(3.1 3.1)
POINT(2 2)
show indexes from t1;
@@ -225,7 +217,7 @@ SELECT COUNT(*)
FROM t1
WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way);
COUNT(*)
-9
+0
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
@@ -234,7 +226,7 @@ SELECT COUNT(*)
FROM t1
WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way);
COUNT(*)
-9
+0
DROP TABLE t1;
CREATE TABLE t1( i INT, g GEOMETRY NOT NULL, SPATIAL INDEX (g)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, LINESTRING(POINT(1,1), POINT(4, 4)));
@@ -249,3 +241,622 @@ test.t1 check status OK
DELETE FROM t1
WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((0 0,4 0, 4 4, 0 4, 0 0))'),g);
DROP TABLE t1;
+CREATE TABLE address (
+address_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
+address VARCHAR(50) NOT NULL,
+address2 VARCHAR(50) DEFAULT NULL,
+district VARCHAR(20) NOT NULL,
+city_id SMALLINT UNSIGNED NOT NULL,
+postal_code VARCHAR(10) DEFAULT NULL,
+phone VARCHAR(20) NOT NULL,
+location GEOMETRY NOT NULL,
+last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (address_id),
+SPATIAL KEY `idx_location` (location)
+)ENGINE=InnoDB DEFAULT CHARSET=utf8;
+SET AUTOCOMMIT=0;
+INSERT INTO `address` VALUES (1,'47 MySakila Drive',NULL,'Alberta',300,'','',0x0000000001010000003E0A325D63345CC0761FDB8D99D94840,'2014-09-25 22:30:27'),
+(2,'28 MySQL Boulevard',NULL,'QLD',576,'','',0x0000000001010000008E10D4DF812463404EE08C5022A23BC0,'2014-09-25 22:30:09'),
+(3,'23 Workhaven Lane',NULL,'Alberta',300,'','14033335568',0x000000000101000000CDC4196863345CC01DEE7E7099D94840,'2014-09-25 22:30:27'),
+(4,'1411 Lillydale Drive',NULL,'QLD',576,'','6172235589',0x0000000001010000005B0DE4341F26634042D6AE6422A23BC0,'2014-09-25 22:30:09'),
+(5,'1913 Hanoi Way','','Nagasaki',463,'35200','28303384290',0x00000000010100000028D1370E21376040ABB58BC45F944040,'2014-09-25 22:31:53'),
+(6,'1121 Loja Avenue','','California',449,'17886','838635286649',0x0000000001010000003C94579D8B525DC0E860472DDE0D4140,'2014-09-25 22:34:01'),
+(7,'692 Joliet Street','','Attika',38,'83579','448477190408',0x000000000101000000076F59CF5AB737404105D1A45EFD4240,'2014-09-25 22:31:07'),
+(8,'1566 Inegl Manor','','Mandalay',349,'53561','705814003527',0x00000000010100000006240626DCD857403C45B357C4753540,'2014-09-25 22:32:18'),
+(9,'53 Idfu Parkway','','Nantou',361,'42399','10655648674',0x0000000001010000001F813FFC7C2A5E40357A354069EA3740,'2014-09-25 22:33:16'),
+(10,'1795 Santiago de Compostela Way','','Texas',295,'18743','860452626434',0x00000000010100000050502F9D7BE058C0D0CF7932A4813B40,'2014-09-25 22:33:55'),
+(11,'900 Santiago de Compostela Parkway','','Central Serbia',280,'93896','716571220373',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:11'),
+(12,'478 Joliet Way','','Hamilton',200,'77948','657282285970',0x000000000101000000DC84D61E11E9654072B7353344E442C0,'2014-09-25 22:32:22'),
+(13,'613 Korolev Drive','','Masqat',329,'45844','380657522649',0x00000000010100000001023164D04B4D40CEAC003A279D3740,'2014-09-25 22:32:29'),
+(14,'1531 Sal Drive','','Esfahan',162,'53628','648856936185',0x000000000101000000DE0951195AD64940635A400D84534040,'2014-09-25 22:31:36'),
+(15,'1542 Tarlac Parkway','','Kanagawa',440,'1027','635297277345',0x000000000101000000B4CDE8A27C6B61406B7D361724C74140,'2014-09-25 22:31:53'),
+(16,'808 Bhopal Manor','','Haryana',582,'10672','465887807014',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:30'),
+(17,'270 Amroha Parkway','','Osmaniye',384,'29610','695479687538',0x0000000001010000001F436C55B71F4240A11408967E894240,'2014-09-25 22:33:27'),
+(18,'770 Bydgoszcz Avenue','','California',120,'16266','517338314235',0x0000000001010000006D63A2F7FC515EC04C040539835A4340,'2014-09-25 22:33:47'),
+(19,'419 Iligan Lane','','Madhya Pradesh',76,'72878','990911107354',0x000000000101000000B7B01303C9595340E6F10FB633413740,'2014-09-25 22:31:13'),
+(20,'360 Toulouse Parkway','','England',495,'54308','949312333307',0x000000000101000000860FDBCCD7DBE63FFDCFAB4BD7C44940,'2014-09-25 22:33:40'),
+(21,'270 Toulon Boulevard','','Kalmykia',156,'81766','407752414682',0x000000000101000000FD0BA947BF204640316D495865274740,'2014-09-25 22:32:48'),
+(22,'320 Brest Avenue','','Kaduna',252,'43331','747791594069',0x0000000001010000006D3425FECDC01D40623FD532630B2540,'2014-09-25 22:32:25'),
+(23,'1417 Lancaster Avenue','','Northern Cape',267,'72192','272572357893',0x000000000101000000FEE8E5C127C338404DED56E075BB3CC0,'2014-09-25 22:33:03'),
+(24,'1688 Okara Way','','Nothwest Border Prov',327,'21954','144453869132',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:30'),
+(25,'262 A Corua (La Corua) Parkway','','Dhaka',525,'34418','892775750063',0x000000000101000000F13790E4A87A5640E7F6370DF63F3840,'2014-09-25 22:30:12'),
+(26,'28 Charlotte Amalie Street','','Rabat-Sal-Zammour-Z',443,'37551','161968374323',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:16'),
+(27,'1780 Hino Boulevard','','Liepaja',303,'7716','902731229323',0x000000000101000000360F1604450435403CA3AD4A22424C40,'2014-09-25 22:31:58'),
+(28,'96 Tafuna Way','','Crdoba',128,'99865','934730187245',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:05'),
+(29,'934 San Felipe de Puerto Plata Street','','Sind',472,'99780','196495945706',0x0000000001010000008E6B8D52D3285140D58E876302F53B40,'2014-09-25 22:32:31'),
+(30,'18 Duisburg Boulevard','','',121,'58327','998009777982',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:08'),
+(31,'217 Botshabelo Place','','Southern Mindanao',138,'49521','665356572025',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:36'),
+(32,'1425 Shikarpur Manor','','Bihar',346,'65599','678220867005',0x0000000001010000007F9F16284E9E55408201840F25603940,'2014-09-25 22:31:20'),
+(33,'786 Aurora Avenue','','Yamaguchi',474,'65750','18461860151',0x000000000101000000E712584AA05E6040D15735ADB9FA4040,'2014-09-25 22:31:53'),
+(34,'1668 Anpolis Street','','Taipei',316,'50199','525255540978',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:15'),
+(35,'33 Gorontalo Way','','West Bengali',257,'30348','745994947458',0x0000000001010000001A828879FB17564061585936CEAB3640,'2014-09-25 22:31:18'),
+(36,'176 Mandaluyong Place','','Uttar Pradesh',239,'65213','627705991774',0x00000000010100000073309B0043A553409E3AA0B657743940,'2014-09-25 22:31:17'),
+(37,'127 Purnea (Purnia) Manor','','Piemonte',17,'79388','911872220378',0x0000000001010000002A2B97D75B382140F2892B1D62744640,'2014-09-25 22:31:42'),
+(38,'61 Tama Street','','Okayama',284,'94065','708403338270',0x0000000001010000001F7013A488B86040670696C8AA4A4140,'2014-09-25 22:31:49'),
+(39,'391 Callao Drive','','Midi-Pyrnes',544,'34021','440512153169',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:01'),
+(40,'334 Munger (Monghyr) Lane','','Markazi',31,'38145','481183273622',0x000000000101000000737275B636D848404B958334BE0B4140,'2014-09-25 22:31:36'),
+(41,'1440 Fukuyama Loop','','Henan',362,'47929','912257250465',0x0000000001010000005E3CCD1319225C405886DD1C537F4040,'2014-09-25 22:30:40'),
+(42,'269 Cam Ranh Parkway','','Chisinau',115,'34689','489783829737',0x000000000101000000AD97F0958ADB3C40CCD47F31B6804740,'2014-09-25 22:32:15'),
+(43,'306 Antofagasta Place','','Esprito Santo',569,'3989','378318851631',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:23'),
+(44,'671 Graz Street','','Oriental',353,'94399','680768868518',0x00000000010100000083F7FAFFDD7707C0F7B7BA5285954140,'2014-09-25 22:32:16'),
+(45,'42 Brindisi Place','','Yerevan',586,'16744','42384721397',0x000000000101000000281BC528BE4146403BD400EF2E174440,'2014-09-25 22:30:08'),
+(46,'1632 Bislig Avenue','','Nonthaburi',394,'61117','471675840679',0x000000000101000000935C59FDEC1F5940D5D0611976D32B40,'2014-09-25 22:33:20'),
+(47,'1447 Imus Way','','Tahiti',167,'48942','539758313890',0x00000000010100000090CE0A56E6B562C059BB9289008E31C0,'2014-09-25 22:31:02'),
+(48,'1998 Halifax Drive','','Lipetsk',308,'76022','177727722820',0x00000000010100000087985CD60EC943409F1738EA324D4A40,'2014-09-25 22:32:54'),
+(49,'1718 Valencia Street','','Antofagasta',27,'37359','675292816413',0x0000000001010000007E82D5A24F9951C0C46B4DA901A737C0,'2014-09-25 22:30:29'),
+(50,'46 Pjatigorsk Lane','','Moscow (City)',343,'23616','262076994845',0x0000000001010000009C51F355F2C4424002E3CFA6D9DF4B40,'2014-09-25 22:32:55'),
+(51,'686 Garland Manor','','Cear',247,'52535','69493378813',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:19'),
+(52,'909 Garland Manor','','Tatarstan',367,'69367','705800322606',0x000000000101000000376DC66988E949402CA85E6D7BD14B40,'2014-09-25 22:32:55'),
+(53,'725 Isesaki Place','','Mekka',237,'74428','876295323994',0x000000000101000000213361455799434061EB0896D98A3540,'2014-09-25 22:33:00'),
+(54,'115 Hidalgo Parkway','','Khartum',379,'80168','307703950263',0x00000000010100000004503173263D40404D0DD9E5004A2F40,'2014-09-25 22:33:11'),
+(55,'1135 Izumisano Parkway','','California',171,'48150','171822533480',0x0000000001010000009763C3E4D75B5DC0799A2732CE0B4140,'2014-09-25 22:33:50'),
+(56,'939 Probolinggo Loop','','Galicia',1,'4166','680428310138',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:08'),
+(57,'17 Kabul Boulevard','','Chiba',355,'38594','697760867968',0x000000000101000000EB257CA5E27C61406F70D86C9BED4140,'2014-09-25 22:31:51'),
+(58,'1964 Allappuzha (Alleppey) Street','','Yamaguchi',227,'48980','920811325222',0x000000000101000000C2572A5E1B876040D19A7A38DC144140,'2014-09-25 22:31:47'),
+(59,'1697 Kowloon and New Kowloon Loop','','Moskova',49,'57807','499352017190',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:47'),
+(60,'1668 Saint Louis Place','','Tahiti',397,'39072','347487831378',0x0000000001010000006FF3C64921B262C0F8F47DDD8E8931C0,'2014-09-25 22:31:02'),
+(61,'943 Tokat Street','','Vaduz',560,'45428','889318963672',0x0000000001010000007F784C93080B23400341800C1D924740,'2014-09-25 22:31:58'),
+(62,'1114 Liepaja Street','','Sarawak',282,'69226','212869228936',0x000000000101000000047FAE6C55955B408285DDC199E9F83F,'2014-09-25 22:32:00'),
+(63,'1213 Ranchi Parkway','','Karnataka',350,'94352','800024380485',0x000000000101000000000080279AD7C641AA21BB1CC0202B40,'2014-09-25 22:31:21'),
+(64,'81 Hodeida Way','','Rajasthan',231,'55561','250767749542',0x0000000001010000000A09BDA36BF25240F8B138526CEB3A40,'2014-09-25 22:31:17'),
+(65,'915 Ponce Place','','Basel-Stadt',56,'83980','1395251317',0x0000000001010000000D6146C2084B1E40E58B07A579C74740,'2014-09-25 22:33:12'),
+(66,'1717 Guadalajara Lane','','Missouri',441,'85505','914090181665',0x000000000101000000A926D247AA8C56C0A456F3774A504340,'2014-09-25 22:33:59'),
+(67,'1214 Hanoi Way','','Nebraska',306,'67055','491001136577',0x000000000101000000D6671888AF2A58C0C0E2152DE5684440,'2014-09-25 22:33:56'),
+(68,'1966 Amroha Avenue','','Sichuan',139,'70385','333489324603',0x0000000001010000000A7778190FE05A402F6013E346373F40,'2014-09-25 22:30:32'),
+(69,'698 Otsu Street','','Cayenne',105,'71110','409983924481',0x000000000101000000D879C0E1AA2A4AC0D57EC6E0BCBB1340,'2014-09-25 22:31:02'),
+(70,'1150 Kimchon Manor','','Skne ln',321,'96109','663449333709',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:11'),
+(71,'1586 Guaruj Place','','Hunan',579,'5135','947233365992',0x000000000101000000AD3A06BFE83F5C4083047B0217DA3B40,'2014-09-25 22:30:46'),
+(72,'57 Arlington Manor','','Madhya Pradesh',475,'48960','990214419142',0x0000000001010000008E6D63FDB069534027D9EA724A6E3940,'2014-09-25 22:31:27'),
+(73,'1031 Daugavpils Parkway','','Bchar',63,'59025','107137400143',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:29:59'),
+(74,'1124 Buenaventura Drive','','Mekka',13,'6856','407733804223',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:59'),
+(75,'492 Cam Ranh Street','','Eastern Visayas',61,'50805','565018274456',0x0000000001010000007500C45D3D335F40B90265AE675B2540,'2014-09-25 22:32:34'),
+(76,'89 Allappuzha (Alleppey) Manor','','National Capital Reg',517,'75444','255800440636',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:39'),
+(77,'1947 Poos de Caldas Boulevard','','Chiayi',114,'60951','427454485876',0x0000000001010000002F06C54524195E40B4475E8C37763740,'2014-09-25 22:33:14'),
+(78,'1206 Dos Quebradas Place','','So Paulo',431,'20207','241832790687',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:21'),
+(79,'1551 Rampur Lane','','Changhwa',108,'72394','251164340471',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:14'),
+(80,'602 Paarl Street','','Pavlodar',402,'98889','896314772871',0x000000000101000000359078C34740534032D010E912234A40,'2014-09-25 22:31:55'),
+(81,'1692 Ede Loop','','So Paulo',30,'9223','918711376618',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:16'),
+(82,'936 Salzburg Lane','','Uttar Pradesh',425,'96709','875756771675',0x0000000001010000000C0EE5FAAD4F5440CBF8F71917383A40,'2014-09-25 22:31:24'),
+(83,'586 Tete Way','','Kanagawa',256,'1079','18581624103',0x000000000101000000783B0CF79B716140E96D22E989A74140,'2014-09-25 22:31:48'),
+(84,'1888 Kabul Drive','','Oyo & Osun',217,'20936','701457319790',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:24'),
+(85,'320 Baiyin Parkway','','Mahajanga',319,'37307','223664661973',0x000000000101000000EAFD90C888284740CDC75AE8EF6E2FC0,'2014-09-25 22:31:59'),
+(86,'927 Baha Blanca Parkway','','Krim',479,'9495','821972242086',0x000000000101000000417DCB9C2E0E4140BC29406F857A4640,'2014-09-25 22:33:33'),
+(87,'929 Tallahassee Loop','','Gauteng',497,'74671','800716535041',0x000000000101000000647F8FB05E6B3C407F60D8ABD9403AC0,'2014-09-25 22:33:06'),
+(88,'125 Citt del Vaticano Boulevard','','Puebla',40,'67912','48417642933',0x000000000101000000536232B0E99B58C03D0D18247DE83240,'2014-09-25 22:32:02'),
+(89,'1557 Ktahya Boulevard','','England',88,'88002','720998247660',0x0000000001010000001B43A5B67908FCBF439D03159FE54A40,'2014-09-25 22:33:36'),
+(90,'870 Ashqelon Loop','','Songkhla',489,'84931','135117278909',0x000000000101000000E82510C017265940115A6A1899CB1C40,'2014-09-25 22:33:20'),
+(91,'1740 Portoviejo Avenue','','Sucre',480,'29932','198123170793',0x000000000101000000C4AD275F75D952C07A51BB5F059C2240,'2014-09-25 22:30:53'),
+(92,'1942 Ciparay Parkway','','Cheju',113,'82624','978987363654',0x00000000010100000048F13B97F3A25F40358EA2186AB34040,'2014-09-25 22:33:06'),
+(93,'1926 El Alto Avenue','','Buenos Aires',289,'75543','846225459260',0x000000000101000000AD05AC0B2EFA4CC0C5D0A057F27541C0,'2014-09-25 22:30:05'),
+(94,'1952 Chatsworth Drive','','Guangdong',332,'25958','991562402283',0x000000000101000000A5F386A08F085D406DF65157885A3840,'2014-09-25 22:30:40'),
+(95,'1370 Le Mans Avenue','','Brunei and Muara',53,'52163','345679835036',0x00000000010100000013E85D06ADBC5C402A0E5652DDC21340,'2014-09-25 22:30:23'),
+(96,'984 Effon-Alaiye Avenue','','Gois',183,'17119','132986892228',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:17'),
+(97,'832 Nakhon Sawan Manor','','Inner Mongolia',592,'49021','275595571388',0x000000000101000000535C55F6DDAD5E400000001D69FABC41,'2014-09-25 22:30:50'),
+(98,'152 Kitwe Parkway','','Caraga',82,'53182','835433605312',0x000000000101000000DF652BD43F945F4006CAB788396E2040,'2014-09-25 22:32:35'),
+(99,'1697 Tanauan Lane','','Punjab',399,'22870','4764773857',0x000000000101000000CA97063447E95240B933B852742A4040,'2014-09-25 22:31:22'),
+(100,'1308 Arecibo Way','','Georgia',41,'30695','6171054059',0x000000000101000000FC00FFEF637E54C0BD9EF9E648BC4040,'2014-09-25 22:33:43'),
+(101,'1599 Plock Drive','','Tete',534,'71986','817248913162',0x000000000101000000DC77561C18CB4040B443577D092830C0,'2014-09-25 22:32:18'),
+(102,'669 Firozabad Loop','','Abu Dhabi',12,'92265','412903167998',0x0000000001010000009C76E73F5AE14B404AD05FE811313840,'2014-09-25 22:33:35'),
+(103,'588 Vila Velha Manor','','Kyongsangbuk',268,'51540','333339908719',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:07'),
+(104,'1913 Kamakura Place','','Lipetsk',238,'97287','942570536750',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:49'),
+(105,'733 Mandaluyong Place','','Asir',2,'77459','196568435814',0x0000000001010000007823980FAD404540798FD89365373240,'2014-09-25 22:32:59'),
+(106,'659 Vaduz Drive','','Ha Darom',34,'49708','709935135487',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:40'),
+(107,'1177 Jelets Way','','Kwara & Kogi',220,'3305','484292626944',0x0000000001010000001767672CF53712407E3E25427E192140,'2014-09-25 22:32:24'),
+(108,'1386 Yangor Avenue','','Provence-Alpes-Cte',543,'80720','449216226468',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:01'),
+(109,'454 Nakhon Sawan Boulevard','','Funafuti',173,'76383','963887147572',0x0000000001010000005822ABB636666640FF74A84B6B0C21C0,'2014-09-25 22:33:31'),
+(110,'1867 San Juan Bautista Tuxtepec Avenue','','Ivanovo',225,'78311','547003310357',0x000000000101000000BC6DF0CF567C4440E2B034F0A37F4C40,'2014-09-25 22:32:48'),
+(111,'1532 Dzerzinsk Way','','Buenos Aires',334,'9599','330838016880',0x000000000101000000BF93BB74385D4DC0E207420D3A5541C0,'2014-09-25 22:30:06'),
+(112,'1002 Ahmadnagar Manor','','Mxico',213,'93026','371490777743',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:07'),
+(113,'682 Junan Way','','North West',273,'30418','622255216127',0x000000000101000000714683CAAEAA3A406AEDC73725DA3AC0,'2014-09-25 22:33:04'),
+(114,'804 Elista Drive','','Hubei',159,'61069','379804592943',0x0000000001010000009E013FF4EE5E5B40E7E099D0245F3E40,'2014-09-25 22:30:33'),
+(115,'1378 Alvorada Avenue','','Distrito Federal',102,'75834','272234298332',0x0000000001010000000C3444BA44B850C047B1378CDDF92440,'2014-09-25 22:34:03'),
+(116,'793 Cam Ranh Avenue','','California',292,'87057','824370924746',0x00000000010100000003AF3B82C0885DC0610212A859594140,'2014-09-25 22:33:55'),
+(117,'1079 Tel Aviv-Jaffa Boulevard','','Sucre',132,'10885','358178933857',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:04'),
+(118,'442 Rae Bareli Place','','Nordrhein-Westfalen',148,'24321','886636413768',0x000000000101000000C19EC085860F1B40E37ED12F5BB74940,'2014-09-25 22:31:04'),
+(119,'1107 Nakhon Sawan Avenue','','Mxico',365,'75149','867546627903',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:11'),
+(120,'544 Malm Parkway','','Central Java',403,'63502','386759646229',0x0000000001010000003AEF5A9D77575B4026F103A106C51BC0,'2014-09-25 22:31:34'),
+(121,'1967 Sincelejo Place','','Gujarat',176,'73644','577812616052',0x00000000010100000059912CBBBB2B52408DBC074378373740,'2014-09-25 22:31:16'),
+(122,'333 Goinia Way','','Texas',185,'78625','909029256431',0x0000000001010000002AE67BA1DB3F58C0E46B2AE67B5F4040,'2014-09-25 22:33:51'),
+(123,'1987 Coacalco de Berriozbal Loop','','al-Qalyubiya',476,'96065','787654415858',0x000000000101000000595AFC5C23403F40AFBA698E07203E40,'2014-09-25 22:30:58'),
+(124,'241 Mosul Lane','','Risaralda',147,'76157','765345144779',0x000000000101000000983A23A5B4EA52C06155BDFC4E5B1340,'2014-09-25 22:30:52'),
+(125,'211 Chiayi Drive','','Uttar Pradesh',164,'58186','665993880048',0x000000000101000000A44BA4D961C1534007F247AC20C73A40,'2014-09-25 22:31:15'),
+(126,'1175 Tanauan Way','','Lima',305,'64615','937222955822',0x000000000101000000848A60D2CE4153C0E5417A8A1C1628C0,'2014-09-25 22:32:33'),
+(127,'117 Boa Vista Way','','Uttar Pradesh',566,'6804','677976133614',0x00000000010100000085364AA8AAC0544086BAFE1312513940,'2014-09-25 22:31:29'),
+(128,'848 Tafuna Manor','','Ktahya',281,'45142','614935229095',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:27'),
+(129,'569 Baicheng Lane','','Gauteng',85,'60304','490211944645',0x000000000101000000D71E51FC73423C4048AE51C543363AC0,'2014-09-25 22:33:02'),
+(130,'1666 Qomsheh Drive','','So Paulo',410,'66255','582835362905',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:20'),
+(131,'801 Hagonoy Drive','','Smolensk',484,'8439','237426099212',0x0000000001010000001EB814A122054040BB8509FE12644B40,'2014-09-25 22:32:57'),
+(132,'1050 Garden Grove Avenue','','Slaskie',236,'4999','973047364353',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:42'),
+(133,'1854 Tieli Street','','Shandong',302,'15819','509492324775',0x0000000001010000007A820E0492FE5C408F0475255D3A4240,'2014-09-25 22:30:39'),
+(134,'758 Junan Lane','','Gois',190,'82639','935448624185',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:18'),
+(135,'1752 So Leopoldo Parkway','','Taka-Karpatia',345,'14014','252265130067',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:32'),
+(136,'898 Belm Manor','','Free State',87,'49757','707169393853',0x000000000101000000ED4CFCAC8DB43A409EAC623B29453DC0,'2014-09-25 22:33:02'),
+(137,'261 Saint Louis Way','','Coahuila de Zaragoza',541,'83401','321944036800',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:13'),
+(138,'765 Southampton Drive','','al-Qalyubiya',421,'4285','23712411567',0x0000000001010000001BEB877DA7343F409FBC7E77E12D3E40,'2014-09-25 22:30:57'),
+(139,'943 Johannesburg Avenue','','Maharashtra',417,'5892','90921003005',0x000000000101000000F27A3029BE7652405E2ADB2C03853240,'2014-09-25 22:31:24'),
+(140,'788 Atinsk Street','','Karnataka',211,'81691','146497509724',0x0000000001010000000000801B1998C64157A945E977E62E40,'2014-09-25 22:31:17'),
+(141,'1749 Daxian Place','','Gelderland',29,'11044','963369996279',0x000000000101000000E4CE96BDB6E0174000B0952B171C4A40,'2014-09-25 22:32:20'),
+(142,'1587 Sullana Lane','','Inner Mongolia',207,'85769','468060467018',0x000000000101000000870CF505BEE95B407422669BC0674440,'2014-09-25 22:30:35'),
+(143,'1029 Dzerzinsk Manor','','Ynlin',542,'57519','33173584456',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:16'),
+(144,'1666 Beni-Mellal Place','','Tennessee',123,'13377','9099941466',0x00000000010100000005D1A45E01D755C084CCDFCECF434240,'2014-09-25 22:33:48'),
+(145,'928 Jaffna Loop','','Hiroshima',172,'93762','581852137991',0x0000000001010000002F2988CBBBAB6040E2FF33EFDD3D4140,'2014-09-25 22:31:45'),
+(146,'483 Ljubertsy Parkway','','Scotland',149,'60562','581174211853',0x000000000101000000C53E5CCD95CC07C0FAFD518A0C3C4C40,'2014-09-25 22:33:36'),
+(147,'374 Bat Yam Boulevard','','Kilis',266,'97700','923261616249',0x000000000101000000184FF344C68E4240FD55DBA8A95B4240,'2014-09-25 22:33:26'),
+(148,'1027 Songkhla Manor','','Minsk',340,'30861','563660187896',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:13'),
+(149,'999 Sanaa Loop','','Gauteng',491,'3439','918032330119',0x0000000001010000000E0D309864193C40F234AA1D0F7939C0,'2014-09-25 22:33:05'),
+(150,'879 Newcastle Way','','Michigan',499,'90732','206841104594',0x000000000101000000916A8E62EFC154C08244C99A474A4540,'2014-09-25 22:34:01'),
+(151,'1337 Lincoln Parkway','','Saitama',555,'99457','597815221267',0x0000000001010000005E0E6036A6746140456227614BEE4140,'2014-09-25 22:31:55'),
+(152,'1952 Pune Lane','','Saint-Denis',442,'92150','354615066969',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:46'),
+(153,'782 Mosul Street','','Massachusetts',94,'25545','885899703621',0x000000000101000000E9C4D44C2DC151C0D1686105AE0A4540,'2014-09-25 22:33:46'),
+(154,'781 Shimonoseki Drive','','Michoacn de Ocampo',202,'95444','632316273199',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:06'),
+(155,'1560 Jelets Boulevard','','Shandong',291,'77777','189446090264',0x00000000010100000018D57D5B0B6A5D40ADDA3521AD184240,'2014-09-25 22:30:38'),
+(156,'1963 Moscow Place','','Assam',354,'64863','761379480249',0x000000000101000000203BB9F04D2C57405D595826B2593A40,'2014-09-25 22:31:21'),
+(157,'456 Escobar Way','','Jakarta Raya',232,'36061','719202533520',0x000000000101000000DDC2A9C516B65A4095CCFB49C6DB18C0,'2014-09-25 22:31:33'),
+(158,'798 Cianjur Avenue','','Shanxi',590,'76990','499408708580',0x00000000010100000013D6C6D889BF5B409B4BBBE2F3824140,'2014-09-25 22:30:49'),
+(159,'185 Novi Sad Place','','Bern',72,'41778','904253967161',0x00000000010100000000D0BC772FCA1D40377D2C335B794740,'2014-09-25 22:33:13'),
+(160,'1367 Yantai Manor','','Ondo & Ekiti',381,'21294','889538496300',0x000000000101000000C25E72ED555514408A7A1C61ACAA1C40,'2014-09-25 22:32:26'),
+(161,'1386 Nakhon Sawan Boulevard','','Pyongyang-si',420,'53502','368899174225',0x000000000101000000F4BA8FED46705F40A55F6C6B55844340,'2014-09-25 22:32:28'),
+(162,'369 Papeete Way','','North Carolina',187,'66639','170117068815',0x000000000101000000C49D66DCAFF253C07A2D324B4C094240,'2014-09-25 22:33:52'),
+(163,'1440 Compton Place','','North Austria',307,'81037','931059836497',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:10'),
+(164,'1623 Baha Blanca Manor','','Moskova',310,'81511','149981248346',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:54'),
+(165,'97 Shimoga Avenue','','Tel Aviv',533,'44660','177167004331',0x0000000001010000009A56AFC7E96341403192E2885A0A4040,'2014-09-25 22:31:41'),
+(166,'1740 Le Mans Loop','','Pays de la Loire',297,'22853','168476538960',0x000000000101000000452A8C2D04B9D23F0000006AB82DBD41,'2014-09-25 22:31:01'),
+(167,'1287 Xiangfan Boulevard','','Gifu',253,'57844','819416131190',0x0000000001010000006AE514D3BB1B61408141D2A755B54140,'2014-09-25 22:31:48'),
+(168,'842 Salzburg Lane','','Adana',529,'3313','697151428760',0x0000000001010000007207A0072DD5414093228D6555A64240,'2014-09-25 22:33:29'),
+(169,'154 Tallahassee Loop','','Xinxiang',199,'62250','935508855935',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:34'),
+(170,'710 San Felipe del Progreso Avenue','','Lilongwe',304,'76901','843801144113',0x00000000010100000089C855D1C4E44040501D064E11EF2BC0,'2014-09-25 22:31:59'),
+(171,'1540 Wroclaw Drive','','Maharashtra',107,'62686','182363341674',0x0000000001010000004E10D0D8F2D253407CFB294476F23340,'2014-09-25 22:31:14'),
+(172,'475 Atinsk Way','','Gansu',240,'59571','201705577290',0x0000000001010000007872970E678C59405544978114404340,'2014-09-25 22:30:36'),
+(173,'1294 Firozabad Drive','','Jiangxi',407,'70618','161801569569',0x000000000101000000EED7F8A7AF775C402332079C00943B40,'2014-09-25 22:30:40'),
+(174,'1877 Ezhou Lane','','Rajasthan',550,'63337','264541743403',0x00000000010100000029722DFF466C52401969F34938923840,'2014-09-25 22:31:28'),
+(175,'316 Uruapan Street','','Perak',223,'58194','275788967899',0x0000000001010000005A3629BB4F4559400AC5B18927561240,'2014-09-25 22:31:59'),
+(176,'29 Pyongyang Loop','','Batman',58,'47753','734780743462',0x0000000001010000001C430070EC9044403C8963B895F14240,'2014-09-25 22:33:23'),
+(177,'1010 Klerksdorp Way','','Steiermark',186,'6802','493008546874',0x000000000101000000CFEE35A90DE72E409C0425BB88884740,'2014-09-25 22:30:10'),
+(178,'1848 Salala Boulevard','','Miranda',373,'25220','48265851133',0x0000000001010000006D08E984ABB150C02F90FBB1A43B2440,'2014-09-25 22:34:04'),
+(179,'431 Xiangtan Avenue','','Kerala',18,'4854','230250973122',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:10'),
+(180,'757 Rustenburg Avenue','','Skikda',483,'89668','506134035434',0x000000000101000000BFD76BD509A31B4063867C8626704240,'2014-09-25 22:30:01'),
+(181,'146 Johannesburg Way','','Tamaulipas',330,'54132','953689007081',0x0000000001010000003C45B357446058C0EAD621ED35E13940,'2014-09-25 22:32:09'),
+(182,'1891 Rizhao Boulevard','','So Paulo',456,'47288','391065549876',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:21'),
+(183,'1089 Iwatsuki Avenue','','Kirov',270,'35109','866092335135',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:50'),
+(184,'1410 Benin City Parkway','','Risaralda',405,'29747','104150372603',0x0000000001010000007C4F9B278DEC52C0795BE9B5D9401340,'2014-09-25 22:30:52'),
+(185,'682 Garden Grove Place','','Tennessee',333,'67497','72136330362',0x0000000001010000004204C188228356C06B4F24F323934140,'2014-09-25 22:33:57'),
+(186,'533 al-Ayn Boulevard','','California',126,'8862','662227486184',0x000000000101000000BF2264C5158E5DC08533AE6EABF24040,'2014-09-25 22:33:48'),
+(187,'1839 Szkesfehrvr Parkway','','Gois',317,'55709','947468818183',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:20'),
+(188,'741 Ambattur Manor','','Noord-Brabant',438,'43310','302590383819',0x000000000101000000699E6D7F78371540EF0D74A37ED94940,'2014-09-25 22:32:21'),
+(189,'927 Barcelona Street','','Chaharmahal va Bakht',467,'65121','951486492670',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:38'),
+(190,'435 0 Way','','West Bengali',195,'74750','760171523969',0x000000000101000000D9846A3906075640037168DB7A0F3640,'2014-09-25 22:31:16'),
+(191,'140 Chiayi Parkway','','Sumy',506,'38982','855863906434',0x0000000001010000002C43C1317066414051BB5F05F8754940,'2014-09-25 22:33:34'),
+(192,'1166 Changhwa Street','','Caraga',62,'58852','650752094490',0x0000000001010000009DB756201F715F40F53E9F1221832140,'2014-09-25 22:32:34'),
+(193,'891 Novi Sad Manor','','Ontario',383,'5379','247646995453',0x0000000001010000005E49F25C5FB653C0DE6AE74537F34540,'2014-09-25 22:30:28'),
+(194,'605 Rio Claro Parkway','','Tabora',513,'49348','352469351088',0x0000000001010000004E8B0B51CF694040DF67017F9D1014C0,'2014-09-25 22:33:18'),
+(195,'1077 San Felipe de Puerto Plata Place','','Rostov-na-Donu',369,'65387','812824036424',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:56'),
+(196,'9 San Miguel de Tucumn Manor','','Uttar Pradesh',169,'90845','956188728558',0x00000000010100000067DBC424B7995340A461E75C40263B40,'2014-09-25 22:31:15'),
+(197,'447 Surakarta Loop','','Nyanza',271,'10428','940830176580',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:56'),
+(198,'345 Oshawa Boulevard','','Tokyo-to',204,'32114','104491201771',0x000000000101000000FB5E9E29CF6C61404BFCF61A27D64140,'2014-09-25 22:31:45'),
+(199,'1792 Valle de la Pascua Place','','Nordrhein-Westfalen',477,'15540','419419591240',0x000000000101000000E9BD8CBD720C204056725F18FA6F4940,'2014-09-25 22:31:06'),
+(200,'1074 Binzhou Manor','','Baden-Wrttemberg',325,'36490','331132568928',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:05'),
+(201,'817 Bradford Loop','','Jiangsu',109,'89459','264286442804',0x000000000101000000C3E1BB830EFD5D4006B243A10AC63F40,'2014-09-25 22:30:31'),
+(202,'955 Bamenda Way','','Ondo & Ekiti',218,'1545','768481779568',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:24'),
+(203,'1149 A Corua (La Corua) Boulevard','','Haiphong',194,'95824','470884141195',0x0000000001010000007573F1B7BDAB5A4050A0997164DD3440,'2014-09-25 22:34:06'),
+(204,'387 Mwene-Ditu Drive','','Ahal',35,'8073','764477681869',0x000000000101000000B0253F3D11314D40A538A2D68FFA4240,'2014-09-25 22:33:30'),
+(205,'68 Molodetno Manor','','Nordrhein-Westfalen',575,'4662','146640639760',0x000000000101000000EEF3739E0C691D40FE486CD2C8B84940,'2014-09-25 22:31:06'),
+(206,'642 Nador Drive','','Maharashtra',77,'3924','369050085652',0x000000000101000000559D7A4908F25240E010AAD4EC0B3540,'2014-09-25 22:31:13'),
+(207,'1688 Nador Lane','','Sulawesi Utara',184,'61613','652218196731',0x000000000101000000E358727044945E4093F139C148B9E83F,'2014-09-25 22:31:32'),
+(208,'1215 Pyongyang Parkway','','Usak',557,'25238','646237101779',0x000000000101000000019E59B7E6673D40735E08DE35564340,'2014-09-25 22:33:30'),
+(209,'1679 Antofagasta Street','','Alto Paran',122,'86599','905903574913',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:32'),
+(210,'1304 s-Hertogenbosch Way','','Santa Catarina',83,'10925','90336226227',0x000000000101000000BDEAB765768848C05755D40561EB3AC0,'2014-09-25 22:30:16'),
+(211,'850 Salala Loop','','Kitaa',371,'10800','403404780639',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:07'),
+(212,'624 Oshawa Boulevard','','West Bengali',51,'89959','49677664184',0x0000000001010000000FBCB5A7BF315640EA7CD34F93383940,'2014-09-25 22:31:11'),
+(213,'43 Dadu Avenue','','Rajasthan',74,'4855','95666951770',0x000000000101000000BCF957A0A7A852404046E5CBB0583940,'2014-09-25 22:31:12'),
+(214,'751 Lima Loop','','Aden',7,'99405','756460337785',0x0000000001010000005ECF21BAB1844640A9007388138F2940,'2014-09-25 22:34:08'),
+(215,'1333 Haldia Street','','Jilin',174,'82161','408304391718',0x00000000010100000007A51E5844345F404CE71E6D77974640,'2014-09-25 22:30:33'),
+(216,'660 Jedda Boulevard','','Washington',65,'25053','168758068397',0x00000000010100000009EEF60FD88C5EC03C331C2A21CE4740,'2014-09-25 22:33:45'),
+(217,'1001 Miyakonojo Lane','','Taizz',518,'67924','584316724815',0x0000000001010000006642DD51AD024640782C1103B8282B40,'2014-09-25 22:34:11'),
+(218,'226 Brest Manor','','California',508,'2299','785881412500',0x000000000101000000CF9F36AA53825EC0B54D96FF35AF4240,'2014-09-25 22:34:02'),
+(219,'1229 Valencia Parkway','','Haskovo',498,'99124','352679173732',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:24'),
+(220,'1201 Qomsheh Manor','','Gois',28,'21464','873492228462',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:15'),
+(221,'866 Shivapuri Manor','','Uttar Pradesh',448,'22474','778502731092',0x000000000101000000940BDF0C48A4534072648ADE4E953C40,'2014-09-25 22:31:26'),
+(222,'1168 Najafabad Parkway','','Kabol',251,'40301','886649065861',0x0000000001010000009173AC9C074B51408EBDCDD199434140,'2014-09-25 22:29:59'),
+(223,'1244 Allappuzha (Alleppey) Place','','Buenos Aires',567,'20657','991802825778',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:08'),
+(224,'1842 Luzinia Boulevard','','Zanzibar West',593,'94420','706878974831',0x00000000010100000045E169E855994340B62C5F97E1A718C0,'2014-09-25 22:33:19'),
+(225,'1926 Gingoog Street','','Sisilia',511,'22824','469738825391',0x0000000001010000004DD9E907758D2E40719AF4ADC58A4240,'2014-09-25 22:31:44'),
+(226,'810 Palghat (Palakkad) Boulevard','','Jaroslavl',235,'73431','516331171356',0x00000000010100000069D48DC1D4EF43400294D0A79FD04C40,'2014-09-25 22:32:49'),
+(227,'1820 Maring Parkway','','Punjab',324,'88307','99760893676',0x0000000001010000001E053EF5FE5E52406C617193AC4A4040,'2014-09-25 22:32:30'),
+(228,'60 Poos de Caldas Street','','Rajasthan',243,'82338','963063788669',0x00000000010100000069EED7536140524079605B9AB6443A40,'2014-09-25 22:31:18'),
+(229,'1014 Loja Manor','','Tamil Nadu',22,'66851','460795526514',0x000000000101000000803E366E560A5440A1212DDF44322A40,'2014-09-25 22:31:10'),
+(230,'201 Effon-Alaiye Way','','Asuncin',37,'64344','684192903087',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:31'),
+(231,'430 Alessandria Loop','','Saarland',439,'47446','669828224459',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:06'),
+(232,'754 Valencia Place','','Phnom Penh',406,'87911','594319417514',0x0000000001010000009093D3E89F3A5A40AACCDE63FA1F2740,'2014-09-25 22:30:25'),
+(233,'356 Olomouc Manor','','Gois',26,'93323','22326410776',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:15'),
+(234,'1256 Bislig Boulevard','','Botosani',86,'50598','479007229460',0x00000000010100000085059C4AABAA3A408DAC46C032E04740,'2014-09-25 22:32:46'),
+(235,'954 Kimchon Place','','West Bengali',559,'42420','541327526474',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:28'),
+(236,'885 Yingkou Manor','','Kaduna',596,'31390','588964509072',0x00000000010100000006CF296D16E41E4038E3EAB6FA382640,'2014-09-25 22:32:28'),
+(237,'1736 Cavite Place','','Qina',216,'98775','431770603551',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:56'),
+(238,'346 Skikda Parkway','','Hawalli',233,'90628','630424482919',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:57'),
+(239,'98 Stara Zagora Boulevard','','Valle',96,'76448','610173756082',0x00000000010100000084CD4AA4FE4153C0DB9953138E0A0F40,'2014-09-25 22:30:51'),
+(240,'1479 Rustenburg Boulevard','','Southern Tagalog',527,'18727','727785483194',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:40'),
+(241,'647 A Corua (La Corua) Street','','Chollanam',357,'36971','792557457753',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:07'),
+(242,'1964 Gijn Manor','','Karnataka',473,'14408','918119601885',0x000000000101000000BBC3DCA458E45240DA4246F6F7DC2B40,'2014-09-25 22:31:26'),
+(243,'47 Syktyvkar Lane','','West Java',118,'22236','63937119031',0x000000000101000000EDABBC2E8DB05A40C3C1397E037E1AC0,'2014-09-25 22:31:31'),
+(244,'1148 Saarbrcken Parkway','','Fukushima',226,'1921','137773001988',0x000000000101000000AD8ACB4C449C614053F8229001874240,'2014-09-25 22:31:47'),
+(245,'1103 Bilbays Parkway','','Hubei',578,'87660','279979529227',0x000000000101000000A76ED34444095C401234C1CB67054040,'2014-09-25 22:30:45'),
+(246,'1246 Boksburg Parkway','','Hebei',422,'28349','890283544295',0x000000000101000000B66A323EA7E55D40E508BE0E41F74340,'2014-09-25 22:30:41'),
+(247,'1483 Pathankot Street','','Tucumn',454,'37288','686015532180',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:06'),
+(248,'582 Papeete Loop','','Central Visayas',294,'27722','569868543137',0x0000000001010000001F189BB1C3FC5E407DC4F9E5DD9E2440,'2014-09-25 22:32:38'),
+(249,'300 Junan Street','','Kyonggi',553,'81314','890289150158',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:08'),
+(250,'829 Grand Prairie Way','','Paran',328,'6461','741070712873',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:20'),
+(251,'1473 Changhwa Parkway','','Mxico',124,'75933','266798132374',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:03'),
+(252,'1309 Weifang Street','','Florida',520,'57338','435785045362',0x000000000101000000EC0CF8A1F71155C0995A006432703E40,'2014-09-25 22:34:02'),
+(253,'1760 Oshawa Manor','','Tianjin',535,'38140','56257502250',0x000000000101000000FBBD5EAB4E4B5D40EB0A6C8434924340,'2014-09-25 22:30:43'),
+(254,'786 Stara Zagora Way','','Oyo & Osun',390,'98332','716256596301',0x000000000101000000DB45E22F77770F4073C8BC44AB691F40,'2014-09-25 22:32:27'),
+(255,'1966 Tonghae Street','','Anhalt Sachsen',198,'36481','567359279425',0x0000000001010000000000009825D59D41450A0A2879C84940,'2014-09-25 22:31:05'),
+(256,'1497 Yuzhou Drive','','England',312,'3433','246810237916',0x000000000101000000CC4642B68718C0BFCA822E8617C14940,'2014-09-25 22:33:37'),
+(258,'752 Ondo Loop','','Miyazaki',338,'32474','134673576619',0x00000000010100000048AD8B36226260408871EDFABBBB3F40,'2014-09-25 22:31:50'),
+(259,'1338 Zalantun Lane','','Minas Gerais',413,'45403','840522972766',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:21'),
+(260,'127 Iwakuni Boulevard','','Central Luzon',192,'20777','987442542471',0x0000000001010000000E6954E0E42E5E40AF05627E13AB2D40,'2014-09-25 22:32:37'),
+(261,'51 Laredo Avenue','','Sagaing',342,'68146','884536620568',0x0000000001010000008720BD97B1C85740D4D7F335CB1B3640,'2014-09-25 22:32:18'),
+(262,'771 Yaound Manor','','Sofala',64,'86768','245477603573',0x000000000101000000103345CA606B414046CB2665F7D733C0,'2014-09-25 22:32:17'),
+(263,'532 Toulon Street','','Santiago',460,'69517','46871694740',0x000000000101000000ECD33B269CAC51C09AB67F65A5733340,'2014-09-25 22:30:55'),
+(264,'1027 Banjul Place','','West Bengali',197,'50390','538241037443',0x000000000101000000FE14223BCA1A5640AC6F6072A3EE3640,'2014-09-25 22:31:16'),
+(265,'1158 Mandi Bahauddin Parkway','','Shanxi',136,'98484','276555730211',0x000000000101000000ECC84741A6525C40A93C7084FB0B4440,'2014-09-25 22:30:32'),
+(266,'862 Xintai Lane','','Cagayan Valley',548,'30065','265153400632',0x00000000010100000015580053866E5E408A5CCBBFF19C3140,'2014-09-25 22:32:41'),
+(267,'816 Cayenne Parkway','','Manab',414,'93629','282874611748',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:56'),
+(268,'1831 Nam Dinh Loop','','National Capital Reg',323,'51990','322888976727',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:38'),
+(269,'446 Kirovo-Tepetsk Lane','','Osaka',203,'19428','303967439816',0x0000000001010000008D94D2D8C3F36040608CED5AE7554140,'2014-09-25 22:31:45'),
+(270,'682 Halisahar Place','','Severn Morava',378,'20536','475553436330',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:54'),
+(271,'1587 Loja Manor','','Salzburg',447,'5410','621625204422',0x0000000001010000002C83C53C86162A405886DD1C53E64740,'2014-09-25 22:30:10'),
+(272,'1762 Paarl Parkway','','Hunan',298,'53928','192459639410',0x00000000010100000067333D177CDB5B40DBA8A9C024B03B40,'2014-09-25 22:30:39'),
+(273,'1519 Ilorin Place','','Kerala',395,'49298','357445645426',0x0000000001010000000C4FF921002A5340BD772F52838C2540,'2014-09-25 22:31:21'),
+(274,'920 Kumbakonam Loop','','California',446,'75090','685010736240',0x00000000010100000012EF4ADCF4695EC01B95E535C0564240,'2014-09-25 22:34:00'),
+(275,'906 Goinia Way','','Wielkopolskie',255,'83565','701767622697',0x0000000001010000007FA2B2614D1732404064366D6BE14940,'2014-09-25 22:32:42'),
+(276,'1675 Xiangfan Manor','','Tamil Nadu',283,'11763','271149517630',0x00000000010100000042B687180AD95340EE4108C897EC2540,'2014-09-25 22:31:20'),
+(277,'85 San Felipe de Puerto Plata Drive','','Shandong',584,'46063','170739645687',0x000000000101000000EA605859365C5E40EF1010DDFDBC4240,'2014-09-25 22:30:48'),
+(278,'144 South Hill Loop','','Guanajuato',445,'2012','45387294817',0x0000000001010000002B84D558424C59C0699B2CFF6B923440,'2014-09-25 22:32:11'),
+(279,'1884 Shikarpur Avenue','','Haryana',263,'85548','959949395183',0x0000000001010000002CE395DA413F5340EB460EC7A9B03D40,'2014-09-25 22:31:19'),
+(280,'1980 Kamjanets-Podilskyi Street','','Illinois',404,'89502','874337098891',0x000000000101000000167CE420B26556C0B7966EB7C9584440,'2014-09-25 22:33:57'),
+(281,'1944 Bamenda Way','','Michigan',573,'24645','75975221996',0x000000000101000000B8B64B76C7C154C0EF254344203D4540,'2014-09-25 22:34:03'),
+(282,'556 Baybay Manor','','Oyo & Osun',374,'55802','363982224739',0x000000000101000000F5C6FFD3C30E1140FC30E7BE41502040,'2014-09-25 22:32:25'),
+(283,'457 Tongliao Loop','','Bursa',222,'56254','880756161823',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:25'),
+(284,'600 Bradford Street','','East Azerbaidzan',514,'96204','117592274996',0x000000000101000000EE4E2D115E25474044FF5FD09D0A4340,'2014-09-25 22:31:40'),
+(285,'1006 Santa Brbara dOeste Manor','','Ondo & Ekiti',389,'36229','85059738746',0x000000000101000000FBC67CE5E6581640531A7B40EAC81C40,'2014-09-25 22:32:26'),
+(286,'1308 Sumy Loop','','Fujian',175,'30657','583021225407',0x000000000101000000DC7AF25597D35D409617AAACB70F3A40,'2014-09-25 22:30:34'),
+(287,'1405 Chisinau Place','','Ponce',411,'8160','62781725285',0x000000000101000000974341DF4CA750C03F219628D6023240,'2014-09-25 22:32:45'),
+(288,'226 Halifax Street','','Xinxiang',277,'58492','790651020929',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:38'),
+(289,'1279 Udine Parkway','','Edo & Delta',69,'75860','195003555232',0x000000000101000000FFB7EDD68D8216408FF4B3A217571940,'2014-09-25 22:32:23'),
+(290,'1336 Benin City Drive','','Shiga',386,'46044','341242939532',0x000000000101000000D5810761C9FB60401B07A8BA91804140,'2014-09-25 22:31:53'),
+(291,'1155 Liaocheng Place','','Oyo & Osun',152,'22650','558236142492',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:23'),
+(292,'1993 Tabuk Lane','','Tamil Nadu',522,'64221','648482415405',0x0000000001010000002AF3A0EA210854407F94C78965D92940,'2014-09-25 22:31:27'),
+(293,'86 Higashiosaka Lane','','Guanajuato',563,'33768','957128697225',0x0000000001010000002DAF5C6F1B4C59C07F34F7EBA9643440,'2014-09-25 22:32:14'),
+(294,'1912 Allende Manor','','Kowloon and New Kowl',279,'58124','172262454487',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:09'),
+(295,'544 Tarsus Boulevard','','Gurico',562,'53145','892523334',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:05'),
+(296,'1936 Cuman Avenue','','Virginia',433,'61195','976798660411',0x000000000101000000FD7B3A6840FC53C065F4ED6EAFA24240,'2014-09-25 22:33:58'),
+(297,'1192 Tongliao Street','','Sharja',470,'19065','350970907017',0x000000000101000000AA27F38FBEB44B4053E68B625E563940,'2014-09-25 22:33:35'),
+(298,'44 Najafabad Way','','Baskimaa',146,'61391','96604821070',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:08'),
+(299,'32 Pudukkottai Lane','','Ohio',140,'38834','967274728547',0x000000000101000000077AA86D430C55C0409C2C5A25E14340,'2014-09-25 22:33:49'),
+(300,'661 Chisinau Lane','','Pietari',274,'8856','816436065431',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:51'),
+(301,'951 Stara Zagora Manor','','Punjab',400,'98573','429925609431',0x0000000001010000001E296C50C51953405651723DC0533E40,'2014-09-25 22:31:22'),
+(302,'922 Vila Velha Loop','','Maharashtra',9,'4085','510737228015',0x000000000101000000738F5B8242AF5240612129D835183340,'2014-09-25 22:31:10'),
+(303,'898 Jining Lane','','Pohjois-Pohjanmaa',387,'40070','161643343536',0x0000000001010000003DFB80F6D9773940C8D0B183CA405040,'2014-09-25 22:31:00'),
+(304,'1635 Kuwana Boulevard','','Hiroshima',205,'52137','710603868323',0x000000000101000000AA944330B38E6040247035FCB8324140,'2014-09-25 22:31:46'),
+(305,'41 El Alto Parkway','','Maharashtra',398,'56883','51917807050',0x000000000101000000D487E41A55315340BC3088FEBF443340,'2014-09-25 22:31:22'),
+(306,'1883 Maikop Lane','','Kaliningrad',254,'68469','96110042435',0x00000000010100000020DF94A8CD82344015D918856E5A4B40,'2014-09-25 22:32:50'),
+(307,'1908 Gaziantep Place','','Liaoning',536,'58979','108053751300',0x0000000001010000004DAA6C0EC6E65E408E9F7C30DF344540,'2014-09-25 22:30:43'),
+(308,'687 Alessandria Parkway','','Sanaa',455,'57587','407218522294',0x0000000001010000000C60257A741A4640854A123A9EB52E40,'2014-09-25 22:34:10'),
+(309,'827 Yuncheng Drive','','Callao',99,'79047','504434452842',0x000000000101000000C2514DA48F4753C0271CD544FA1C28C0,'2014-09-25 22:32:32'),
+(310,'913 Coacalco de Berriozbal Loop','','Texas',33,'42141','262088367001',0x00000000010100000023371EC7EA4658C0A86851442B5E4040,'2014-09-25 22:33:43'),
+(311,'715 So Bernardo do Campo Lane','','Kedah',507,'84804','181179321332',0x000000000101000000D8DBC1E3361F5940520DFB3DB1961640,'2014-09-25 22:32:00'),
+(312,'1354 Siegen Street','','Rio de Janeiro',25,'80184','573441801529',0x0000000001010000009146054EB62846C0FCA0D398B50137C0,'2014-09-25 22:30:15'),
+(313,'1191 Sungai Petani Boulevard','','Missouri',262,'9668','983259819766',0x00000000010100000055890D7107A557C0CB7564F6C38C4340,'2014-09-25 22:33:54'),
+(314,'1224 Huejutla de Reyes Boulevard','','Lombardia',91,'70923','806016930576',0x000000000101000000D85B6F40F06D24405EEE38EA8DC44640,'2014-09-25 22:31:43'),
+(315,'543 Bergamo Avenue','','Minas Gerais',215,'59686','103602195112',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:18'),
+(316,'746 Joliet Lane','','Kursk',286,'94878','688485191923',0x00000000010100000085949F54FB174240E0DCBAF660DE4940,'2014-09-25 22:32:52'),
+(317,'780 Kimberley Way','','Tabuk',515,'17032','824396883951',0x0000000001010000001BD47E6B274942408B53AD8559663C40,'2014-09-25 22:33:00'),
+(318,'1774 Yaound Place','','Hubei',166,'91400','613124286867',0x0000000001010000002A00C633E8B15C404C63C5BA027D3E40,'2014-09-25 22:30:33'),
+(319,'1957 Yantai Lane','','So Paulo',490,'59255','704948322302',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:22'),
+(320,'1542 Lubumbashi Boulevard','','Tel Aviv',57,'62472','508800331065',0x000000000101000000765F84DF3C6041403CAB60AF0B034040,'2014-09-25 22:31:41'),
+(321,'651 Pathankot Loop','','Maharashtra',336,'59811','139378397418',0x0000000001010000002198FE8062A952408AC168FBFCD23040,'2014-09-25 22:31:20'),
+(322,'1359 Zhoushan Parkway','','Streymoyar',545,'29763','46568045367',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:59'),
+(323,'1769 Iwaki Lane','','Kujawsko-Pomorskie',97,'25787','556100547674',0x000000000101000000487B7203F4013240837EF0EBD18F4A40,'2014-09-25 22:32:41'),
+(324,'1145 Vilnius Manor','','Mxico',451,'73170','674805712553',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:12'),
+(325,'1892 Nabereznyje Telny Lane','','Tutuila',516,'28396','478229987054',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:02'),
+(326,'470 Boksburg Street','','Central',81,'97960','908029859266',0x000000000101000000DAE78C83263855405BE21291AB023B40,'2014-09-25 22:32:19'),
+(327,'1427 A Corua (La Corua) Place','','Buenos Aires',45,'85799','972574862516',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:04'),
+(328,'479 San Felipe del Progreso Avenue','','Morelos',130,'54949','869051782691',0x000000000101000000C87E710484BC58C039FD8F02FACD3240,'2014-09-25 22:32:04'),
+(329,'867 Benin City Avenue','','Henan',591,'78543','168884817145',0x000000000101000000A0F2F972B05D5C405D68531AD6144140,'2014-09-25 22:30:50'),
+(330,'981 Kumbakonam Place','','Distrito Federal',89,'87611','829116184079',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:17'),
+(331,'1016 Iwakuni Street','','St George',269,'49833','961370847344',0x000000000101000000A1DC11A9C49C4EC0D11B936A44512A40,'2014-09-25 22:32:59'),
+(332,'663 Baha Blanca Parkway','','Adana',5,'33463','834418779292',0x000000000101000000BE72182719AA4140CCD1E3F736804240,'2014-09-25 22:33:22'),
+(333,'1860 Taguig Loop','','West Java',119,'59550','38158430589',0x00000000010100000042ACA34FD0E55A40D698C6E52ED81BC0,'2014-09-25 22:31:32'),
+(334,'1816 Bydgoszcz Loop','','Dhaka',234,'64308','965273813662',0x000000000101000000A717C627AE7C564080BD1D3C6EEB3840,'2014-09-25 22:30:12'),
+(335,'587 Benguela Manor','','Illinois',42,'91590','165450987037',0x00000000010100000097CEE2207C1456C0DDEFABCD5AE14440,'2014-09-25 22:33:44'),
+(336,'430 Kumbakonam Drive','','Santa F',457,'28814','105470691550',0x00000000010100000004C1882249304DC055DF54FF7B4E41C0,'2014-09-25 22:30:07'),
+(337,'1838 Tabriz Lane','','Dhaka',143,'1195','38988715447',0x0000000001010000001A5D948F139A5640C4D21B49DDB53740,'2014-09-25 22:30:12'),
+(338,'431 Szkesfehrvr Avenue','','Baki',48,'57828','119501405123',0x000000000101000000A77686A92DF248400FAECACF57304440,'2014-09-25 22:30:11'),
+(339,'503 Sogamoso Loop','','Sumqayit',505,'49812','834626715837',0x0000000001010000006C83C94395D548402C8EB9217C4B4440,'2014-09-25 22:30:11'),
+(340,'507 Smolensk Loop','','Sousse',492,'22971','80303246192',0x000000000101000000298EA8F52346254075DA649EA6E94140,'2014-09-25 22:33:21'),
+(341,'1920 Weifang Avenue','','Uttar Pradesh',427,'15643','869507847714',0x0000000001010000001F3EFA70DAC153407410CF6D1DCF3C40,'2014-09-25 22:31:25'),
+(342,'124 al-Manama Way','','Hiroshima',382,'52368','647899404952',0x0000000001010000004BE07B244AA760407B0ED18D55354140,'2014-09-25 22:31:52'),
+(343,'1443 Mardan Street','','Western Cape',392,'31483','231383037471',0x000000000101000000FB6074D42CF73240B0B03B3833DA40C0,'2014-09-25 22:33:05'),
+(344,'1909 Benguela Lane','','Henan',581,'19913','624138001031',0x000000000101000000F4AD6AA480775C4066EB2AEE89A74140,'2014-09-25 22:30:47'),
+(345,'68 Ponce Parkway','','Hanoi',201,'85926','870635127812',0x0000000001010000005DF525C0D5755A4000F61B3746063540,'2014-09-25 22:34:06'),
+(346,'1217 Konotop Avenue','','Gelderland',151,'504','718917251754',0x000000000101000000F438679F22A2164019B4EB3944044A40,'2014-09-25 22:32:20'),
+(347,'1293 Nam Dinh Way','','Roraima',84,'71583','697656479977',0x0000000001010000008EE6C8CA2F564EC0D9C23DE0CB8E0640,'2014-09-25 22:30:17'),
+(348,'785 Vaduz Street','','Baja California',335,'36170','895616862749',0x0000000001010000000D61EB0816DD5CC07DB328475C504040,'2014-09-25 22:32:10'),
+(349,'1516 Escobar Drive','','Tongatapu',370,'46069','64536069371',0x0000000001010000009132987575E665C0BE11DDB3AE2335C0,'2014-09-25 22:33:20'),
+(350,'1628 Nagareyama Lane','','Central',453,'60079','20064292617',0x00000000010100000019A5F04520C14CC029006B7AF55639C0,'2014-09-25 22:32:32'),
+(351,'1157 Nyeri Loop','','Adygea',320,'56380','262744791493',0x000000000101000000AC91B8228C0D4440EBD10AC2CB4D4640,'2014-09-25 22:32:55'),
+(352,'1673 Tangail Drive','','Daugavpils',137,'26857','627924259271',0x0000000001010000004377A45588883A40E580B80611F14B40,'2014-09-25 22:31:57'),
+(353,'381 Kabul Way','','Taipei',209,'87272','55477302294',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:15'),
+(354,'953 Hodeida Street','','Southern Tagalog',221,'18841','53912826864',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:37'),
+(355,'469 Nakhon Sawan Street','','Tuvassia',531,'58866','689199636560',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:58'),
+(356,'1378 Beira Loop','','Krasnojarsk',597,'40792','840957664136',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:58'),
+(357,'1641 Changhwa Place','','Nord-Ouest',52,'37636','256546485220',0x000000000101000000103B53E8BC4A2440A4C0A7DEBFD61740,'2014-09-25 22:30:25'),
+(358,'1698 Southport Loop','','Hidalgo',393,'49009','754358349853',0x0000000001010000007AB82E46EEAE58C03DED951EF21D3440,'2014-09-25 22:32:11'),
+(359,'519 Nyeri Manor','','So Paulo',461,'37650','764680915323',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:21'),
+(360,'619 Hunuco Avenue','','Shimane',331,'81508','142596392389',0x000000000101000000A09ADC399EA160405B1D4AFE71BC4140,'2014-09-25 22:31:50'),
+(361,'45 Aparecida de Goinia Place','','Madhya Pradesh',464,'7431','650496654258',0x0000000001010000009E0CE94BCA345440C9FDB38B0E953840,'2014-09-25 22:31:26'),
+(362,'482 Kowloon and New Kowloon Manor','','Bratislava',90,'97056','738968474939',0x00000000010100000070DC18F1531B3140BDB90908F7124840,'2014-09-25 22:33:02'),
+(363,'604 Bern Place','','Jharkhand',429,'5373','620719383725',0x000000000101000000799F9916AB55554037CC86EB07593740,'2014-09-25 22:31:25'),
+(364,'1623 Kingstown Drive','','Buenos Aires',20,'91299','296394569728',0x000000000101000000791563AAAA2A4DC0E4839ECDAA6A41C0,'2014-09-25 22:30:04'),
+(365,'1009 Zanzibar Lane','','Arecibo',32,'64875','102396298916',0x000000000101000000FBBD5EABCEAD50C0E9787187F2783240,'2014-09-25 22:32:45'),
+(366,'114 Jalib al-Shuyukh Manor','','Centre',585,'60440','845378657301',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:25'),
+(367,'1163 London Parkway','','Par',66,'6066','675120358494',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:16'),
+(368,'1658 Jastrzebie-Zdrj Loop','','Central',372,'96584','568367775448',0x0000000001010000002B73A900CEEF4240660811BA956FB9BF,'2014-09-25 22:31:56'),
+(369,'817 Laredo Avenue','','Jalisco',188,'77449','151249681135',0x000000000101000000F00BF9B113D959C03E4EE2BDB4AA3440,'2014-09-25 22:32:06'),
+(370,'1565 Tangail Manor','','Okinawa',377,'45750','634445428822',0x000000000101000000D94C744CCCAA5F4045A1C096B2C53940,'2014-09-25 22:31:52'),
+(371,'1912 Emeishan Drive','','Balikesir',50,'33050','99883471275',0x000000000101000000F1074D5CD8E23B400B2A053818D34340,'2014-09-25 22:33:22'),
+(372,'230 Urawa Drive','','Andhra Pradesh',8,'2738','166898395731',0x0000000001010000008B04AE869F515340B2930BDF0C402F40,'2014-09-25 22:31:09'),
+(373,'1922 Miraj Way','','Esfahan',356,'13203','320471479776',0x00000000010100000017050B71F6AE494026231DD434514040,'2014-09-25 22:31:37'),
+(374,'433 Florencia Street','','Chihuahua',250,'91330','561729882725',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:08'),
+(375,'1049 Matamoros Parkway','','Karnataka',191,'69640','960505250340',0x0000000001010000007923F3C89F355340386744696F563140,'2014-09-25 22:31:16'),
+(376,'1061 Ede Avenue','','Southern Tagalog',98,'57810','333390595558',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:35'),
+(377,'154 Oshawa Manor','','East Java',415,'72771','440365973660',0x00000000010100000005B93077D24D5C4065074B2B74041FC0,'2014-09-25 22:31:34'),
+(378,'1191 Tandil Drive','','Southern Tagalog',523,'6362','45554316010',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:40'),
+(379,'1133 Rizhao Avenue','','Pernambuco',572,'2800','600264533987',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:23'),
+(380,'1519 Santiago de los Caballeros Loop','','East Kasai',348,'22025','409315295763',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:53'),
+(381,'1618 Olomouc Manor','','Kurgan',285,'26385','96846695220',0x000000000101000000B1694A5755555040EA8FD552E5B94B40,'2014-09-25 22:32:51'),
+(382,'220 Hidalgo Drive','','Kermanshah',265,'45298','342720754566',0x0000000001010000004E7A843F6888474008605EDB36284140,'2014-09-25 22:31:37'),
+(383,'686 Donostia-San Sebastin Lane','','Guangdong',471,'97390','71857599858',0x000000000101000000F90A1C1A60845C400FDB711EA98B3640,'2014-09-25 22:30:42'),
+(384,'97 Mogiljov Lane','','Gujarat',73,'89294','924815207181',0x000000000101000000B4F116FEC209524097DB076A42C63540,'2014-09-25 22:31:11'),
+(385,'1642 Charlotte Amalie Drive','','Slaskie',549,'75442','821476736117',0x000000000101000000DDC4DA2967F73240D5D6E3198F114940,'2014-09-25 22:32:44'),
+(386,'1368 Maracabo Boulevard','','',493,'32716','934352415130',0x000000000101000000731074B4AA8A4FC050920953EF2E3240,'2014-09-25 22:30:03'),
+(387,'401 Sucre Boulevard','','New Hampshire',322,'25007','486395999608',0x000000000101000000817FA54E1BDD51C013718456717F4540,'2014-09-25 22:33:56'),
+(388,'368 Hunuco Boulevard','','Namibe',360,'17165','106439158941',0x000000000101000000B5858CECEF4D28404D8EF11769642EC0,'2014-09-25 22:30:03'),
+(389,'500 Lincoln Parkway','','Jiangsu',210,'95509','550306965159',0x0000000001010000003C399E2A3AC15D404409449957CB4040,'2014-09-25 22:30:35'),
+(390,'102 Chapra Drive','','Ibaragi',521,'14073','776031833752',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:54'),
+(391,'1793 Meixian Place','','Hmelnytskyi',258,'33535','619966287415',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:31'),
+(392,'514 Ife Way','','Shaba',315,'69973','900235712074',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:53'),
+(393,'717 Changzhou Lane','','Southern Tagalog',104,'21615','426255288071',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:36'),
+(394,'753 Ilorin Avenue','','Sichuan',157,'3656','464511145118',0x0000000001010000008531D8C3CDD8594059D70D805D883D40,'2014-09-25 22:30:32'),
+(395,'1337 Mit Ghamr Avenue','','Nakhon Sawan',358,'29810','175283210378',0x0000000001010000009A588572C70859404D237722D2682F40,'2014-09-25 22:33:19'),
+(396,'767 Pyongyang Drive','','Osaka',229,'83536','667736124769',0x000000000101000000149A7F4FC7EA6040A02413A6DE2F4140,'2014-09-25 22:31:48'),
+(397,'614 Pak Kret Street','','Addis Abeba',6,'27796','47808359842',0x0000000001010000009F84E3439A5F43402233BCFEC90C2240,'2014-09-25 22:30:59'),
+(398,'954 Lapu-Lapu Way','','Moskova',278,'8816','737229003916',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:51'),
+(399,'331 Bydgoszcz Parkway','','Asturia',181,'966','537374465982',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:09'),
+(400,'1152 Citrus Heights Manor','','al-Qadarif',15,'5239','765957414528',0x00000000010100000084F6459D14B14140AA36EE83E2112C40,'2014-09-25 22:33:11'),
+(401,'168 Cianjur Manor','','Saitama',228,'73824','679095087143',0x000000000101000000DEA925C2EB75614032005471E3F94140,'2014-09-25 22:31:48'),
+(402,'616 Hagonoy Avenue','','Krasnojarsk',39,'46043','604177838256',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:47'),
+(403,'1190 0 Place','','Rio Grande do Sul',44,'10417','841876514789',0x0000000001010000002347DF49B00D4BC086151340D6543FC0,'2014-09-25 22:30:16'),
+(404,'734 Bchar Place','','Punjab',375,'30586','280578750435',0x0000000001010000006D3B6D8D885C5240C4A40925DDCE3E40,'2014-09-25 22:32:31'),
+(405,'530 Lausanne Lane','','Texas',135,'11067','775235029633',0x0000000001010000009C830C89A03358C0E2D3F7753B644040,'2014-09-25 22:33:49'),
+(406,'454 Patiala Lane','','Fukushima',276,'13496','794553031307',0x000000000101000000EC3D4B46448C614091306711E5BB4240,'2014-09-25 22:31:49'),
+(407,'1346 Mysore Drive','','Bretagne',92,'61507','516647474029',0x0000000001010000004474BE8EEEEE11C070010DDBBB3F4840,'2014-09-25 22:31:00'),
+(408,'990 Etawah Loop','','Tamil Nadu',564,'79940','206169448769',0x000000000101000000D54B42D8DF3C5340FE518A0C61A72440,'2014-09-25 22:31:29'),
+(409,'1266 Laredo Parkway','','Saitama',380,'7664','1483365694',0x000000000101000000FBD97EE8F87361403BA5283C0DF44140,'2014-09-25 22:31:52'),
+(410,'88 Nagaon Manor','','Buenos Aires',524,'86868','779461480495',0x000000000101000000CA3736960B914DC0D78A91802CA942C0,'2014-09-25 22:30:07'),
+(411,'264 Bhimavaram Manor','','St Thomas',111,'54749','302526949177',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:08'),
+(412,'1639 Saarbrcken Drive','','North West',437,'9827','328494873422',0x00000000010100000015CB8866F93D3B40E48AE65CE5AA39C0,'2014-09-25 22:33:05'),
+(413,'692 Amroha Drive','','Northern',230,'35575','359478883004',0x00000000010100000027648CB47900544098E777503F562340,'2014-09-25 22:33:10'),
+(414,'1936 Lapu-Lapu Parkway','','Bauchi & Gombe',141,'7122','653436985797',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:23'),
+(415,'432 Garden Grove Street','','Ontario',430,'65630','615964523510',0x0000000001010000003E867DF1FBDB53C05900AEBF80EF4540,'2014-09-25 22:30:28'),
+(416,'1445 Carmen Parkway','','West Java',117,'70809','598912394463',0x000000000101000000957950F550C55A40B3BFA21122171BC0,'2014-09-25 22:31:30'),
+(417,'791 Salinas Street','','Punjab',208,'40509','129953030512',0x000000000101000000579E9B911CFA524075D256804A883F40,'2014-09-25 22:31:17'),
+(418,'126 Acua Parkway','','West Bengali',71,'58888','480039662421',0x000000000101000000C3013E89191056404E9F7829D01A3840,'2014-09-25 22:31:11'),
+(419,'397 Sunnyvale Avenue','','Guanajuato',19,'55566','680851640676',0x000000000101000000754419059C2F59C02409C21550EA3440,'2014-09-25 22:32:01'),
+(420,'992 Klerksdorp Loop','','Utrecht',23,'33711','855290087237',0x000000000101000000C1DFD4ACD88C15404FDC3BB4D9134A40,'2014-09-25 22:32:19'),
+(421,'966 Arecibo Loop','','Sind',134,'94018','15273765306',0x000000000101000000BE9B1320AFF15040D93400659DBB3A40,'2014-09-25 22:32:30'),
+(422,'289 Santo Andr Manor','','al-Sharqiya',16,'72410','214976066017',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:59'),
+(423,'437 Chungho Drive','','Puerto Plata',450,'59489','491271355190',0x000000000101000000225A86930FAC51C0082692431FCB3340,'2014-09-25 22:30:55'),
+(424,'1948 Bayugan Parkway','','Bihar',264,'60622','987306329957',0x0000000001010000007613211A82E45540D685C4E2DC893940,'2014-09-25 22:31:19'),
+(425,'1866 al-Qatif Avenue','','California',155,'89420','546793516940',0x000000000101000000B4EE7AC4C3815DC0165D28AAC8084140,'2014-09-25 22:33:50'),
+(426,'1661 Abha Drive','','Tamil Nadu',416,'14400','270456873752',0x000000000101000000D3B36A2192B45340FBC5111038C32440,'2014-09-25 22:31:23'),
+(427,'1557 Cape Coral Parkway','','Hubei',293,'46875','368284120423',0x00000000010100000034CC1A06BDEA5B402D5A25FD62314040,'2014-09-25 22:30:38'),
+(428,'1727 Matamoros Place','','Sawhaj',465,'78813','129673677866',0x00000000010100000083E38D27DDB13F40555BA093948E3A40,'2014-09-25 22:30:57'),
+(429,'1269 Botosani Manor','','Guangdong',468,'47394','736517327853',0x000000000101000000C8E1DDDB3ED65C40281B20E230C83640,'2014-09-25 22:30:42'),
+(430,'355 Vitria de Santo Anto Way','','Oaxaca',452,'81758','548003849552',0x0000000001010000000363D8BC050858C0503750E09D163240,'2014-09-25 22:32:13'),
+(431,'1596 Acua Parkway','','Jharkhand',418,'70425','157133457169',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:24'),
+(432,'259 Ipoh Drive','','So Paulo',189,'64964','419009857119',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:18'),
+(433,'1823 Hoshiarpur Lane','','Komi',510,'33191','307133768620',0x000000000101000000C6DA8420AC674940DD9ACF1495D64E40,'2014-09-25 22:32:57'),
+(434,'1404 Taguig Drive','','Okayama',547,'87212','572068624538',0x000000000101000000205D11A1F6BF6040BFE90203AD864140,'2014-09-25 22:31:54'),
+(435,'740 Udaipur Lane','','Nizni Novgorod',150,'33505','497288595103',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:47'),
+(436,'287 Cuautla Boulevard','','Chuquisaca',501,'72736','82619513349',0x0000000001010000002A0B15D2D05050C049C44ABB870833C0,'2014-09-25 22:30:14'),
+(437,'1766 Almirante Brown Street','','KwaZulu-Natal',364,'63104','617567598243',0x000000000101000000FDAB7DF090EE3D40488D64EA09C23BC0,'2014-09-25 22:33:04'),
+(438,'596 Huixquilucan Place','','Nampula',351,'65892','342709348083',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:17'),
+(439,'1351 Aparecida de Goinia Parkway','','Northern Mindanao',391,'41775','959834530529',0x000000000101000000DAFF006B55F55E40898C58D5DC4F2040,'2014-09-25 22:32:38'),
+(440,'722 Bradford Lane','','Shandong',249,'90920','746251338300',0x000000000101000000653E7B890CB55D4078A0A932E7954140,'2014-09-25 22:30:37'),
+(441,'983 Santa F Way','','British Colombia',565,'47472','145720452260',0x000000000101000000719CCA58A3C75EC0EEE7B92AF59F4840,'2014-09-25 22:30:28'),
+(442,'1245 Ibirit Way','','La Romana',290,'40926','331888642162',0x0000000001010000006D59BE2E433E51C04FC87322666D3240,'2014-09-25 22:30:54'),
+(443,'1836 Korla Parkway','','Copperbelt',272,'55405','689681677428',0x000000000101000000064257C796363C40BB7EC16ED89A29C0,'2014-09-25 22:34:11'),
+(444,'231 Kaliningrad Place','','Lombardia',70,'57833','575081026569',0x0000000001010000007A185A9D9C552340A77E390E17D94640,'2014-09-25 22:31:42'),
+(445,'495 Bhimavaram Lane','','Maharashtra',144,'3','82088937724',0x0000000001010000003EE1911DC0B15240B39943520BE73440,'2014-09-25 22:31:15'),
+(446,'1924 Shimonoseki Drive','','Batna',59,'52625','406784385440',0x000000000101000000347CB03154B21840DF814B112AC74140,'2014-09-25 22:29:59'),
+(447,'105 Dzerzinsk Manor','','Inner Mongolia',540,'48570','240776414296',0x000000000101000000F1C05B7BFA905E40F5EC03DA67CE4540,'2014-09-25 22:30:44'),
+(448,'614 Denizli Parkway','','Rio Grande do Sul',486,'29444','876491807547',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:22'),
+(449,'1289 Belm Boulevard','','Tartumaa',530,'88306','237368926031',0x00000000010100000079680EFF9FB93A406C7E575FB8304D40,'2014-09-25 22:30:58'),
+(450,'203 Tambaram Street','','Buenos Aires',161,'73942','411549550611',0x000000000101000000E753C72AA5604DC0438CD7BCAA2A41C0,'2014-09-25 22:30:05'),
+(451,'1704 Tambaram Manor','','West Bengali',554,'2834','39463554936',0x000000000101000000A4E9A2D755065640F598EDAFC3793640,'2014-09-25 22:31:28'),
+(452,'207 Cuernavaca Loop','','Tatarstan',352,'52671','782900030287',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:55'),
+(453,'319 Springs Loop','','Baijeri',160,'99552','72524459905',0x0000000001010000006A62CB3C0304264081FEE7D5A5CB4840,'2014-09-25 22:31:05'),
+(454,'956 Nam Dinh Manor','','Kerman',481,'21872','474047727727',0x000000000101000000F16206CF29D74B40CFA91A738D733D40,'2014-09-25 22:31:39'),
+(455,'1947 Paarl Way','','Central Java',509,'23636','834061016202',0x000000000101000000C4D78D2D3AB55B40AC996B8775391EC0,'2014-09-25 22:31:35'),
+(456,'814 Simferopol Loop','','Sinaloa',154,'48745','524567129902',0x000000000101000000954330B3F42F5BC090CCD9F115313A40,'2014-09-25 22:32:05'),
+(457,'535 Ahmadnagar Manor','','Abu Dhabi',3,'41136','985109775584',0x000000000101000000D3E6EE29EF2E4B4099C6E52E78773840,'2014-09-25 22:33:34'),
+(458,'138 Caracas Boulevard','','Zulia',326,'16790','974433019532',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:04'),
+(459,'251 Florencia Drive','','Michoacn de Ocampo',556,'16119','118011831565',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:13'),
+(460,'659 Gatineau Boulevard','','La Paz',153,'28587','205524798287',0x00000000010100000017E7B9CFBB0B51C0A029858ABB7B30C0,'2014-09-25 22:30:13'),
+(461,'1889 Valparai Way','','Ziguinchor',600,'75559','670370974122',0x00000000010100000020E1C50C9E4530C0FC219111AB2A2940,'2014-09-25 22:33:01'),
+(462,'1485 Bratislava Place','','Illinois',435,'83183','924663855568',0x000000000101000000A081A2C30D4656C04453D1B3B4224540,'2014-09-25 22:33:59'),
+(463,'935 Aden Boulevard','','Central Java',532,'64709','335052544020',0x000000000101000000C7139C55FA485B40BEE435655D7A1BC0,'2014-09-25 22:31:35'),
+(464,'76 Kermanshah Manor','','Esfahan',423,'23343','762361821578',0x000000000101000000FF66182DF6EE4940A60BB1FA23014040,'2014-09-25 22:31:37'),
+(465,'734 Tanshui Avenue','','Caquet',170,'70664','366776723320',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:52'),
+(466,'118 Jaffna Loop','','Northern Mindanao',182,'10447','325526730021',0x00000000010100000028B27B9777475F40BAEA4B80ABAA2140,'2014-09-25 22:32:36'),
+(467,'1621 Tongliao Avenue','','Irkutsk',558,'22173','209342540247',0x000000000101000000C7269E584CE95940E56A1ACA3F604A40,'2014-09-25 22:32:58'),
+(468,'1844 Usak Avenue','','Nova Scotia',196,'84461','164414772677',0x0000000001010000004205871744C94FC0162B0F779A524640,'2014-09-25 22:30:27'),
+(469,'1872 Toulon Loop','','OHiggins',428,'7939','928809465153',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:30'),
+(470,'1088 Ibirit Place','','Jalisco',595,'88502','49084281333',0x0000000001010000007820578FA0D859C06AE514D33BB93440,'2014-09-25 22:32:15'),
+(471,'1322 Mosul Parkway','','Shandong',145,'95400','268053970382',0x0000000001010000002856574F779F5D402425E2523ABB4240,'2014-09-25 22:30:32'),
+(472,'1447 Chatsworth Place','','Chihuahua',129,'41545','769370126331',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:04'),
+(473,'1257 Guadalajara Street','','Karnataka',78,'33599','195337700615',0x000000000101000000052049A4C8ED5240E702F2800DD33040,'2014-09-25 22:31:14'),
+(474,'1469 Plock Lane','','Galicia',388,'95835','622884741180',0x000000000101000000FB44F9DDCF741FC0ED9A90D6182B4540,'2014-09-25 22:33:09'),
+(475,'434 Ourense (Orense) Manor','','Hodeida',206,'14122','562370137426',0x000000000101000000F56FF2B62D7A4540DF80E03B7B982D40,'2014-09-25 22:34:10'),
+(476,'270 Tambaram Parkway','','Gauteng',244,'9668','248446668735',0x0000000001010000005B5540EB2B0B3C4082412D61C8333AC0,'2014-09-25 22:33:03'),
+(477,'1786 Salinas Place','','Nam Ha',359,'66546','206060652238',0x00000000010100000044BD851A2A7E5A40C2DB8310908D3440,'2014-09-25 22:34:07'),
+(478,'1078 Stara Zagora Drive','','Aceh',301,'69221','932992626595',0x00000000010100000034057CC8A5495840D2C9ADA470B81440,'2014-09-25 22:31:33'),
+(479,'1854 Okara Boulevard','','Drenthe',158,'42123','131912793873',0x0000000001010000006E8AC745B5A01B40947BCBE6BB634A40,'2014-09-25 22:32:21'),
+(480,'421 Yaound Street','','Sumy',385,'11363','726875628268',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:33'),
+(481,'1153 Allende Way','','Qubec',179,'20336','856872225376',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:26'),
+(482,'808 Naala-Porto Parkway','','England',500,'41060','553452430707',0x0000000001010000000E6036A6CC4201C0B9D7930A74B44A40,'2014-09-25 22:33:41'),
+(483,'632 Usolje-Sibirskoje Parkway','','Ha Darom',36,'73085','667648979883',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:41'),
+(484,'98 Pyongyang Boulevard','','Ohio',11,'88749','191958435142',0x0000000001010000008AB1A778376154C0990524AB6C8A4440,'2014-09-25 22:33:42'),
+(485,'984 Novoterkassk Loop','','Gaziantep',180,'28165','435118527255',0x000000000101000000CAAF7A1BF6B04240AA8889BC9B874240,'2014-09-25 22:33:25'),
+(486,'64 Korla Street','','Mwanza',347,'25145','510383179153',0x0000000001010000002A28FB9DDC7B40402EBB719C252204C0,'2014-09-25 22:33:17'),
+(487,'1785 So Bernardo do Campo Street','','Veracruz',125,'71182','684529463244',0x000000000101000000A1551CBD509C57C0141F44D72A223240,'2014-09-25 22:32:04'),
+(488,'698 Jelets Boulevard','','Denizli',142,'2596','975185523021',0x000000000101000000EECD6F9868163D40B226BB3E18E34240,'2014-09-25 22:33:24'),
+(489,'1297 Alvorada Parkway','','Ningxia',587,'11839','508348602835',0x0000000001010000001583D1F679915A4029876066E93B4340,'2014-09-25 22:30:49'),
+(490,'1909 Dayton Avenue','','Guangdong',469,'88513','702955450528',0x0000000001010000007BE0BE6955655C405457998466E43840,'2014-09-25 22:30:42'),
+(491,'1789 Saint-Denis Parkway','','Coahuila de Zaragoza',4,'8268','936806643983',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:01'),
+(492,'185 Mannheim Lane','','Stavropol',408,'23661','589377568313',0x000000000101000000333E82D19B87454024592CEA38064640,'2014-09-25 22:32:56'),
+(493,'184 Mandaluyong Street','','Baja California Sur',288,'94239','488425406814',0x000000000101000000173B2BB3D2935BC078F6F0C05B233840,'2014-09-25 22:32:09'),
+(494,'591 Sungai Petani Drive','','Okayama',376,'46400','37247325001',0x0000000001010000001966B2C9EBBD60404CC054D8B1544140,'2014-09-25 22:31:51'),
+(495,'656 Matamoros Drive','','Boyac',487,'19489','17305839123',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:53'),
+(496,'775 ostka Drive','','al-Daqahliya',337,'22358','171973024401',0x000000000101000000FC4DCD8A4D423F403EDF60B9EFB63E40,'2014-09-25 22:30:57'),
+(497,'1013 Tabuk Boulevard','','West Bengali',261,'96203','158399646978',0x0000000001010000005D1B857F6C1B5640793BC269C1F53640,'2014-09-25 22:31:19'),
+(498,'319 Plock Parkway','','Istanbul',504,'26101','854259976812',0x000000000101000000B6EFF6C54A453D40277E3100F97A4440,'2014-09-25 22:33:28'),
+(499,'1954 Kowloon and New Kowloon Way','','Chimborazo',434,'63667','898559280434',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:56'),
+(500,'362 Rajkot Lane','','Gansu',47,'98030','962020153680',0x0000000001010000004F6FEB13E50A5A4028733D1B03464240,'2014-09-25 22:30:31'),
+(501,'1060 Tandil Lane','','Shandong',432,'72349','211256301880',0x000000000101000000CAB61D6423DD5D40ADF1E379BAB64140,'2014-09-25 22:30:41'),
+(502,'1515 Korla Way','','England',589,'57197','959467760895',0x0000000001010000004C42D8DFC852F1BFBA826DC493FA4A40,'2014-09-25 22:33:42'),
+(503,'1416 San Juan Bautista Tuxtepec Avenue','','Zufar',444,'50592','144206758053',0x000000000101000000A6684018D30B4B40078662E1DA033140,'2014-09-25 22:32:29'),
+(504,'1 Valle de Santiago Avenue','','Apulia',93,'86208','465897838272',0x000000000101000000CAFED4D3A2EF3140584D7C5AEA504440,'2014-09-25 22:31:43'),
+(505,'519 Brescia Parkway','','East Java',318,'69504','793996678771',0x000000000101000000A3C794B487E15B400A230736F8841EC0,'2014-09-25 22:31:33'),
+(506,'414 Mandaluyong Street','','Lubelskie',314,'16370','52709222667',0x0000000001010000000FE6C0BC1191364020F0C000C2A04940,'2014-09-25 22:32:43'),
+(507,'1197 Sokoto Boulevard','','West Bengali',478,'87687','868602816371',0x000000000101000000109546CC6C1B56408F0FC4C3C5B53A40,'2014-09-25 22:31:27'),
+(508,'496 Celaya Drive','','Nagano',552,'90797','759586584889',0x000000000101000000254E3805034961402486D3388A334240,'2014-09-25 22:31:54'),
+(509,'786 Matsue Way','','Illinois',245,'37469','111177206479',0x0000000001010000000F3B9D75570556C0FA91C77839C34440,'2014-09-25 22:33:54'),
+(510,'48 Maracabo Place','','Central Luzon',519,'1570','82671830126',0x000000000101000000223999B8D53A5E408D87AD8F3D2D2F40,'2014-09-25 22:32:39'),
+(511,'1152 al-Qatif Lane','','Kalimantan Barat',412,'44816','131370665218',0x000000000101000000107FA88F9B545B4021037976F9D69FBF,'2014-09-25 22:31:34'),
+(512,'1269 Ipoh Avenue','','Eskisehir',163,'54674','402630109080',0x000000000101000000E9D32AFA43853E40767D303A6AE34340,'2014-09-25 22:33:24'),
+(513,'758 Korolev Parkway','','Andhra Pradesh',568,'75474','441628280920',0x00000000010100000031DA99F859285440AF528BD2EF843040,'2014-09-25 22:31:29'),
+(514,'1747 Rustenburg Place','','Bihar',110,'51369','442673923363',0x0000000001010000000BFD5DE9C62E554041C4BC7D0CC83940,'2014-09-25 22:31:14'),
+(515,'886 Tonghae Place','','Volgograd',259,'19450','711928348157',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:50'),
+(516,'1574 Goinia Boulevard','','Heilongjiang',502,'39529','59634255214',0x00000000010100000017128B73AFBF5F40C5ECC094DC514740,'2014-09-25 22:30:43'),
+(517,'548 Uruapan Street','','Ontario',312,'35653','879347453467',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:38'),
+(519,'962 Tama Loop','','',583,'65952','282667506728',0x000000000101000000FA545FA722DD6440AA7A9EE4B321E1BF,'2014-09-25 22:32:19'),
+(520,'1778 Gijn Manor','','Hubei',594,'35156','288910576761',0x000000000101000000E358727044305C40A58A3D0F49104040,'2014-09-25 22:30:50'),
+(521,'568 Dhule (Dhulia) Loop','','Coquimbo',127,'92568','602101369463',0x0000000001010000000000804A296FC5C1DDA85F330AC13EC0,'2014-09-25 22:30:30'),
+(522,'1768 Udine Loop','','Battambang',60,'32347','448876499197',0x000000000101000000708802C7AFCC59402ABC15D396342A40,'2014-09-25 22:30:24'),
+(523,'608 Birgunj Parkway','','Taipei',116,'400','627425618482',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:14'),
+(524,'680 A Corua (La Corua) Manor','','Sivas',482,'49806','158326114853',0x000000000101000000936EF02A10824240F2F6D676C9DF4340,'2014-09-25 22:33:28'),
+(525,'1949 Sanya Street','','Gumma',224,'61244','132100972047',0x000000000101000000943F29A406696140E4CA8FAE88284240,'2014-09-25 22:31:47'),
+(526,'617 Klerksdorp Place','','Khanh Hoa',366,'94707','574973479129',0x0000000001010000004A1751C96F4C5B4032F504D37A7D2840,'2014-09-25 22:34:07'),
+(527,'1993 0 Loop','','Liaoning',588,'41214','25865528181',0x000000000101000000B65E1D119D8E5E40171A3ED818554440,'2014-09-25 22:30:49'),
+(528,'1176 Southend-on-Sea Manor','','Southern Tagalog',458,'81651','236679267178',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:39'),
+(529,'600 Purnea (Purnia) Avenue','','Nghe An',571,'18043','638409958875',0x000000000101000000962364204F6C5A407A6D365662AC3240,'2014-09-25 22:34:07'),
+(530,'1003 Qinhuangdao Street','','West Java',419,'25972','35533115997',0x0000000001010000005EA516A55FDC5A40A21639FA4E3A1AC0,'2014-09-25 22:31:35'),
+(531,'1986 Sivas Place','','Friuli-Venezia Giuli',551,'95775','182059202712',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:44'),
+(532,'1427 Tabuk Place','','Florida',101,'31342','214756839122',0x0000000001010000003C702942C57C54C02A5D555117903A40,'2014-09-25 22:33:47'),
+(533,'556 Asuncin Way','','Mogiljov',339,'35364','338244023543',0x0000000001010000006B6DD04D51583E40673513C259F54A40,'2014-09-25 22:30:13'),
+(534,'486 Ondo Parkway','','Benguela',67,'35202','105882218332',0x000000000101000000BD83E9C59ACF2A40B9FA56900B2729C0,'2014-09-25 22:30:02'),
+(535,'635 Brest Manor','','Andhra Pradesh',75,'40899','80593242951',0x00000000010100000079FA52897C615440D2C9ADA4708A3040,'2014-09-25 22:31:13'),
+(536,'166 Jinchang Street','','Buenos Aires',165,'86760','717566026669',0x0000000001010000003EB896242A434DC0E0771DBB556D41C0,'2014-09-25 22:30:05'),
+(537,'958 Sagamihara Lane','','Mie',287,'88408','427274926505',0x000000000101000000BED29E37BA1761409B5F837467884140,'2014-09-25 22:31:50'),
+(538,'1817 Livorno Way','','Khanh Hoa',100,'79401','478380208348',0x000000000101000000944A78422F4A5B40236D3E09C7D72740,'2014-09-25 22:34:05'),
+(539,'1332 Gaziantep Lane','','Shandong',80,'22813','383353187467',0x000000000101000000BC2F1D2911815D4074B0A316EFAE4240,'2014-09-25 22:30:31'),
+(540,'949 Allende Lane','','Uttar Pradesh',24,'67521','122981120653',0x0000000001010000008C91DBE5119E534039A8B34934E73C40,'2014-09-25 22:31:11'),
+(541,'195 Ilorin Street','','Chari-Baguirmi',363,'49250','8912935608',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:29'),
+(542,'193 Bhusawal Place','','Kang-won',539,'9750','745267607502',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:07'),
+(543,'43 Vilnius Manor','','Colorado',42,'79814','484500282381',0x0000000001010000009389004C3E355AC0D03582435EDD4340,'2014-09-25 22:33:44'),
+(544,'183 Haiphong Street','','Jilin',46,'69953','488600270038',0x000000000101000000AFA3607C87B45E4038A85890C1CD4640,'2014-09-25 22:30:30'),
+(545,'163 Augusta-Richmond County Loop','','Carabobo',561,'33030','754579047924',0x000000000101000000CC0C1B657D0051C06B7F677BF4522440,'2014-09-25 22:34:05'),
+(546,'191 Jos Azueta Parkway','','Ruse',436,'13629','932156667696',0x00000000010100000067A9ABF188F83940CD6CA1759EED4540,'2014-09-25 22:30:23'),
+(547,'379 Lublin Parkway','','Toscana',309,'74568','921960450089',0x00000000010100000090920D5AFEA62440CC13BEADAAC54540,'2014-09-25 22:31:44'),
+(548,'1658 Cuman Loop','','Sumatera Selatan',396,'51309','784907335610',0x00000000010100000018D75306E9885A40E8209EDB3A4E01C0,'2014-09-25 22:31:34'),
+(549,'454 Qinhuangdao Drive','','Tadla-Azilal',68,'25866','786270036240',0x000000000101000000419479F53B6619C04F09E3022B2B4040,'2014-09-25 22:32:16'),
+(550,'1715 Okayama Street','','So Paulo',485,'55676','169352919175',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:22'),
+(551,'182 Nukualofa Drive','','Sumy',275,'15414','426346224043',0x00000000010100000079F71109F099404055BBCBEAC29E4940,'2014-09-25 22:33:32'),
+(552,'390 Wroclaw Way','','Hainan',462,'5753','357593328658',0x000000000101000000F70FD88B57605B40364E5480393E3240,'2014-09-25 22:30:41'),
+(553,'1421 Quilmes Lane','','Ishikawa',260,'19151','135407755975',0x0000000001010000008F9F32A30414614053AEF02E174C4240,'2014-09-25 22:31:49'),
+(554,'947 Trshavn Place','','Central Luzon',528,'841','50898428626',0x000000000101000000C56DD9C644265E4002B5BD82D9F52E40,'2014-09-25 22:32:40'),
+(555,'1764 Jalib al-Shuyukh Parkway','','Galicia',459,'77642','84794532510',0x00000000010100000090FFB8B3651721C09DB23FF5B4704540,'2014-09-25 22:33:10'),
+(556,'346 Cam Ranh Avenue','','Zhejiang',599,'39976','978430786151',0x000000000101000000A0E63FFF188D5E4056DBA8A9C0023E40,'2014-09-25 22:30:51'),
+(557,'1407 Pachuca de Soto Place','','Rio Grande do Sul',21,'26284','380077794770',0x000000000101000000A3CEDC43C28449C0608209922DFD3DC0,'2014-09-25 22:30:14'),
+(558,'904 Clarksville Drive','','Zhejiang',193,'52234','955349440539',0x000000000101000000E5886B6BFA2A5E4038E04E7D7B7A3E40,'2014-09-25 22:30:34'),
+(559,'1917 Kumbakonam Parkway','','Vojvodina',368,'11892','698182547686',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:11'),
+(560,'1447 Imus Place','','Gujarat',426,'12905','62127829280',0x000000000101000000667F4523C4B25140819C8B1AA74A3640,'2014-09-25 22:31:25'),
+(561,'1497 Fengshan Drive','','KwaZulu-Natal',112,'63022','368738360376',0x000000000101000000938FDD054AE43E402AF97DA42DEB3DC0,'2014-09-25 22:33:03'),
+(562,'869 Shikarpur Way','','England',496,'57380','590764256785',0x000000000101000000894FF003460D08C0828472ECEAD24A40,'2014-09-25 22:33:40'),
+(563,'1059 Yuncheng Avenue','','Vilna',570,'47498','107092893983',0x00000000010100000046B82462A5473940BA0ACE8536584B40,'2014-09-25 22:31:58'),
+(564,'505 Madiun Boulevard','','Dolnoslaskie',577,'97271','970638808606',0x000000000101000000F0D46D9A8808314023A93B05AF914940,'2014-09-25 22:32:44'),
+(565,'1741 Hoshiarpur Boulevard','','al-Sharqiya',79,'22372','855066328617',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:56'),
+(566,'1229 Varanasi (Benares) Manor','','Buenos Aires',43,'40195','817740355461',0x00000000010100000014DA28A1AA2A4DC02E156580555541C0,'2014-09-25 22:30:04'),
+(567,'1894 Boa Vista Way','','Texas',178,'77464','239357986667',0x000000000101000000C1D1448EE32858C0AD8D0CCDD0744040,'2014-09-25 22:33:51'),
+(568,'1342 Sharja Way','','Sokoto & Kebbi & Zam',488,'93655','946114054231',0x0000000001010000005B087250C2F41440E711ED74311F2A40,'2014-09-25 22:32:27'),
+(569,'1342 Abha Boulevard','','Bukarest',95,'10714','997453607116',0x000000000101000000924FD9FA331B3A40B1CBA61254374640,'2014-09-25 22:32:46'),
+(570,'415 Pune Avenue','','Shandong',580,'44274','203202500108',0x000000000101000000CC3857DE1F705D408F26CDD545F34140,'2014-09-25 22:30:47'),
+(571,'1746 Faaa Way','','Huanuco',214,'32515','863080561151',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:33'),
+(572,'539 Hami Way','','Tokat',538,'52196','525518075499',0x0000000001010000006F302F1BF8464240AD7B759F2D284440,'2014-09-25 22:33:29'),
+(573,'1407 Surakarta Manor','','Moskova',466,'33224','324346485054',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:56'),
+(574,'502 Mandi Bahauddin Parkway','','Anzotegui',55,'15992','618156722572',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:03'),
+(575,'1052 Pathankot Avenue','','Sichuan',299,'77397','128499386727',0x000000000101000000AA054026E3F05940CCC12275F18F3D40,'2014-09-25 22:30:39'),
+(576,'1351 Sousse Lane','','Coahuila de Zaragoza',341,'37815','203804046132',0x0000000001010000006AB86D84EA5A59C027AA12C028E83A40,'2014-09-25 22:32:10'),
+(577,'1501 Pangkal Pinang Avenue','','Mazowieckie',409,'943','770864062795',0x0000000001010000001646C4DED5B43340308AD46AFE454A40,'2014-09-25 22:32:43'),
+(578,'1405 Hagonoy Avenue','','Slaskie',133,'86587','867287719310',0x0000000001010000002431F77FC41F3340F5B06197F2654940,'2014-09-25 22:32:42'),
+(579,'521 San Juan Bautista Tuxtepec Place','','Qaraghandy',598,'95093','844018348565',0x0000000001010000006848CB3711F15040E32A604C44E44740,'2014-09-25 22:31:56'),
+(580,'923 Tangail Boulevard','','Tokyo-to',10,'33384','315528269898',0x00000000010100000078E5C468A76B6140C3A27D079ADA4140,'2014-09-25 22:31:45'),
+(581,'186 Skikda Lane','','Morelos',131,'89422','14465669789',0x00000000010100000048C2BE9DC4CE58C0DA3DD4111BED3240,'2014-09-25 22:32:05'),
+(582,'1568 Celaya Parkway','','Kaohsiung',168,'34750','278669994384',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:15'),
+(583,'1489 Kakamigahara Lane','','Taipei',526,'98883','29341849811',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:16'),
+(584,'1819 Alessandria Loop','','Campeche',103,'53829','377633994405',0x0000000001010000008636A5611DF556C0374F1A0F5BA53240,'2014-09-25 22:32:02'),
+(585,'1208 Tama Loop','','Ninawa',344,'73605','954786054144',0x000000000101000000314F9DFD378F4540961EF23BF22A4240,'2014-09-25 22:31:40'),
+(586,'951 Springs Lane','','Central Mindanao',219,'96115','165164761435',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:37'),
+(587,'760 Miyakonojo Drive','','Guerrero',246,'64682','294449058179',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:08'),
+(588,'966 Asuncin Way','','Hidalgo',212,'62703','995527378381',0x000000000101000000EBBD4230D89A58C0E30632F1FD233540,'2014-09-25 22:32:07'),
+(589,'1584 Ljubertsy Lane','','England',494,'22954','285710089439',0x00000000010100000035385B8AF577F6BF8C7560EFB4734940,'2014-09-25 22:33:38'),
+(590,'247 Jining Parkway','','Banjul',54,'53446','170115379190',0x0000000001010000001BE4E434FA9330C08A8F4FC8CEE72A40,'2014-09-25 22:31:04'),
+(591,'773 Dallas Manor','','Buenos Aires',424,'12664','914466027044',0x00000000010100000009C3802557204DC0B75CA21FB25C41C0,'2014-09-25 22:30:06'),
+(592,'1923 Stara Zagora Lane','','Nantou',546,'95179','182178609211',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:17'),
+(593,'1402 Zanzibar Boulevard','','Guanajuato',106,'71102','387448063440',0x000000000101000000FCB7DCAA353459C05CA8A1B206863440,'2014-09-25 22:32:03'),
+(594,'1464 Kursk Parkway','','Shandong',574,'17381','338758048786',0x0000000001010000008CA2073E86C65D40055669E6245B4240,'2014-09-25 22:30:44'),
+(595,'1074 Sanaa Parkway','','Loja',311,'22474','154124128457',0x00000000010100000092DBE51112CD53C00EF96706F1F10FC0,'2014-09-25 22:30:55'),
+(596,'1759 Niznekamsk Avenue','','al-Manama',14,'39414','864392582257',0x000000000101000000044D9539A74A49401224004922373A40,'2014-09-25 22:30:11'),
+(597,'32 Liaocheng Way','','Minas Gerais',248,'1944','410877354933',0x000000000101000000C2757BFFD5AC45C0424F1432A1C335C0,'2014-09-25 22:30:19'),
+(598,'42 Fontana Avenue','','Fejr',512,'14684','437829801725',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:09'),
+(599,'1895 Zhezqazghan Drive','','California',177,'36693','137809746111',0x0000000001010000003EC7ECD1407C5DC057FA1A930FE34040,'2014-09-25 22:33:51'),
+(600,'1837 Kaduna Parkway','','Inner Mongolia',241,'82580','640843562301',0x000000000101000000D61A4AEDC5465C400E64E2FB87834440,'2014-09-25 22:30:37'),
+(601,'844 Bucuresti Place','','Liaoning',242,'36603','935952366111',0x000000000101000000B88086EDDD6D5E407CED9925018D4340,'2014-09-25 22:30:37'),
+(602,'1101 Bucuresti Boulevard','','West Greece',401,'97661','199514580428',0x000000000101000000AAC1EA7E04BC3540E65F26E5491F4340,'2014-09-25 22:31:07'),
+(603,'1103 Quilmes Boulevard','','Piura',503,'52137','644021380889',0x000000000101000000AD9685C0DB2B54C09B012EC8969D13C0,'2014-09-25 22:32:34'),
+(604,'1331 Usak Boulevard','','Vaud',296,'61960','145308717464',0x000000000101000000CE273CB203881A40205734E72A424740,'2014-09-25 22:33:14'),
+(605,'1325 Fukuyama Street','','Heilongjiang',537,'27107','288241215394',0x00000000010100000017540A70700160401E1C47077F7D4740,'2014-09-25 22:30:44');
+COMMIT;
+DROP TABLE address;
diff --git a/mysql-test/suite/innodb_gis/t/rtree.test b/mysql-test/suite/innodb_gis/t/rtree.test
index 3a0e5311b32..58d81576b3e 100644
--- a/mysql-test/suite/innodb_gis/t/rtree.test
+++ b/mysql-test/suite/innodb_gis/t/rtree.test
@@ -234,3 +234,626 @@ DELETE FROM t1
WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((0 0,4 0, 4 4, 0 4, 0 0))'),g);
DROP TABLE t1;
+
+# Test with real world data.
+CREATE TABLE address (
+ address_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
+ address VARCHAR(50) NOT NULL,
+ address2 VARCHAR(50) DEFAULT NULL,
+ district VARCHAR(20) NOT NULL,
+ city_id SMALLINT UNSIGNED NOT NULL,
+ postal_code VARCHAR(10) DEFAULT NULL,
+ phone VARCHAR(20) NOT NULL,
+ location GEOMETRY NOT NULL,
+ last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (address_id),
+ SPATIAL KEY `idx_location` (location)
+)ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+SET AUTOCOMMIT=0;
+INSERT INTO `address` VALUES (1,'47 MySakila Drive',NULL,'Alberta',300,'','',0x0000000001010000003E0A325D63345CC0761FDB8D99D94840,'2014-09-25 22:30:27'),
+(2,'28 MySQL Boulevard',NULL,'QLD',576,'','',0x0000000001010000008E10D4DF812463404EE08C5022A23BC0,'2014-09-25 22:30:09'),
+(3,'23 Workhaven Lane',NULL,'Alberta',300,'','14033335568',0x000000000101000000CDC4196863345CC01DEE7E7099D94840,'2014-09-25 22:30:27'),
+(4,'1411 Lillydale Drive',NULL,'QLD',576,'','6172235589',0x0000000001010000005B0DE4341F26634042D6AE6422A23BC0,'2014-09-25 22:30:09'),
+(5,'1913 Hanoi Way','','Nagasaki',463,'35200','28303384290',0x00000000010100000028D1370E21376040ABB58BC45F944040,'2014-09-25 22:31:53'),
+(6,'1121 Loja Avenue','','California',449,'17886','838635286649',0x0000000001010000003C94579D8B525DC0E860472DDE0D4140,'2014-09-25 22:34:01'),
+(7,'692 Joliet Street','','Attika',38,'83579','448477190408',0x000000000101000000076F59CF5AB737404105D1A45EFD4240,'2014-09-25 22:31:07'),
+(8,'1566 Inegl Manor','','Mandalay',349,'53561','705814003527',0x00000000010100000006240626DCD857403C45B357C4753540,'2014-09-25 22:32:18'),
+(9,'53 Idfu Parkway','','Nantou',361,'42399','10655648674',0x0000000001010000001F813FFC7C2A5E40357A354069EA3740,'2014-09-25 22:33:16'),
+(10,'1795 Santiago de Compostela Way','','Texas',295,'18743','860452626434',0x00000000010100000050502F9D7BE058C0D0CF7932A4813B40,'2014-09-25 22:33:55'),
+(11,'900 Santiago de Compostela Parkway','','Central Serbia',280,'93896','716571220373',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:11'),
+(12,'478 Joliet Way','','Hamilton',200,'77948','657282285970',0x000000000101000000DC84D61E11E9654072B7353344E442C0,'2014-09-25 22:32:22'),
+(13,'613 Korolev Drive','','Masqat',329,'45844','380657522649',0x00000000010100000001023164D04B4D40CEAC003A279D3740,'2014-09-25 22:32:29'),
+(14,'1531 Sal Drive','','Esfahan',162,'53628','648856936185',0x000000000101000000DE0951195AD64940635A400D84534040,'2014-09-25 22:31:36'),
+(15,'1542 Tarlac Parkway','','Kanagawa',440,'1027','635297277345',0x000000000101000000B4CDE8A27C6B61406B7D361724C74140,'2014-09-25 22:31:53'),
+(16,'808 Bhopal Manor','','Haryana',582,'10672','465887807014',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:30'),
+(17,'270 Amroha Parkway','','Osmaniye',384,'29610','695479687538',0x0000000001010000001F436C55B71F4240A11408967E894240,'2014-09-25 22:33:27'),
+(18,'770 Bydgoszcz Avenue','','California',120,'16266','517338314235',0x0000000001010000006D63A2F7FC515EC04C040539835A4340,'2014-09-25 22:33:47'),
+(19,'419 Iligan Lane','','Madhya Pradesh',76,'72878','990911107354',0x000000000101000000B7B01303C9595340E6F10FB633413740,'2014-09-25 22:31:13'),
+(20,'360 Toulouse Parkway','','England',495,'54308','949312333307',0x000000000101000000860FDBCCD7DBE63FFDCFAB4BD7C44940,'2014-09-25 22:33:40'),
+(21,'270 Toulon Boulevard','','Kalmykia',156,'81766','407752414682',0x000000000101000000FD0BA947BF204640316D495865274740,'2014-09-25 22:32:48'),
+(22,'320 Brest Avenue','','Kaduna',252,'43331','747791594069',0x0000000001010000006D3425FECDC01D40623FD532630B2540,'2014-09-25 22:32:25'),
+(23,'1417 Lancaster Avenue','','Northern Cape',267,'72192','272572357893',0x000000000101000000FEE8E5C127C338404DED56E075BB3CC0,'2014-09-25 22:33:03'),
+(24,'1688 Okara Way','','Nothwest Border Prov',327,'21954','144453869132',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:30'),
+(25,'262 A Corua (La Corua) Parkway','','Dhaka',525,'34418','892775750063',0x000000000101000000F13790E4A87A5640E7F6370DF63F3840,'2014-09-25 22:30:12'),
+(26,'28 Charlotte Amalie Street','','Rabat-Sal-Zammour-Z',443,'37551','161968374323',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:16'),
+(27,'1780 Hino Boulevard','','Liepaja',303,'7716','902731229323',0x000000000101000000360F1604450435403CA3AD4A22424C40,'2014-09-25 22:31:58'),
+(28,'96 Tafuna Way','','Crdoba',128,'99865','934730187245',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:05'),
+(29,'934 San Felipe de Puerto Plata Street','','Sind',472,'99780','196495945706',0x0000000001010000008E6B8D52D3285140D58E876302F53B40,'2014-09-25 22:32:31'),
+(30,'18 Duisburg Boulevard','','',121,'58327','998009777982',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:08'),
+(31,'217 Botshabelo Place','','Southern Mindanao',138,'49521','665356572025',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:36'),
+(32,'1425 Shikarpur Manor','','Bihar',346,'65599','678220867005',0x0000000001010000007F9F16284E9E55408201840F25603940,'2014-09-25 22:31:20'),
+(33,'786 Aurora Avenue','','Yamaguchi',474,'65750','18461860151',0x000000000101000000E712584AA05E6040D15735ADB9FA4040,'2014-09-25 22:31:53'),
+(34,'1668 Anpolis Street','','Taipei',316,'50199','525255540978',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:15'),
+(35,'33 Gorontalo Way','','West Bengali',257,'30348','745994947458',0x0000000001010000001A828879FB17564061585936CEAB3640,'2014-09-25 22:31:18'),
+(36,'176 Mandaluyong Place','','Uttar Pradesh',239,'65213','627705991774',0x00000000010100000073309B0043A553409E3AA0B657743940,'2014-09-25 22:31:17'),
+(37,'127 Purnea (Purnia) Manor','','Piemonte',17,'79388','911872220378',0x0000000001010000002A2B97D75B382140F2892B1D62744640,'2014-09-25 22:31:42'),
+(38,'61 Tama Street','','Okayama',284,'94065','708403338270',0x0000000001010000001F7013A488B86040670696C8AA4A4140,'2014-09-25 22:31:49'),
+(39,'391 Callao Drive','','Midi-Pyrnes',544,'34021','440512153169',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:01'),
+(40,'334 Munger (Monghyr) Lane','','Markazi',31,'38145','481183273622',0x000000000101000000737275B636D848404B958334BE0B4140,'2014-09-25 22:31:36'),
+(41,'1440 Fukuyama Loop','','Henan',362,'47929','912257250465',0x0000000001010000005E3CCD1319225C405886DD1C537F4040,'2014-09-25 22:30:40'),
+(42,'269 Cam Ranh Parkway','','Chisinau',115,'34689','489783829737',0x000000000101000000AD97F0958ADB3C40CCD47F31B6804740,'2014-09-25 22:32:15'),
+(43,'306 Antofagasta Place','','Esprito Santo',569,'3989','378318851631',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:23'),
+(44,'671 Graz Street','','Oriental',353,'94399','680768868518',0x00000000010100000083F7FAFFDD7707C0F7B7BA5285954140,'2014-09-25 22:32:16'),
+(45,'42 Brindisi Place','','Yerevan',586,'16744','42384721397',0x000000000101000000281BC528BE4146403BD400EF2E174440,'2014-09-25 22:30:08'),
+(46,'1632 Bislig Avenue','','Nonthaburi',394,'61117','471675840679',0x000000000101000000935C59FDEC1F5940D5D0611976D32B40,'2014-09-25 22:33:20'),
+(47,'1447 Imus Way','','Tahiti',167,'48942','539758313890',0x00000000010100000090CE0A56E6B562C059BB9289008E31C0,'2014-09-25 22:31:02'),
+(48,'1998 Halifax Drive','','Lipetsk',308,'76022','177727722820',0x00000000010100000087985CD60EC943409F1738EA324D4A40,'2014-09-25 22:32:54'),
+(49,'1718 Valencia Street','','Antofagasta',27,'37359','675292816413',0x0000000001010000007E82D5A24F9951C0C46B4DA901A737C0,'2014-09-25 22:30:29'),
+(50,'46 Pjatigorsk Lane','','Moscow (City)',343,'23616','262076994845',0x0000000001010000009C51F355F2C4424002E3CFA6D9DF4B40,'2014-09-25 22:32:55'),
+(51,'686 Garland Manor','','Cear',247,'52535','69493378813',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:19'),
+(52,'909 Garland Manor','','Tatarstan',367,'69367','705800322606',0x000000000101000000376DC66988E949402CA85E6D7BD14B40,'2014-09-25 22:32:55'),
+(53,'725 Isesaki Place','','Mekka',237,'74428','876295323994',0x000000000101000000213361455799434061EB0896D98A3540,'2014-09-25 22:33:00'),
+(54,'115 Hidalgo Parkway','','Khartum',379,'80168','307703950263',0x00000000010100000004503173263D40404D0DD9E5004A2F40,'2014-09-25 22:33:11'),
+(55,'1135 Izumisano Parkway','','California',171,'48150','171822533480',0x0000000001010000009763C3E4D75B5DC0799A2732CE0B4140,'2014-09-25 22:33:50'),
+(56,'939 Probolinggo Loop','','Galicia',1,'4166','680428310138',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:08'),
+(57,'17 Kabul Boulevard','','Chiba',355,'38594','697760867968',0x000000000101000000EB257CA5E27C61406F70D86C9BED4140,'2014-09-25 22:31:51'),
+(58,'1964 Allappuzha (Alleppey) Street','','Yamaguchi',227,'48980','920811325222',0x000000000101000000C2572A5E1B876040D19A7A38DC144140,'2014-09-25 22:31:47'),
+(59,'1697 Kowloon and New Kowloon Loop','','Moskova',49,'57807','499352017190',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:47'),
+(60,'1668 Saint Louis Place','','Tahiti',397,'39072','347487831378',0x0000000001010000006FF3C64921B262C0F8F47DDD8E8931C0,'2014-09-25 22:31:02'),
+(61,'943 Tokat Street','','Vaduz',560,'45428','889318963672',0x0000000001010000007F784C93080B23400341800C1D924740,'2014-09-25 22:31:58'),
+(62,'1114 Liepaja Street','','Sarawak',282,'69226','212869228936',0x000000000101000000047FAE6C55955B408285DDC199E9F83F,'2014-09-25 22:32:00'),
+(63,'1213 Ranchi Parkway','','Karnataka',350,'94352','800024380485',0x000000000101000000000080279AD7C641AA21BB1CC0202B40,'2014-09-25 22:31:21'),
+(64,'81 Hodeida Way','','Rajasthan',231,'55561','250767749542',0x0000000001010000000A09BDA36BF25240F8B138526CEB3A40,'2014-09-25 22:31:17'),
+(65,'915 Ponce Place','','Basel-Stadt',56,'83980','1395251317',0x0000000001010000000D6146C2084B1E40E58B07A579C74740,'2014-09-25 22:33:12'),
+(66,'1717 Guadalajara Lane','','Missouri',441,'85505','914090181665',0x000000000101000000A926D247AA8C56C0A456F3774A504340,'2014-09-25 22:33:59'),
+(67,'1214 Hanoi Way','','Nebraska',306,'67055','491001136577',0x000000000101000000D6671888AF2A58C0C0E2152DE5684440,'2014-09-25 22:33:56'),
+(68,'1966 Amroha Avenue','','Sichuan',139,'70385','333489324603',0x0000000001010000000A7778190FE05A402F6013E346373F40,'2014-09-25 22:30:32'),
+(69,'698 Otsu Street','','Cayenne',105,'71110','409983924481',0x000000000101000000D879C0E1AA2A4AC0D57EC6E0BCBB1340,'2014-09-25 22:31:02'),
+(70,'1150 Kimchon Manor','','Skne ln',321,'96109','663449333709',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:11'),
+(71,'1586 Guaruj Place','','Hunan',579,'5135','947233365992',0x000000000101000000AD3A06BFE83F5C4083047B0217DA3B40,'2014-09-25 22:30:46'),
+(72,'57 Arlington Manor','','Madhya Pradesh',475,'48960','990214419142',0x0000000001010000008E6D63FDB069534027D9EA724A6E3940,'2014-09-25 22:31:27'),
+(73,'1031 Daugavpils Parkway','','Bchar',63,'59025','107137400143',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:29:59'),
+(74,'1124 Buenaventura Drive','','Mekka',13,'6856','407733804223',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:59'),
+(75,'492 Cam Ranh Street','','Eastern Visayas',61,'50805','565018274456',0x0000000001010000007500C45D3D335F40B90265AE675B2540,'2014-09-25 22:32:34'),
+(76,'89 Allappuzha (Alleppey) Manor','','National Capital Reg',517,'75444','255800440636',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:39'),
+(77,'1947 Poos de Caldas Boulevard','','Chiayi',114,'60951','427454485876',0x0000000001010000002F06C54524195E40B4475E8C37763740,'2014-09-25 22:33:14'),
+(78,'1206 Dos Quebradas Place','','So Paulo',431,'20207','241832790687',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:21'),
+(79,'1551 Rampur Lane','','Changhwa',108,'72394','251164340471',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:14'),
+(80,'602 Paarl Street','','Pavlodar',402,'98889','896314772871',0x000000000101000000359078C34740534032D010E912234A40,'2014-09-25 22:31:55'),
+(81,'1692 Ede Loop','','So Paulo',30,'9223','918711376618',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:16'),
+(82,'936 Salzburg Lane','','Uttar Pradesh',425,'96709','875756771675',0x0000000001010000000C0EE5FAAD4F5440CBF8F71917383A40,'2014-09-25 22:31:24'),
+(83,'586 Tete Way','','Kanagawa',256,'1079','18581624103',0x000000000101000000783B0CF79B716140E96D22E989A74140,'2014-09-25 22:31:48'),
+(84,'1888 Kabul Drive','','Oyo & Osun',217,'20936','701457319790',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:24'),
+(85,'320 Baiyin Parkway','','Mahajanga',319,'37307','223664661973',0x000000000101000000EAFD90C888284740CDC75AE8EF6E2FC0,'2014-09-25 22:31:59'),
+(86,'927 Baha Blanca Parkway','','Krim',479,'9495','821972242086',0x000000000101000000417DCB9C2E0E4140BC29406F857A4640,'2014-09-25 22:33:33'),
+(87,'929 Tallahassee Loop','','Gauteng',497,'74671','800716535041',0x000000000101000000647F8FB05E6B3C407F60D8ABD9403AC0,'2014-09-25 22:33:06'),
+(88,'125 Citt del Vaticano Boulevard','','Puebla',40,'67912','48417642933',0x000000000101000000536232B0E99B58C03D0D18247DE83240,'2014-09-25 22:32:02'),
+(89,'1557 Ktahya Boulevard','','England',88,'88002','720998247660',0x0000000001010000001B43A5B67908FCBF439D03159FE54A40,'2014-09-25 22:33:36'),
+(90,'870 Ashqelon Loop','','Songkhla',489,'84931','135117278909',0x000000000101000000E82510C017265940115A6A1899CB1C40,'2014-09-25 22:33:20'),
+(91,'1740 Portoviejo Avenue','','Sucre',480,'29932','198123170793',0x000000000101000000C4AD275F75D952C07A51BB5F059C2240,'2014-09-25 22:30:53'),
+(92,'1942 Ciparay Parkway','','Cheju',113,'82624','978987363654',0x00000000010100000048F13B97F3A25F40358EA2186AB34040,'2014-09-25 22:33:06'),
+(93,'1926 El Alto Avenue','','Buenos Aires',289,'75543','846225459260',0x000000000101000000AD05AC0B2EFA4CC0C5D0A057F27541C0,'2014-09-25 22:30:05'),
+(94,'1952 Chatsworth Drive','','Guangdong',332,'25958','991562402283',0x000000000101000000A5F386A08F085D406DF65157885A3840,'2014-09-25 22:30:40'),
+(95,'1370 Le Mans Avenue','','Brunei and Muara',53,'52163','345679835036',0x00000000010100000013E85D06ADBC5C402A0E5652DDC21340,'2014-09-25 22:30:23'),
+(96,'984 Effon-Alaiye Avenue','','Gois',183,'17119','132986892228',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:17'),
+(97,'832 Nakhon Sawan Manor','','Inner Mongolia',592,'49021','275595571388',0x000000000101000000535C55F6DDAD5E400000001D69FABC41,'2014-09-25 22:30:50'),
+(98,'152 Kitwe Parkway','','Caraga',82,'53182','835433605312',0x000000000101000000DF652BD43F945F4006CAB788396E2040,'2014-09-25 22:32:35'),
+(99,'1697 Tanauan Lane','','Punjab',399,'22870','4764773857',0x000000000101000000CA97063447E95240B933B852742A4040,'2014-09-25 22:31:22'),
+(100,'1308 Arecibo Way','','Georgia',41,'30695','6171054059',0x000000000101000000FC00FFEF637E54C0BD9EF9E648BC4040,'2014-09-25 22:33:43'),
+(101,'1599 Plock Drive','','Tete',534,'71986','817248913162',0x000000000101000000DC77561C18CB4040B443577D092830C0,'2014-09-25 22:32:18'),
+(102,'669 Firozabad Loop','','Abu Dhabi',12,'92265','412903167998',0x0000000001010000009C76E73F5AE14B404AD05FE811313840,'2014-09-25 22:33:35'),
+(103,'588 Vila Velha Manor','','Kyongsangbuk',268,'51540','333339908719',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:07'),
+(104,'1913 Kamakura Place','','Lipetsk',238,'97287','942570536750',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:49'),
+(105,'733 Mandaluyong Place','','Asir',2,'77459','196568435814',0x0000000001010000007823980FAD404540798FD89365373240,'2014-09-25 22:32:59'),
+(106,'659 Vaduz Drive','','Ha Darom',34,'49708','709935135487',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:40'),
+(107,'1177 Jelets Way','','Kwara & Kogi',220,'3305','484292626944',0x0000000001010000001767672CF53712407E3E25427E192140,'2014-09-25 22:32:24'),
+(108,'1386 Yangor Avenue','','Provence-Alpes-Cte',543,'80720','449216226468',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:01'),
+(109,'454 Nakhon Sawan Boulevard','','Funafuti',173,'76383','963887147572',0x0000000001010000005822ABB636666640FF74A84B6B0C21C0,'2014-09-25 22:33:31'),
+(110,'1867 San Juan Bautista Tuxtepec Avenue','','Ivanovo',225,'78311','547003310357',0x000000000101000000BC6DF0CF567C4440E2B034F0A37F4C40,'2014-09-25 22:32:48'),
+(111,'1532 Dzerzinsk Way','','Buenos Aires',334,'9599','330838016880',0x000000000101000000BF93BB74385D4DC0E207420D3A5541C0,'2014-09-25 22:30:06'),
+(112,'1002 Ahmadnagar Manor','','Mxico',213,'93026','371490777743',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:07'),
+(113,'682 Junan Way','','North West',273,'30418','622255216127',0x000000000101000000714683CAAEAA3A406AEDC73725DA3AC0,'2014-09-25 22:33:04'),
+(114,'804 Elista Drive','','Hubei',159,'61069','379804592943',0x0000000001010000009E013FF4EE5E5B40E7E099D0245F3E40,'2014-09-25 22:30:33'),
+(115,'1378 Alvorada Avenue','','Distrito Federal',102,'75834','272234298332',0x0000000001010000000C3444BA44B850C047B1378CDDF92440,'2014-09-25 22:34:03'),
+(116,'793 Cam Ranh Avenue','','California',292,'87057','824370924746',0x00000000010100000003AF3B82C0885DC0610212A859594140,'2014-09-25 22:33:55'),
+(117,'1079 Tel Aviv-Jaffa Boulevard','','Sucre',132,'10885','358178933857',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:04'),
+(118,'442 Rae Bareli Place','','Nordrhein-Westfalen',148,'24321','886636413768',0x000000000101000000C19EC085860F1B40E37ED12F5BB74940,'2014-09-25 22:31:04'),
+(119,'1107 Nakhon Sawan Avenue','','Mxico',365,'75149','867546627903',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:11'),
+(120,'544 Malm Parkway','','Central Java',403,'63502','386759646229',0x0000000001010000003AEF5A9D77575B4026F103A106C51BC0,'2014-09-25 22:31:34'),
+(121,'1967 Sincelejo Place','','Gujarat',176,'73644','577812616052',0x00000000010100000059912CBBBB2B52408DBC074378373740,'2014-09-25 22:31:16'),
+(122,'333 Goinia Way','','Texas',185,'78625','909029256431',0x0000000001010000002AE67BA1DB3F58C0E46B2AE67B5F4040,'2014-09-25 22:33:51'),
+(123,'1987 Coacalco de Berriozbal Loop','','al-Qalyubiya',476,'96065','787654415858',0x000000000101000000595AFC5C23403F40AFBA698E07203E40,'2014-09-25 22:30:58'),
+(124,'241 Mosul Lane','','Risaralda',147,'76157','765345144779',0x000000000101000000983A23A5B4EA52C06155BDFC4E5B1340,'2014-09-25 22:30:52'),
+(125,'211 Chiayi Drive','','Uttar Pradesh',164,'58186','665993880048',0x000000000101000000A44BA4D961C1534007F247AC20C73A40,'2014-09-25 22:31:15'),
+(126,'1175 Tanauan Way','','Lima',305,'64615','937222955822',0x000000000101000000848A60D2CE4153C0E5417A8A1C1628C0,'2014-09-25 22:32:33'),
+(127,'117 Boa Vista Way','','Uttar Pradesh',566,'6804','677976133614',0x00000000010100000085364AA8AAC0544086BAFE1312513940,'2014-09-25 22:31:29'),
+(128,'848 Tafuna Manor','','Ktahya',281,'45142','614935229095',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:27'),
+(129,'569 Baicheng Lane','','Gauteng',85,'60304','490211944645',0x000000000101000000D71E51FC73423C4048AE51C543363AC0,'2014-09-25 22:33:02'),
+(130,'1666 Qomsheh Drive','','So Paulo',410,'66255','582835362905',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:20'),
+(131,'801 Hagonoy Drive','','Smolensk',484,'8439','237426099212',0x0000000001010000001EB814A122054040BB8509FE12644B40,'2014-09-25 22:32:57'),
+(132,'1050 Garden Grove Avenue','','Slaskie',236,'4999','973047364353',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:42'),
+(133,'1854 Tieli Street','','Shandong',302,'15819','509492324775',0x0000000001010000007A820E0492FE5C408F0475255D3A4240,'2014-09-25 22:30:39'),
+(134,'758 Junan Lane','','Gois',190,'82639','935448624185',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:18'),
+(135,'1752 So Leopoldo Parkway','','Taka-Karpatia',345,'14014','252265130067',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:32'),
+(136,'898 Belm Manor','','Free State',87,'49757','707169393853',0x000000000101000000ED4CFCAC8DB43A409EAC623B29453DC0,'2014-09-25 22:33:02'),
+(137,'261 Saint Louis Way','','Coahuila de Zaragoza',541,'83401','321944036800',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:13'),
+(138,'765 Southampton Drive','','al-Qalyubiya',421,'4285','23712411567',0x0000000001010000001BEB877DA7343F409FBC7E77E12D3E40,'2014-09-25 22:30:57'),
+(139,'943 Johannesburg Avenue','','Maharashtra',417,'5892','90921003005',0x000000000101000000F27A3029BE7652405E2ADB2C03853240,'2014-09-25 22:31:24'),
+(140,'788 Atinsk Street','','Karnataka',211,'81691','146497509724',0x0000000001010000000000801B1998C64157A945E977E62E40,'2014-09-25 22:31:17'),
+(141,'1749 Daxian Place','','Gelderland',29,'11044','963369996279',0x000000000101000000E4CE96BDB6E0174000B0952B171C4A40,'2014-09-25 22:32:20'),
+(142,'1587 Sullana Lane','','Inner Mongolia',207,'85769','468060467018',0x000000000101000000870CF505BEE95B407422669BC0674440,'2014-09-25 22:30:35'),
+(143,'1029 Dzerzinsk Manor','','Ynlin',542,'57519','33173584456',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:16'),
+(144,'1666 Beni-Mellal Place','','Tennessee',123,'13377','9099941466',0x00000000010100000005D1A45E01D755C084CCDFCECF434240,'2014-09-25 22:33:48'),
+(145,'928 Jaffna Loop','','Hiroshima',172,'93762','581852137991',0x0000000001010000002F2988CBBBAB6040E2FF33EFDD3D4140,'2014-09-25 22:31:45'),
+(146,'483 Ljubertsy Parkway','','Scotland',149,'60562','581174211853',0x000000000101000000C53E5CCD95CC07C0FAFD518A0C3C4C40,'2014-09-25 22:33:36'),
+(147,'374 Bat Yam Boulevard','','Kilis',266,'97700','923261616249',0x000000000101000000184FF344C68E4240FD55DBA8A95B4240,'2014-09-25 22:33:26'),
+(148,'1027 Songkhla Manor','','Minsk',340,'30861','563660187896',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:13'),
+(149,'999 Sanaa Loop','','Gauteng',491,'3439','918032330119',0x0000000001010000000E0D309864193C40F234AA1D0F7939C0,'2014-09-25 22:33:05'),
+(150,'879 Newcastle Way','','Michigan',499,'90732','206841104594',0x000000000101000000916A8E62EFC154C08244C99A474A4540,'2014-09-25 22:34:01'),
+(151,'1337 Lincoln Parkway','','Saitama',555,'99457','597815221267',0x0000000001010000005E0E6036A6746140456227614BEE4140,'2014-09-25 22:31:55'),
+(152,'1952 Pune Lane','','Saint-Denis',442,'92150','354615066969',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:46'),
+(153,'782 Mosul Street','','Massachusetts',94,'25545','885899703621',0x000000000101000000E9C4D44C2DC151C0D1686105AE0A4540,'2014-09-25 22:33:46'),
+(154,'781 Shimonoseki Drive','','Michoacn de Ocampo',202,'95444','632316273199',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:06'),
+(155,'1560 Jelets Boulevard','','Shandong',291,'77777','189446090264',0x00000000010100000018D57D5B0B6A5D40ADDA3521AD184240,'2014-09-25 22:30:38'),
+(156,'1963 Moscow Place','','Assam',354,'64863','761379480249',0x000000000101000000203BB9F04D2C57405D595826B2593A40,'2014-09-25 22:31:21'),
+(157,'456 Escobar Way','','Jakarta Raya',232,'36061','719202533520',0x000000000101000000DDC2A9C516B65A4095CCFB49C6DB18C0,'2014-09-25 22:31:33'),
+(158,'798 Cianjur Avenue','','Shanxi',590,'76990','499408708580',0x00000000010100000013D6C6D889BF5B409B4BBBE2F3824140,'2014-09-25 22:30:49'),
+(159,'185 Novi Sad Place','','Bern',72,'41778','904253967161',0x00000000010100000000D0BC772FCA1D40377D2C335B794740,'2014-09-25 22:33:13'),
+(160,'1367 Yantai Manor','','Ondo & Ekiti',381,'21294','889538496300',0x000000000101000000C25E72ED555514408A7A1C61ACAA1C40,'2014-09-25 22:32:26'),
+(161,'1386 Nakhon Sawan Boulevard','','Pyongyang-si',420,'53502','368899174225',0x000000000101000000F4BA8FED46705F40A55F6C6B55844340,'2014-09-25 22:32:28'),
+(162,'369 Papeete Way','','North Carolina',187,'66639','170117068815',0x000000000101000000C49D66DCAFF253C07A2D324B4C094240,'2014-09-25 22:33:52'),
+(163,'1440 Compton Place','','North Austria',307,'81037','931059836497',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:10'),
+(164,'1623 Baha Blanca Manor','','Moskova',310,'81511','149981248346',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:54'),
+(165,'97 Shimoga Avenue','','Tel Aviv',533,'44660','177167004331',0x0000000001010000009A56AFC7E96341403192E2885A0A4040,'2014-09-25 22:31:41'),
+(166,'1740 Le Mans Loop','','Pays de la Loire',297,'22853','168476538960',0x000000000101000000452A8C2D04B9D23F0000006AB82DBD41,'2014-09-25 22:31:01'),
+(167,'1287 Xiangfan Boulevard','','Gifu',253,'57844','819416131190',0x0000000001010000006AE514D3BB1B61408141D2A755B54140,'2014-09-25 22:31:48'),
+(168,'842 Salzburg Lane','','Adana',529,'3313','697151428760',0x0000000001010000007207A0072DD5414093228D6555A64240,'2014-09-25 22:33:29'),
+(169,'154 Tallahassee Loop','','Xinxiang',199,'62250','935508855935',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:34'),
+(170,'710 San Felipe del Progreso Avenue','','Lilongwe',304,'76901','843801144113',0x00000000010100000089C855D1C4E44040501D064E11EF2BC0,'2014-09-25 22:31:59'),
+(171,'1540 Wroclaw Drive','','Maharashtra',107,'62686','182363341674',0x0000000001010000004E10D0D8F2D253407CFB294476F23340,'2014-09-25 22:31:14'),
+(172,'475 Atinsk Way','','Gansu',240,'59571','201705577290',0x0000000001010000007872970E678C59405544978114404340,'2014-09-25 22:30:36'),
+(173,'1294 Firozabad Drive','','Jiangxi',407,'70618','161801569569',0x000000000101000000EED7F8A7AF775C402332079C00943B40,'2014-09-25 22:30:40'),
+(174,'1877 Ezhou Lane','','Rajasthan',550,'63337','264541743403',0x00000000010100000029722DFF466C52401969F34938923840,'2014-09-25 22:31:28'),
+(175,'316 Uruapan Street','','Perak',223,'58194','275788967899',0x0000000001010000005A3629BB4F4559400AC5B18927561240,'2014-09-25 22:31:59'),
+(176,'29 Pyongyang Loop','','Batman',58,'47753','734780743462',0x0000000001010000001C430070EC9044403C8963B895F14240,'2014-09-25 22:33:23'),
+(177,'1010 Klerksdorp Way','','Steiermark',186,'6802','493008546874',0x000000000101000000CFEE35A90DE72E409C0425BB88884740,'2014-09-25 22:30:10'),
+(178,'1848 Salala Boulevard','','Miranda',373,'25220','48265851133',0x0000000001010000006D08E984ABB150C02F90FBB1A43B2440,'2014-09-25 22:34:04'),
+(179,'431 Xiangtan Avenue','','Kerala',18,'4854','230250973122',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:10'),
+(180,'757 Rustenburg Avenue','','Skikda',483,'89668','506134035434',0x000000000101000000BFD76BD509A31B4063867C8626704240,'2014-09-25 22:30:01'),
+(181,'146 Johannesburg Way','','Tamaulipas',330,'54132','953689007081',0x0000000001010000003C45B357446058C0EAD621ED35E13940,'2014-09-25 22:32:09'),
+(182,'1891 Rizhao Boulevard','','So Paulo',456,'47288','391065549876',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:21'),
+(183,'1089 Iwatsuki Avenue','','Kirov',270,'35109','866092335135',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:50'),
+(184,'1410 Benin City Parkway','','Risaralda',405,'29747','104150372603',0x0000000001010000007C4F9B278DEC52C0795BE9B5D9401340,'2014-09-25 22:30:52'),
+(185,'682 Garden Grove Place','','Tennessee',333,'67497','72136330362',0x0000000001010000004204C188228356C06B4F24F323934140,'2014-09-25 22:33:57'),
+(186,'533 al-Ayn Boulevard','','California',126,'8862','662227486184',0x000000000101000000BF2264C5158E5DC08533AE6EABF24040,'2014-09-25 22:33:48'),
+(187,'1839 Szkesfehrvr Parkway','','Gois',317,'55709','947468818183',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:20'),
+(188,'741 Ambattur Manor','','Noord-Brabant',438,'43310','302590383819',0x000000000101000000699E6D7F78371540EF0D74A37ED94940,'2014-09-25 22:32:21'),
+(189,'927 Barcelona Street','','Chaharmahal va Bakht',467,'65121','951486492670',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:38'),
+(190,'435 0 Way','','West Bengali',195,'74750','760171523969',0x000000000101000000D9846A3906075640037168DB7A0F3640,'2014-09-25 22:31:16'),
+(191,'140 Chiayi Parkway','','Sumy',506,'38982','855863906434',0x0000000001010000002C43C1317066414051BB5F05F8754940,'2014-09-25 22:33:34'),
+(192,'1166 Changhwa Street','','Caraga',62,'58852','650752094490',0x0000000001010000009DB756201F715F40F53E9F1221832140,'2014-09-25 22:32:34'),
+(193,'891 Novi Sad Manor','','Ontario',383,'5379','247646995453',0x0000000001010000005E49F25C5FB653C0DE6AE74537F34540,'2014-09-25 22:30:28'),
+(194,'605 Rio Claro Parkway','','Tabora',513,'49348','352469351088',0x0000000001010000004E8B0B51CF694040DF67017F9D1014C0,'2014-09-25 22:33:18'),
+(195,'1077 San Felipe de Puerto Plata Place','','Rostov-na-Donu',369,'65387','812824036424',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:56'),
+(196,'9 San Miguel de Tucumn Manor','','Uttar Pradesh',169,'90845','956188728558',0x00000000010100000067DBC424B7995340A461E75C40263B40,'2014-09-25 22:31:15'),
+(197,'447 Surakarta Loop','','Nyanza',271,'10428','940830176580',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:56'),
+(198,'345 Oshawa Boulevard','','Tokyo-to',204,'32114','104491201771',0x000000000101000000FB5E9E29CF6C61404BFCF61A27D64140,'2014-09-25 22:31:45'),
+(199,'1792 Valle de la Pascua Place','','Nordrhein-Westfalen',477,'15540','419419591240',0x000000000101000000E9BD8CBD720C204056725F18FA6F4940,'2014-09-25 22:31:06'),
+(200,'1074 Binzhou Manor','','Baden-Wrttemberg',325,'36490','331132568928',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:05'),
+(201,'817 Bradford Loop','','Jiangsu',109,'89459','264286442804',0x000000000101000000C3E1BB830EFD5D4006B243A10AC63F40,'2014-09-25 22:30:31'),
+(202,'955 Bamenda Way','','Ondo & Ekiti',218,'1545','768481779568',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:24'),
+(203,'1149 A Corua (La Corua) Boulevard','','Haiphong',194,'95824','470884141195',0x0000000001010000007573F1B7BDAB5A4050A0997164DD3440,'2014-09-25 22:34:06'),
+(204,'387 Mwene-Ditu Drive','','Ahal',35,'8073','764477681869',0x000000000101000000B0253F3D11314D40A538A2D68FFA4240,'2014-09-25 22:33:30'),
+(205,'68 Molodetno Manor','','Nordrhein-Westfalen',575,'4662','146640639760',0x000000000101000000EEF3739E0C691D40FE486CD2C8B84940,'2014-09-25 22:31:06'),
+(206,'642 Nador Drive','','Maharashtra',77,'3924','369050085652',0x000000000101000000559D7A4908F25240E010AAD4EC0B3540,'2014-09-25 22:31:13'),
+(207,'1688 Nador Lane','','Sulawesi Utara',184,'61613','652218196731',0x000000000101000000E358727044945E4093F139C148B9E83F,'2014-09-25 22:31:32'),
+(208,'1215 Pyongyang Parkway','','Usak',557,'25238','646237101779',0x000000000101000000019E59B7E6673D40735E08DE35564340,'2014-09-25 22:33:30'),
+(209,'1679 Antofagasta Street','','Alto Paran',122,'86599','905903574913',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:32'),
+(210,'1304 s-Hertogenbosch Way','','Santa Catarina',83,'10925','90336226227',0x000000000101000000BDEAB765768848C05755D40561EB3AC0,'2014-09-25 22:30:16'),
+(211,'850 Salala Loop','','Kitaa',371,'10800','403404780639',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:07'),
+(212,'624 Oshawa Boulevard','','West Bengali',51,'89959','49677664184',0x0000000001010000000FBCB5A7BF315640EA7CD34F93383940,'2014-09-25 22:31:11'),
+(213,'43 Dadu Avenue','','Rajasthan',74,'4855','95666951770',0x000000000101000000BCF957A0A7A852404046E5CBB0583940,'2014-09-25 22:31:12'),
+(214,'751 Lima Loop','','Aden',7,'99405','756460337785',0x0000000001010000005ECF21BAB1844640A9007388138F2940,'2014-09-25 22:34:08'),
+(215,'1333 Haldia Street','','Jilin',174,'82161','408304391718',0x00000000010100000007A51E5844345F404CE71E6D77974640,'2014-09-25 22:30:33'),
+(216,'660 Jedda Boulevard','','Washington',65,'25053','168758068397',0x00000000010100000009EEF60FD88C5EC03C331C2A21CE4740,'2014-09-25 22:33:45'),
+(217,'1001 Miyakonojo Lane','','Taizz',518,'67924','584316724815',0x0000000001010000006642DD51AD024640782C1103B8282B40,'2014-09-25 22:34:11'),
+(218,'226 Brest Manor','','California',508,'2299','785881412500',0x000000000101000000CF9F36AA53825EC0B54D96FF35AF4240,'2014-09-25 22:34:02'),
+(219,'1229 Valencia Parkway','','Haskovo',498,'99124','352679173732',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:24'),
+(220,'1201 Qomsheh Manor','','Gois',28,'21464','873492228462',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:15'),
+(221,'866 Shivapuri Manor','','Uttar Pradesh',448,'22474','778502731092',0x000000000101000000940BDF0C48A4534072648ADE4E953C40,'2014-09-25 22:31:26'),
+(222,'1168 Najafabad Parkway','','Kabol',251,'40301','886649065861',0x0000000001010000009173AC9C074B51408EBDCDD199434140,'2014-09-25 22:29:59'),
+(223,'1244 Allappuzha (Alleppey) Place','','Buenos Aires',567,'20657','991802825778',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:08'),
+(224,'1842 Luzinia Boulevard','','Zanzibar West',593,'94420','706878974831',0x00000000010100000045E169E855994340B62C5F97E1A718C0,'2014-09-25 22:33:19'),
+(225,'1926 Gingoog Street','','Sisilia',511,'22824','469738825391',0x0000000001010000004DD9E907758D2E40719AF4ADC58A4240,'2014-09-25 22:31:44'),
+(226,'810 Palghat (Palakkad) Boulevard','','Jaroslavl',235,'73431','516331171356',0x00000000010100000069D48DC1D4EF43400294D0A79FD04C40,'2014-09-25 22:32:49'),
+(227,'1820 Maring Parkway','','Punjab',324,'88307','99760893676',0x0000000001010000001E053EF5FE5E52406C617193AC4A4040,'2014-09-25 22:32:30'),
+(228,'60 Poos de Caldas Street','','Rajasthan',243,'82338','963063788669',0x00000000010100000069EED7536140524079605B9AB6443A40,'2014-09-25 22:31:18'),
+(229,'1014 Loja Manor','','Tamil Nadu',22,'66851','460795526514',0x000000000101000000803E366E560A5440A1212DDF44322A40,'2014-09-25 22:31:10'),
+(230,'201 Effon-Alaiye Way','','Asuncin',37,'64344','684192903087',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:31'),
+(231,'430 Alessandria Loop','','Saarland',439,'47446','669828224459',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:06'),
+(232,'754 Valencia Place','','Phnom Penh',406,'87911','594319417514',0x0000000001010000009093D3E89F3A5A40AACCDE63FA1F2740,'2014-09-25 22:30:25'),
+(233,'356 Olomouc Manor','','Gois',26,'93323','22326410776',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:15'),
+(234,'1256 Bislig Boulevard','','Botosani',86,'50598','479007229460',0x00000000010100000085059C4AABAA3A408DAC46C032E04740,'2014-09-25 22:32:46'),
+(235,'954 Kimchon Place','','West Bengali',559,'42420','541327526474',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:28'),
+(236,'885 Yingkou Manor','','Kaduna',596,'31390','588964509072',0x00000000010100000006CF296D16E41E4038E3EAB6FA382640,'2014-09-25 22:32:28'),
+(237,'1736 Cavite Place','','Qina',216,'98775','431770603551',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:56'),
+(238,'346 Skikda Parkway','','Hawalli',233,'90628','630424482919',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:57'),
+(239,'98 Stara Zagora Boulevard','','Valle',96,'76448','610173756082',0x00000000010100000084CD4AA4FE4153C0DB9953138E0A0F40,'2014-09-25 22:30:51'),
+(240,'1479 Rustenburg Boulevard','','Southern Tagalog',527,'18727','727785483194',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:40'),
+(241,'647 A Corua (La Corua) Street','','Chollanam',357,'36971','792557457753',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:07'),
+(242,'1964 Gijn Manor','','Karnataka',473,'14408','918119601885',0x000000000101000000BBC3DCA458E45240DA4246F6F7DC2B40,'2014-09-25 22:31:26'),
+(243,'47 Syktyvkar Lane','','West Java',118,'22236','63937119031',0x000000000101000000EDABBC2E8DB05A40C3C1397E037E1AC0,'2014-09-25 22:31:31'),
+(244,'1148 Saarbrcken Parkway','','Fukushima',226,'1921','137773001988',0x000000000101000000AD8ACB4C449C614053F8229001874240,'2014-09-25 22:31:47'),
+(245,'1103 Bilbays Parkway','','Hubei',578,'87660','279979529227',0x000000000101000000A76ED34444095C401234C1CB67054040,'2014-09-25 22:30:45'),
+(246,'1246 Boksburg Parkway','','Hebei',422,'28349','890283544295',0x000000000101000000B66A323EA7E55D40E508BE0E41F74340,'2014-09-25 22:30:41'),
+(247,'1483 Pathankot Street','','Tucumn',454,'37288','686015532180',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:06'),
+(248,'582 Papeete Loop','','Central Visayas',294,'27722','569868543137',0x0000000001010000001F189BB1C3FC5E407DC4F9E5DD9E2440,'2014-09-25 22:32:38'),
+(249,'300 Junan Street','','Kyonggi',553,'81314','890289150158',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:08'),
+(250,'829 Grand Prairie Way','','Paran',328,'6461','741070712873',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:20'),
+(251,'1473 Changhwa Parkway','','Mxico',124,'75933','266798132374',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:03'),
+(252,'1309 Weifang Street','','Florida',520,'57338','435785045362',0x000000000101000000EC0CF8A1F71155C0995A006432703E40,'2014-09-25 22:34:02'),
+(253,'1760 Oshawa Manor','','Tianjin',535,'38140','56257502250',0x000000000101000000FBBD5EAB4E4B5D40EB0A6C8434924340,'2014-09-25 22:30:43'),
+(254,'786 Stara Zagora Way','','Oyo & Osun',390,'98332','716256596301',0x000000000101000000DB45E22F77770F4073C8BC44AB691F40,'2014-09-25 22:32:27'),
+(255,'1966 Tonghae Street','','Anhalt Sachsen',198,'36481','567359279425',0x0000000001010000000000009825D59D41450A0A2879C84940,'2014-09-25 22:31:05'),
+(256,'1497 Yuzhou Drive','','England',312,'3433','246810237916',0x000000000101000000CC4642B68718C0BFCA822E8617C14940,'2014-09-25 22:33:37'),
+(258,'752 Ondo Loop','','Miyazaki',338,'32474','134673576619',0x00000000010100000048AD8B36226260408871EDFABBBB3F40,'2014-09-25 22:31:50'),
+(259,'1338 Zalantun Lane','','Minas Gerais',413,'45403','840522972766',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:21'),
+(260,'127 Iwakuni Boulevard','','Central Luzon',192,'20777','987442542471',0x0000000001010000000E6954E0E42E5E40AF05627E13AB2D40,'2014-09-25 22:32:37'),
+(261,'51 Laredo Avenue','','Sagaing',342,'68146','884536620568',0x0000000001010000008720BD97B1C85740D4D7F335CB1B3640,'2014-09-25 22:32:18'),
+(262,'771 Yaound Manor','','Sofala',64,'86768','245477603573',0x000000000101000000103345CA606B414046CB2665F7D733C0,'2014-09-25 22:32:17'),
+(263,'532 Toulon Street','','Santiago',460,'69517','46871694740',0x000000000101000000ECD33B269CAC51C09AB67F65A5733340,'2014-09-25 22:30:55'),
+(264,'1027 Banjul Place','','West Bengali',197,'50390','538241037443',0x000000000101000000FE14223BCA1A5640AC6F6072A3EE3640,'2014-09-25 22:31:16'),
+(265,'1158 Mandi Bahauddin Parkway','','Shanxi',136,'98484','276555730211',0x000000000101000000ECC84741A6525C40A93C7084FB0B4440,'2014-09-25 22:30:32'),
+(266,'862 Xintai Lane','','Cagayan Valley',548,'30065','265153400632',0x00000000010100000015580053866E5E408A5CCBBFF19C3140,'2014-09-25 22:32:41'),
+(267,'816 Cayenne Parkway','','Manab',414,'93629','282874611748',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:56'),
+(268,'1831 Nam Dinh Loop','','National Capital Reg',323,'51990','322888976727',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:38'),
+(269,'446 Kirovo-Tepetsk Lane','','Osaka',203,'19428','303967439816',0x0000000001010000008D94D2D8C3F36040608CED5AE7554140,'2014-09-25 22:31:45'),
+(270,'682 Halisahar Place','','Severn Morava',378,'20536','475553436330',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:54'),
+(271,'1587 Loja Manor','','Salzburg',447,'5410','621625204422',0x0000000001010000002C83C53C86162A405886DD1C53E64740,'2014-09-25 22:30:10'),
+(272,'1762 Paarl Parkway','','Hunan',298,'53928','192459639410',0x00000000010100000067333D177CDB5B40DBA8A9C024B03B40,'2014-09-25 22:30:39'),
+(273,'1519 Ilorin Place','','Kerala',395,'49298','357445645426',0x0000000001010000000C4FF921002A5340BD772F52838C2540,'2014-09-25 22:31:21'),
+(274,'920 Kumbakonam Loop','','California',446,'75090','685010736240',0x00000000010100000012EF4ADCF4695EC01B95E535C0564240,'2014-09-25 22:34:00'),
+(275,'906 Goinia Way','','Wielkopolskie',255,'83565','701767622697',0x0000000001010000007FA2B2614D1732404064366D6BE14940,'2014-09-25 22:32:42'),
+(276,'1675 Xiangfan Manor','','Tamil Nadu',283,'11763','271149517630',0x00000000010100000042B687180AD95340EE4108C897EC2540,'2014-09-25 22:31:20'),
+(277,'85 San Felipe de Puerto Plata Drive','','Shandong',584,'46063','170739645687',0x000000000101000000EA605859365C5E40EF1010DDFDBC4240,'2014-09-25 22:30:48'),
+(278,'144 South Hill Loop','','Guanajuato',445,'2012','45387294817',0x0000000001010000002B84D558424C59C0699B2CFF6B923440,'2014-09-25 22:32:11'),
+(279,'1884 Shikarpur Avenue','','Haryana',263,'85548','959949395183',0x0000000001010000002CE395DA413F5340EB460EC7A9B03D40,'2014-09-25 22:31:19'),
+(280,'1980 Kamjanets-Podilskyi Street','','Illinois',404,'89502','874337098891',0x000000000101000000167CE420B26556C0B7966EB7C9584440,'2014-09-25 22:33:57'),
+(281,'1944 Bamenda Way','','Michigan',573,'24645','75975221996',0x000000000101000000B8B64B76C7C154C0EF254344203D4540,'2014-09-25 22:34:03'),
+(282,'556 Baybay Manor','','Oyo & Osun',374,'55802','363982224739',0x000000000101000000F5C6FFD3C30E1140FC30E7BE41502040,'2014-09-25 22:32:25'),
+(283,'457 Tongliao Loop','','Bursa',222,'56254','880756161823',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:25'),
+(284,'600 Bradford Street','','East Azerbaidzan',514,'96204','117592274996',0x000000000101000000EE4E2D115E25474044FF5FD09D0A4340,'2014-09-25 22:31:40'),
+(285,'1006 Santa Brbara dOeste Manor','','Ondo & Ekiti',389,'36229','85059738746',0x000000000101000000FBC67CE5E6581640531A7B40EAC81C40,'2014-09-25 22:32:26'),
+(286,'1308 Sumy Loop','','Fujian',175,'30657','583021225407',0x000000000101000000DC7AF25597D35D409617AAACB70F3A40,'2014-09-25 22:30:34'),
+(287,'1405 Chisinau Place','','Ponce',411,'8160','62781725285',0x000000000101000000974341DF4CA750C03F219628D6023240,'2014-09-25 22:32:45'),
+(288,'226 Halifax Street','','Xinxiang',277,'58492','790651020929',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:38'),
+(289,'1279 Udine Parkway','','Edo & Delta',69,'75860','195003555232',0x000000000101000000FFB7EDD68D8216408FF4B3A217571940,'2014-09-25 22:32:23'),
+(290,'1336 Benin City Drive','','Shiga',386,'46044','341242939532',0x000000000101000000D5810761C9FB60401B07A8BA91804140,'2014-09-25 22:31:53'),
+(291,'1155 Liaocheng Place','','Oyo & Osun',152,'22650','558236142492',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:23'),
+(292,'1993 Tabuk Lane','','Tamil Nadu',522,'64221','648482415405',0x0000000001010000002AF3A0EA210854407F94C78965D92940,'2014-09-25 22:31:27'),
+(293,'86 Higashiosaka Lane','','Guanajuato',563,'33768','957128697225',0x0000000001010000002DAF5C6F1B4C59C07F34F7EBA9643440,'2014-09-25 22:32:14'),
+(294,'1912 Allende Manor','','Kowloon and New Kowl',279,'58124','172262454487',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:09'),
+(295,'544 Tarsus Boulevard','','Gurico',562,'53145','892523334',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:05'),
+(296,'1936 Cuman Avenue','','Virginia',433,'61195','976798660411',0x000000000101000000FD7B3A6840FC53C065F4ED6EAFA24240,'2014-09-25 22:33:58'),
+(297,'1192 Tongliao Street','','Sharja',470,'19065','350970907017',0x000000000101000000AA27F38FBEB44B4053E68B625E563940,'2014-09-25 22:33:35'),
+(298,'44 Najafabad Way','','Baskimaa',146,'61391','96604821070',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:08'),
+(299,'32 Pudukkottai Lane','','Ohio',140,'38834','967274728547',0x000000000101000000077AA86D430C55C0409C2C5A25E14340,'2014-09-25 22:33:49'),
+(300,'661 Chisinau Lane','','Pietari',274,'8856','816436065431',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:51'),
+(301,'951 Stara Zagora Manor','','Punjab',400,'98573','429925609431',0x0000000001010000001E296C50C51953405651723DC0533E40,'2014-09-25 22:31:22'),
+(302,'922 Vila Velha Loop','','Maharashtra',9,'4085','510737228015',0x000000000101000000738F5B8242AF5240612129D835183340,'2014-09-25 22:31:10'),
+(303,'898 Jining Lane','','Pohjois-Pohjanmaa',387,'40070','161643343536',0x0000000001010000003DFB80F6D9773940C8D0B183CA405040,'2014-09-25 22:31:00'),
+(304,'1635 Kuwana Boulevard','','Hiroshima',205,'52137','710603868323',0x000000000101000000AA944330B38E6040247035FCB8324140,'2014-09-25 22:31:46'),
+(305,'41 El Alto Parkway','','Maharashtra',398,'56883','51917807050',0x000000000101000000D487E41A55315340BC3088FEBF443340,'2014-09-25 22:31:22'),
+(306,'1883 Maikop Lane','','Kaliningrad',254,'68469','96110042435',0x00000000010100000020DF94A8CD82344015D918856E5A4B40,'2014-09-25 22:32:50'),
+(307,'1908 Gaziantep Place','','Liaoning',536,'58979','108053751300',0x0000000001010000004DAA6C0EC6E65E408E9F7C30DF344540,'2014-09-25 22:30:43'),
+(308,'687 Alessandria Parkway','','Sanaa',455,'57587','407218522294',0x0000000001010000000C60257A741A4640854A123A9EB52E40,'2014-09-25 22:34:10'),
+(309,'827 Yuncheng Drive','','Callao',99,'79047','504434452842',0x000000000101000000C2514DA48F4753C0271CD544FA1C28C0,'2014-09-25 22:32:32'),
+(310,'913 Coacalco de Berriozbal Loop','','Texas',33,'42141','262088367001',0x00000000010100000023371EC7EA4658C0A86851442B5E4040,'2014-09-25 22:33:43'),
+(311,'715 So Bernardo do Campo Lane','','Kedah',507,'84804','181179321332',0x000000000101000000D8DBC1E3361F5940520DFB3DB1961640,'2014-09-25 22:32:00'),
+(312,'1354 Siegen Street','','Rio de Janeiro',25,'80184','573441801529',0x0000000001010000009146054EB62846C0FCA0D398B50137C0,'2014-09-25 22:30:15'),
+(313,'1191 Sungai Petani Boulevard','','Missouri',262,'9668','983259819766',0x00000000010100000055890D7107A557C0CB7564F6C38C4340,'2014-09-25 22:33:54'),
+(314,'1224 Huejutla de Reyes Boulevard','','Lombardia',91,'70923','806016930576',0x000000000101000000D85B6F40F06D24405EEE38EA8DC44640,'2014-09-25 22:31:43'),
+(315,'543 Bergamo Avenue','','Minas Gerais',215,'59686','103602195112',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:18'),
+(316,'746 Joliet Lane','','Kursk',286,'94878','688485191923',0x00000000010100000085949F54FB174240E0DCBAF660DE4940,'2014-09-25 22:32:52'),
+(317,'780 Kimberley Way','','Tabuk',515,'17032','824396883951',0x0000000001010000001BD47E6B274942408B53AD8559663C40,'2014-09-25 22:33:00'),
+(318,'1774 Yaound Place','','Hubei',166,'91400','613124286867',0x0000000001010000002A00C633E8B15C404C63C5BA027D3E40,'2014-09-25 22:30:33'),
+(319,'1957 Yantai Lane','','So Paulo',490,'59255','704948322302',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:22'),
+(320,'1542 Lubumbashi Boulevard','','Tel Aviv',57,'62472','508800331065',0x000000000101000000765F84DF3C6041403CAB60AF0B034040,'2014-09-25 22:31:41'),
+(321,'651 Pathankot Loop','','Maharashtra',336,'59811','139378397418',0x0000000001010000002198FE8062A952408AC168FBFCD23040,'2014-09-25 22:31:20'),
+(322,'1359 Zhoushan Parkway','','Streymoyar',545,'29763','46568045367',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:59'),
+(323,'1769 Iwaki Lane','','Kujawsko-Pomorskie',97,'25787','556100547674',0x000000000101000000487B7203F4013240837EF0EBD18F4A40,'2014-09-25 22:32:41'),
+(324,'1145 Vilnius Manor','','Mxico',451,'73170','674805712553',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:12'),
+(325,'1892 Nabereznyje Telny Lane','','Tutuila',516,'28396','478229987054',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:02'),
+(326,'470 Boksburg Street','','Central',81,'97960','908029859266',0x000000000101000000DAE78C83263855405BE21291AB023B40,'2014-09-25 22:32:19'),
+(327,'1427 A Corua (La Corua) Place','','Buenos Aires',45,'85799','972574862516',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:04'),
+(328,'479 San Felipe del Progreso Avenue','','Morelos',130,'54949','869051782691',0x000000000101000000C87E710484BC58C039FD8F02FACD3240,'2014-09-25 22:32:04'),
+(329,'867 Benin City Avenue','','Henan',591,'78543','168884817145',0x000000000101000000A0F2F972B05D5C405D68531AD6144140,'2014-09-25 22:30:50'),
+(330,'981 Kumbakonam Place','','Distrito Federal',89,'87611','829116184079',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:17'),
+(331,'1016 Iwakuni Street','','St George',269,'49833','961370847344',0x000000000101000000A1DC11A9C49C4EC0D11B936A44512A40,'2014-09-25 22:32:59'),
+(332,'663 Baha Blanca Parkway','','Adana',5,'33463','834418779292',0x000000000101000000BE72182719AA4140CCD1E3F736804240,'2014-09-25 22:33:22'),
+(333,'1860 Taguig Loop','','West Java',119,'59550','38158430589',0x00000000010100000042ACA34FD0E55A40D698C6E52ED81BC0,'2014-09-25 22:31:32'),
+(334,'1816 Bydgoszcz Loop','','Dhaka',234,'64308','965273813662',0x000000000101000000A717C627AE7C564080BD1D3C6EEB3840,'2014-09-25 22:30:12'),
+(335,'587 Benguela Manor','','Illinois',42,'91590','165450987037',0x00000000010100000097CEE2207C1456C0DDEFABCD5AE14440,'2014-09-25 22:33:44'),
+(336,'430 Kumbakonam Drive','','Santa F',457,'28814','105470691550',0x00000000010100000004C1882249304DC055DF54FF7B4E41C0,'2014-09-25 22:30:07'),
+(337,'1838 Tabriz Lane','','Dhaka',143,'1195','38988715447',0x0000000001010000001A5D948F139A5640C4D21B49DDB53740,'2014-09-25 22:30:12'),
+(338,'431 Szkesfehrvr Avenue','','Baki',48,'57828','119501405123',0x000000000101000000A77686A92DF248400FAECACF57304440,'2014-09-25 22:30:11'),
+(339,'503 Sogamoso Loop','','Sumqayit',505,'49812','834626715837',0x0000000001010000006C83C94395D548402C8EB9217C4B4440,'2014-09-25 22:30:11'),
+(340,'507 Smolensk Loop','','Sousse',492,'22971','80303246192',0x000000000101000000298EA8F52346254075DA649EA6E94140,'2014-09-25 22:33:21'),
+(341,'1920 Weifang Avenue','','Uttar Pradesh',427,'15643','869507847714',0x0000000001010000001F3EFA70DAC153407410CF6D1DCF3C40,'2014-09-25 22:31:25'),
+(342,'124 al-Manama Way','','Hiroshima',382,'52368','647899404952',0x0000000001010000004BE07B244AA760407B0ED18D55354140,'2014-09-25 22:31:52'),
+(343,'1443 Mardan Street','','Western Cape',392,'31483','231383037471',0x000000000101000000FB6074D42CF73240B0B03B3833DA40C0,'2014-09-25 22:33:05'),
+(344,'1909 Benguela Lane','','Henan',581,'19913','624138001031',0x000000000101000000F4AD6AA480775C4066EB2AEE89A74140,'2014-09-25 22:30:47'),
+(345,'68 Ponce Parkway','','Hanoi',201,'85926','870635127812',0x0000000001010000005DF525C0D5755A4000F61B3746063540,'2014-09-25 22:34:06'),
+(346,'1217 Konotop Avenue','','Gelderland',151,'504','718917251754',0x000000000101000000F438679F22A2164019B4EB3944044A40,'2014-09-25 22:32:20'),
+(347,'1293 Nam Dinh Way','','Roraima',84,'71583','697656479977',0x0000000001010000008EE6C8CA2F564EC0D9C23DE0CB8E0640,'2014-09-25 22:30:17'),
+(348,'785 Vaduz Street','','Baja California',335,'36170','895616862749',0x0000000001010000000D61EB0816DD5CC07DB328475C504040,'2014-09-25 22:32:10'),
+(349,'1516 Escobar Drive','','Tongatapu',370,'46069','64536069371',0x0000000001010000009132987575E665C0BE11DDB3AE2335C0,'2014-09-25 22:33:20'),
+(350,'1628 Nagareyama Lane','','Central',453,'60079','20064292617',0x00000000010100000019A5F04520C14CC029006B7AF55639C0,'2014-09-25 22:32:32'),
+(351,'1157 Nyeri Loop','','Adygea',320,'56380','262744791493',0x000000000101000000AC91B8228C0D4440EBD10AC2CB4D4640,'2014-09-25 22:32:55'),
+(352,'1673 Tangail Drive','','Daugavpils',137,'26857','627924259271',0x0000000001010000004377A45588883A40E580B80611F14B40,'2014-09-25 22:31:57'),
+(353,'381 Kabul Way','','Taipei',209,'87272','55477302294',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:15'),
+(354,'953 Hodeida Street','','Southern Tagalog',221,'18841','53912826864',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:37'),
+(355,'469 Nakhon Sawan Street','','Tuvassia',531,'58866','689199636560',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:58'),
+(356,'1378 Beira Loop','','Krasnojarsk',597,'40792','840957664136',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:58'),
+(357,'1641 Changhwa Place','','Nord-Ouest',52,'37636','256546485220',0x000000000101000000103B53E8BC4A2440A4C0A7DEBFD61740,'2014-09-25 22:30:25'),
+(358,'1698 Southport Loop','','Hidalgo',393,'49009','754358349853',0x0000000001010000007AB82E46EEAE58C03DED951EF21D3440,'2014-09-25 22:32:11'),
+(359,'519 Nyeri Manor','','So Paulo',461,'37650','764680915323',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:21'),
+(360,'619 Hunuco Avenue','','Shimane',331,'81508','142596392389',0x000000000101000000A09ADC399EA160405B1D4AFE71BC4140,'2014-09-25 22:31:50'),
+(361,'45 Aparecida de Goinia Place','','Madhya Pradesh',464,'7431','650496654258',0x0000000001010000009E0CE94BCA345440C9FDB38B0E953840,'2014-09-25 22:31:26'),
+(362,'482 Kowloon and New Kowloon Manor','','Bratislava',90,'97056','738968474939',0x00000000010100000070DC18F1531B3140BDB90908F7124840,'2014-09-25 22:33:02'),
+(363,'604 Bern Place','','Jharkhand',429,'5373','620719383725',0x000000000101000000799F9916AB55554037CC86EB07593740,'2014-09-25 22:31:25'),
+(364,'1623 Kingstown Drive','','Buenos Aires',20,'91299','296394569728',0x000000000101000000791563AAAA2A4DC0E4839ECDAA6A41C0,'2014-09-25 22:30:04'),
+(365,'1009 Zanzibar Lane','','Arecibo',32,'64875','102396298916',0x000000000101000000FBBD5EABCEAD50C0E9787187F2783240,'2014-09-25 22:32:45'),
+(366,'114 Jalib al-Shuyukh Manor','','Centre',585,'60440','845378657301',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:25'),
+(367,'1163 London Parkway','','Par',66,'6066','675120358494',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:16'),
+(368,'1658 Jastrzebie-Zdrj Loop','','Central',372,'96584','568367775448',0x0000000001010000002B73A900CEEF4240660811BA956FB9BF,'2014-09-25 22:31:56'),
+(369,'817 Laredo Avenue','','Jalisco',188,'77449','151249681135',0x000000000101000000F00BF9B113D959C03E4EE2BDB4AA3440,'2014-09-25 22:32:06'),
+(370,'1565 Tangail Manor','','Okinawa',377,'45750','634445428822',0x000000000101000000D94C744CCCAA5F4045A1C096B2C53940,'2014-09-25 22:31:52'),
+(371,'1912 Emeishan Drive','','Balikesir',50,'33050','99883471275',0x000000000101000000F1074D5CD8E23B400B2A053818D34340,'2014-09-25 22:33:22'),
+(372,'230 Urawa Drive','','Andhra Pradesh',8,'2738','166898395731',0x0000000001010000008B04AE869F515340B2930BDF0C402F40,'2014-09-25 22:31:09'),
+(373,'1922 Miraj Way','','Esfahan',356,'13203','320471479776',0x00000000010100000017050B71F6AE494026231DD434514040,'2014-09-25 22:31:37'),
+(374,'433 Florencia Street','','Chihuahua',250,'91330','561729882725',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:08'),
+(375,'1049 Matamoros Parkway','','Karnataka',191,'69640','960505250340',0x0000000001010000007923F3C89F355340386744696F563140,'2014-09-25 22:31:16'),
+(376,'1061 Ede Avenue','','Southern Tagalog',98,'57810','333390595558',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:35'),
+(377,'154 Oshawa Manor','','East Java',415,'72771','440365973660',0x00000000010100000005B93077D24D5C4065074B2B74041FC0,'2014-09-25 22:31:34'),
+(378,'1191 Tandil Drive','','Southern Tagalog',523,'6362','45554316010',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:40'),
+(379,'1133 Rizhao Avenue','','Pernambuco',572,'2800','600264533987',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:23'),
+(380,'1519 Santiago de los Caballeros Loop','','East Kasai',348,'22025','409315295763',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:53'),
+(381,'1618 Olomouc Manor','','Kurgan',285,'26385','96846695220',0x000000000101000000B1694A5755555040EA8FD552E5B94B40,'2014-09-25 22:32:51'),
+(382,'220 Hidalgo Drive','','Kermanshah',265,'45298','342720754566',0x0000000001010000004E7A843F6888474008605EDB36284140,'2014-09-25 22:31:37'),
+(383,'686 Donostia-San Sebastin Lane','','Guangdong',471,'97390','71857599858',0x000000000101000000F90A1C1A60845C400FDB711EA98B3640,'2014-09-25 22:30:42'),
+(384,'97 Mogiljov Lane','','Gujarat',73,'89294','924815207181',0x000000000101000000B4F116FEC209524097DB076A42C63540,'2014-09-25 22:31:11'),
+(385,'1642 Charlotte Amalie Drive','','Slaskie',549,'75442','821476736117',0x000000000101000000DDC4DA2967F73240D5D6E3198F114940,'2014-09-25 22:32:44'),
+(386,'1368 Maracabo Boulevard','','',493,'32716','934352415130',0x000000000101000000731074B4AA8A4FC050920953EF2E3240,'2014-09-25 22:30:03'),
+(387,'401 Sucre Boulevard','','New Hampshire',322,'25007','486395999608',0x000000000101000000817FA54E1BDD51C013718456717F4540,'2014-09-25 22:33:56'),
+(388,'368 Hunuco Boulevard','','Namibe',360,'17165','106439158941',0x000000000101000000B5858CECEF4D28404D8EF11769642EC0,'2014-09-25 22:30:03'),
+(389,'500 Lincoln Parkway','','Jiangsu',210,'95509','550306965159',0x0000000001010000003C399E2A3AC15D404409449957CB4040,'2014-09-25 22:30:35'),
+(390,'102 Chapra Drive','','Ibaragi',521,'14073','776031833752',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:54'),
+(391,'1793 Meixian Place','','Hmelnytskyi',258,'33535','619966287415',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:31'),
+(392,'514 Ife Way','','Shaba',315,'69973','900235712074',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:53'),
+(393,'717 Changzhou Lane','','Southern Tagalog',104,'21615','426255288071',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:36'),
+(394,'753 Ilorin Avenue','','Sichuan',157,'3656','464511145118',0x0000000001010000008531D8C3CDD8594059D70D805D883D40,'2014-09-25 22:30:32'),
+(395,'1337 Mit Ghamr Avenue','','Nakhon Sawan',358,'29810','175283210378',0x0000000001010000009A588572C70859404D237722D2682F40,'2014-09-25 22:33:19'),
+(396,'767 Pyongyang Drive','','Osaka',229,'83536','667736124769',0x000000000101000000149A7F4FC7EA6040A02413A6DE2F4140,'2014-09-25 22:31:48'),
+(397,'614 Pak Kret Street','','Addis Abeba',6,'27796','47808359842',0x0000000001010000009F84E3439A5F43402233BCFEC90C2240,'2014-09-25 22:30:59'),
+(398,'954 Lapu-Lapu Way','','Moskova',278,'8816','737229003916',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:51'),
+(399,'331 Bydgoszcz Parkway','','Asturia',181,'966','537374465982',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:09'),
+(400,'1152 Citrus Heights Manor','','al-Qadarif',15,'5239','765957414528',0x00000000010100000084F6459D14B14140AA36EE83E2112C40,'2014-09-25 22:33:11'),
+(401,'168 Cianjur Manor','','Saitama',228,'73824','679095087143',0x000000000101000000DEA925C2EB75614032005471E3F94140,'2014-09-25 22:31:48'),
+(402,'616 Hagonoy Avenue','','Krasnojarsk',39,'46043','604177838256',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:47'),
+(403,'1190 0 Place','','Rio Grande do Sul',44,'10417','841876514789',0x0000000001010000002347DF49B00D4BC086151340D6543FC0,'2014-09-25 22:30:16'),
+(404,'734 Bchar Place','','Punjab',375,'30586','280578750435',0x0000000001010000006D3B6D8D885C5240C4A40925DDCE3E40,'2014-09-25 22:32:31'),
+(405,'530 Lausanne Lane','','Texas',135,'11067','775235029633',0x0000000001010000009C830C89A03358C0E2D3F7753B644040,'2014-09-25 22:33:49'),
+(406,'454 Patiala Lane','','Fukushima',276,'13496','794553031307',0x000000000101000000EC3D4B46448C614091306711E5BB4240,'2014-09-25 22:31:49'),
+(407,'1346 Mysore Drive','','Bretagne',92,'61507','516647474029',0x0000000001010000004474BE8EEEEE11C070010DDBBB3F4840,'2014-09-25 22:31:00'),
+(408,'990 Etawah Loop','','Tamil Nadu',564,'79940','206169448769',0x000000000101000000D54B42D8DF3C5340FE518A0C61A72440,'2014-09-25 22:31:29'),
+(409,'1266 Laredo Parkway','','Saitama',380,'7664','1483365694',0x000000000101000000FBD97EE8F87361403BA5283C0DF44140,'2014-09-25 22:31:52'),
+(410,'88 Nagaon Manor','','Buenos Aires',524,'86868','779461480495',0x000000000101000000CA3736960B914DC0D78A91802CA942C0,'2014-09-25 22:30:07'),
+(411,'264 Bhimavaram Manor','','St Thomas',111,'54749','302526949177',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:08'),
+(412,'1639 Saarbrcken Drive','','North West',437,'9827','328494873422',0x00000000010100000015CB8866F93D3B40E48AE65CE5AA39C0,'2014-09-25 22:33:05'),
+(413,'692 Amroha Drive','','Northern',230,'35575','359478883004',0x00000000010100000027648CB47900544098E777503F562340,'2014-09-25 22:33:10'),
+(414,'1936 Lapu-Lapu Parkway','','Bauchi & Gombe',141,'7122','653436985797',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:23'),
+(415,'432 Garden Grove Street','','Ontario',430,'65630','615964523510',0x0000000001010000003E867DF1FBDB53C05900AEBF80EF4540,'2014-09-25 22:30:28'),
+(416,'1445 Carmen Parkway','','West Java',117,'70809','598912394463',0x000000000101000000957950F550C55A40B3BFA21122171BC0,'2014-09-25 22:31:30'),
+(417,'791 Salinas Street','','Punjab',208,'40509','129953030512',0x000000000101000000579E9B911CFA524075D256804A883F40,'2014-09-25 22:31:17'),
+(418,'126 Acua Parkway','','West Bengali',71,'58888','480039662421',0x000000000101000000C3013E89191056404E9F7829D01A3840,'2014-09-25 22:31:11'),
+(419,'397 Sunnyvale Avenue','','Guanajuato',19,'55566','680851640676',0x000000000101000000754419059C2F59C02409C21550EA3440,'2014-09-25 22:32:01'),
+(420,'992 Klerksdorp Loop','','Utrecht',23,'33711','855290087237',0x000000000101000000C1DFD4ACD88C15404FDC3BB4D9134A40,'2014-09-25 22:32:19'),
+(421,'966 Arecibo Loop','','Sind',134,'94018','15273765306',0x000000000101000000BE9B1320AFF15040D93400659DBB3A40,'2014-09-25 22:32:30'),
+(422,'289 Santo Andr Manor','','al-Sharqiya',16,'72410','214976066017',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:59'),
+(423,'437 Chungho Drive','','Puerto Plata',450,'59489','491271355190',0x000000000101000000225A86930FAC51C0082692431FCB3340,'2014-09-25 22:30:55'),
+(424,'1948 Bayugan Parkway','','Bihar',264,'60622','987306329957',0x0000000001010000007613211A82E45540D685C4E2DC893940,'2014-09-25 22:31:19'),
+(425,'1866 al-Qatif Avenue','','California',155,'89420','546793516940',0x000000000101000000B4EE7AC4C3815DC0165D28AAC8084140,'2014-09-25 22:33:50'),
+(426,'1661 Abha Drive','','Tamil Nadu',416,'14400','270456873752',0x000000000101000000D3B36A2192B45340FBC5111038C32440,'2014-09-25 22:31:23'),
+(427,'1557 Cape Coral Parkway','','Hubei',293,'46875','368284120423',0x00000000010100000034CC1A06BDEA5B402D5A25FD62314040,'2014-09-25 22:30:38'),
+(428,'1727 Matamoros Place','','Sawhaj',465,'78813','129673677866',0x00000000010100000083E38D27DDB13F40555BA093948E3A40,'2014-09-25 22:30:57'),
+(429,'1269 Botosani Manor','','Guangdong',468,'47394','736517327853',0x000000000101000000C8E1DDDB3ED65C40281B20E230C83640,'2014-09-25 22:30:42'),
+(430,'355 Vitria de Santo Anto Way','','Oaxaca',452,'81758','548003849552',0x0000000001010000000363D8BC050858C0503750E09D163240,'2014-09-25 22:32:13'),
+(431,'1596 Acua Parkway','','Jharkhand',418,'70425','157133457169',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:24'),
+(432,'259 Ipoh Drive','','So Paulo',189,'64964','419009857119',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:18'),
+(433,'1823 Hoshiarpur Lane','','Komi',510,'33191','307133768620',0x000000000101000000C6DA8420AC674940DD9ACF1495D64E40,'2014-09-25 22:32:57'),
+(434,'1404 Taguig Drive','','Okayama',547,'87212','572068624538',0x000000000101000000205D11A1F6BF6040BFE90203AD864140,'2014-09-25 22:31:54'),
+(435,'740 Udaipur Lane','','Nizni Novgorod',150,'33505','497288595103',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:47'),
+(436,'287 Cuautla Boulevard','','Chuquisaca',501,'72736','82619513349',0x0000000001010000002A0B15D2D05050C049C44ABB870833C0,'2014-09-25 22:30:14'),
+(437,'1766 Almirante Brown Street','','KwaZulu-Natal',364,'63104','617567598243',0x000000000101000000FDAB7DF090EE3D40488D64EA09C23BC0,'2014-09-25 22:33:04'),
+(438,'596 Huixquilucan Place','','Nampula',351,'65892','342709348083',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:17'),
+(439,'1351 Aparecida de Goinia Parkway','','Northern Mindanao',391,'41775','959834530529',0x000000000101000000DAFF006B55F55E40898C58D5DC4F2040,'2014-09-25 22:32:38'),
+(440,'722 Bradford Lane','','Shandong',249,'90920','746251338300',0x000000000101000000653E7B890CB55D4078A0A932E7954140,'2014-09-25 22:30:37'),
+(441,'983 Santa F Way','','British Colombia',565,'47472','145720452260',0x000000000101000000719CCA58A3C75EC0EEE7B92AF59F4840,'2014-09-25 22:30:28'),
+(442,'1245 Ibirit Way','','La Romana',290,'40926','331888642162',0x0000000001010000006D59BE2E433E51C04FC87322666D3240,'2014-09-25 22:30:54'),
+(443,'1836 Korla Parkway','','Copperbelt',272,'55405','689681677428',0x000000000101000000064257C796363C40BB7EC16ED89A29C0,'2014-09-25 22:34:11'),
+(444,'231 Kaliningrad Place','','Lombardia',70,'57833','575081026569',0x0000000001010000007A185A9D9C552340A77E390E17D94640,'2014-09-25 22:31:42'),
+(445,'495 Bhimavaram Lane','','Maharashtra',144,'3','82088937724',0x0000000001010000003EE1911DC0B15240B39943520BE73440,'2014-09-25 22:31:15'),
+(446,'1924 Shimonoseki Drive','','Batna',59,'52625','406784385440',0x000000000101000000347CB03154B21840DF814B112AC74140,'2014-09-25 22:29:59'),
+(447,'105 Dzerzinsk Manor','','Inner Mongolia',540,'48570','240776414296',0x000000000101000000F1C05B7BFA905E40F5EC03DA67CE4540,'2014-09-25 22:30:44'),
+(448,'614 Denizli Parkway','','Rio Grande do Sul',486,'29444','876491807547',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:22'),
+(449,'1289 Belm Boulevard','','Tartumaa',530,'88306','237368926031',0x00000000010100000079680EFF9FB93A406C7E575FB8304D40,'2014-09-25 22:30:58'),
+(450,'203 Tambaram Street','','Buenos Aires',161,'73942','411549550611',0x000000000101000000E753C72AA5604DC0438CD7BCAA2A41C0,'2014-09-25 22:30:05'),
+(451,'1704 Tambaram Manor','','West Bengali',554,'2834','39463554936',0x000000000101000000A4E9A2D755065640F598EDAFC3793640,'2014-09-25 22:31:28'),
+(452,'207 Cuernavaca Loop','','Tatarstan',352,'52671','782900030287',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:55'),
+(453,'319 Springs Loop','','Baijeri',160,'99552','72524459905',0x0000000001010000006A62CB3C0304264081FEE7D5A5CB4840,'2014-09-25 22:31:05'),
+(454,'956 Nam Dinh Manor','','Kerman',481,'21872','474047727727',0x000000000101000000F16206CF29D74B40CFA91A738D733D40,'2014-09-25 22:31:39'),
+(455,'1947 Paarl Way','','Central Java',509,'23636','834061016202',0x000000000101000000C4D78D2D3AB55B40AC996B8775391EC0,'2014-09-25 22:31:35'),
+(456,'814 Simferopol Loop','','Sinaloa',154,'48745','524567129902',0x000000000101000000954330B3F42F5BC090CCD9F115313A40,'2014-09-25 22:32:05'),
+(457,'535 Ahmadnagar Manor','','Abu Dhabi',3,'41136','985109775584',0x000000000101000000D3E6EE29EF2E4B4099C6E52E78773840,'2014-09-25 22:33:34'),
+(458,'138 Caracas Boulevard','','Zulia',326,'16790','974433019532',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:04'),
+(459,'251 Florencia Drive','','Michoacn de Ocampo',556,'16119','118011831565',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:13'),
+(460,'659 Gatineau Boulevard','','La Paz',153,'28587','205524798287',0x00000000010100000017E7B9CFBB0B51C0A029858ABB7B30C0,'2014-09-25 22:30:13'),
+(461,'1889 Valparai Way','','Ziguinchor',600,'75559','670370974122',0x00000000010100000020E1C50C9E4530C0FC219111AB2A2940,'2014-09-25 22:33:01'),
+(462,'1485 Bratislava Place','','Illinois',435,'83183','924663855568',0x000000000101000000A081A2C30D4656C04453D1B3B4224540,'2014-09-25 22:33:59'),
+(463,'935 Aden Boulevard','','Central Java',532,'64709','335052544020',0x000000000101000000C7139C55FA485B40BEE435655D7A1BC0,'2014-09-25 22:31:35'),
+(464,'76 Kermanshah Manor','','Esfahan',423,'23343','762361821578',0x000000000101000000FF66182DF6EE4940A60BB1FA23014040,'2014-09-25 22:31:37'),
+(465,'734 Tanshui Avenue','','Caquet',170,'70664','366776723320',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:52'),
+(466,'118 Jaffna Loop','','Northern Mindanao',182,'10447','325526730021',0x00000000010100000028B27B9777475F40BAEA4B80ABAA2140,'2014-09-25 22:32:36'),
+(467,'1621 Tongliao Avenue','','Irkutsk',558,'22173','209342540247',0x000000000101000000C7269E584CE95940E56A1ACA3F604A40,'2014-09-25 22:32:58'),
+(468,'1844 Usak Avenue','','Nova Scotia',196,'84461','164414772677',0x0000000001010000004205871744C94FC0162B0F779A524640,'2014-09-25 22:30:27'),
+(469,'1872 Toulon Loop','','OHiggins',428,'7939','928809465153',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:30'),
+(470,'1088 Ibirit Place','','Jalisco',595,'88502','49084281333',0x0000000001010000007820578FA0D859C06AE514D33BB93440,'2014-09-25 22:32:15'),
+(471,'1322 Mosul Parkway','','Shandong',145,'95400','268053970382',0x0000000001010000002856574F779F5D402425E2523ABB4240,'2014-09-25 22:30:32'),
+(472,'1447 Chatsworth Place','','Chihuahua',129,'41545','769370126331',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:04'),
+(473,'1257 Guadalajara Street','','Karnataka',78,'33599','195337700615',0x000000000101000000052049A4C8ED5240E702F2800DD33040,'2014-09-25 22:31:14'),
+(474,'1469 Plock Lane','','Galicia',388,'95835','622884741180',0x000000000101000000FB44F9DDCF741FC0ED9A90D6182B4540,'2014-09-25 22:33:09'),
+(475,'434 Ourense (Orense) Manor','','Hodeida',206,'14122','562370137426',0x000000000101000000F56FF2B62D7A4540DF80E03B7B982D40,'2014-09-25 22:34:10'),
+(476,'270 Tambaram Parkway','','Gauteng',244,'9668','248446668735',0x0000000001010000005B5540EB2B0B3C4082412D61C8333AC0,'2014-09-25 22:33:03'),
+(477,'1786 Salinas Place','','Nam Ha',359,'66546','206060652238',0x00000000010100000044BD851A2A7E5A40C2DB8310908D3440,'2014-09-25 22:34:07'),
+(478,'1078 Stara Zagora Drive','','Aceh',301,'69221','932992626595',0x00000000010100000034057CC8A5495840D2C9ADA470B81440,'2014-09-25 22:31:33'),
+(479,'1854 Okara Boulevard','','Drenthe',158,'42123','131912793873',0x0000000001010000006E8AC745B5A01B40947BCBE6BB634A40,'2014-09-25 22:32:21'),
+(480,'421 Yaound Street','','Sumy',385,'11363','726875628268',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:33'),
+(481,'1153 Allende Way','','Qubec',179,'20336','856872225376',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:26'),
+(482,'808 Naala-Porto Parkway','','England',500,'41060','553452430707',0x0000000001010000000E6036A6CC4201C0B9D7930A74B44A40,'2014-09-25 22:33:41'),
+(483,'632 Usolje-Sibirskoje Parkway','','Ha Darom',36,'73085','667648979883',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:41'),
+(484,'98 Pyongyang Boulevard','','Ohio',11,'88749','191958435142',0x0000000001010000008AB1A778376154C0990524AB6C8A4440,'2014-09-25 22:33:42'),
+(485,'984 Novoterkassk Loop','','Gaziantep',180,'28165','435118527255',0x000000000101000000CAAF7A1BF6B04240AA8889BC9B874240,'2014-09-25 22:33:25'),
+(486,'64 Korla Street','','Mwanza',347,'25145','510383179153',0x0000000001010000002A28FB9DDC7B40402EBB719C252204C0,'2014-09-25 22:33:17'),
+(487,'1785 So Bernardo do Campo Street','','Veracruz',125,'71182','684529463244',0x000000000101000000A1551CBD509C57C0141F44D72A223240,'2014-09-25 22:32:04'),
+(488,'698 Jelets Boulevard','','Denizli',142,'2596','975185523021',0x000000000101000000EECD6F9868163D40B226BB3E18E34240,'2014-09-25 22:33:24'),
+(489,'1297 Alvorada Parkway','','Ningxia',587,'11839','508348602835',0x0000000001010000001583D1F679915A4029876066E93B4340,'2014-09-25 22:30:49'),
+(490,'1909 Dayton Avenue','','Guangdong',469,'88513','702955450528',0x0000000001010000007BE0BE6955655C405457998466E43840,'2014-09-25 22:30:42'),
+(491,'1789 Saint-Denis Parkway','','Coahuila de Zaragoza',4,'8268','936806643983',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:01'),
+(492,'185 Mannheim Lane','','Stavropol',408,'23661','589377568313',0x000000000101000000333E82D19B87454024592CEA38064640,'2014-09-25 22:32:56'),
+(493,'184 Mandaluyong Street','','Baja California Sur',288,'94239','488425406814',0x000000000101000000173B2BB3D2935BC078F6F0C05B233840,'2014-09-25 22:32:09'),
+(494,'591 Sungai Petani Drive','','Okayama',376,'46400','37247325001',0x0000000001010000001966B2C9EBBD60404CC054D8B1544140,'2014-09-25 22:31:51'),
+(495,'656 Matamoros Drive','','Boyac',487,'19489','17305839123',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:53'),
+(496,'775 ostka Drive','','al-Daqahliya',337,'22358','171973024401',0x000000000101000000FC4DCD8A4D423F403EDF60B9EFB63E40,'2014-09-25 22:30:57'),
+(497,'1013 Tabuk Boulevard','','West Bengali',261,'96203','158399646978',0x0000000001010000005D1B857F6C1B5640793BC269C1F53640,'2014-09-25 22:31:19'),
+(498,'319 Plock Parkway','','Istanbul',504,'26101','854259976812',0x000000000101000000B6EFF6C54A453D40277E3100F97A4440,'2014-09-25 22:33:28'),
+(499,'1954 Kowloon and New Kowloon Way','','Chimborazo',434,'63667','898559280434',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:56'),
+(500,'362 Rajkot Lane','','Gansu',47,'98030','962020153680',0x0000000001010000004F6FEB13E50A5A4028733D1B03464240,'2014-09-25 22:30:31'),
+(501,'1060 Tandil Lane','','Shandong',432,'72349','211256301880',0x000000000101000000CAB61D6423DD5D40ADF1E379BAB64140,'2014-09-25 22:30:41'),
+(502,'1515 Korla Way','','England',589,'57197','959467760895',0x0000000001010000004C42D8DFC852F1BFBA826DC493FA4A40,'2014-09-25 22:33:42'),
+(503,'1416 San Juan Bautista Tuxtepec Avenue','','Zufar',444,'50592','144206758053',0x000000000101000000A6684018D30B4B40078662E1DA033140,'2014-09-25 22:32:29'),
+(504,'1 Valle de Santiago Avenue','','Apulia',93,'86208','465897838272',0x000000000101000000CAFED4D3A2EF3140584D7C5AEA504440,'2014-09-25 22:31:43'),
+(505,'519 Brescia Parkway','','East Java',318,'69504','793996678771',0x000000000101000000A3C794B487E15B400A230736F8841EC0,'2014-09-25 22:31:33'),
+(506,'414 Mandaluyong Street','','Lubelskie',314,'16370','52709222667',0x0000000001010000000FE6C0BC1191364020F0C000C2A04940,'2014-09-25 22:32:43'),
+(507,'1197 Sokoto Boulevard','','West Bengali',478,'87687','868602816371',0x000000000101000000109546CC6C1B56408F0FC4C3C5B53A40,'2014-09-25 22:31:27'),
+(508,'496 Celaya Drive','','Nagano',552,'90797','759586584889',0x000000000101000000254E3805034961402486D3388A334240,'2014-09-25 22:31:54'),
+(509,'786 Matsue Way','','Illinois',245,'37469','111177206479',0x0000000001010000000F3B9D75570556C0FA91C77839C34440,'2014-09-25 22:33:54'),
+(510,'48 Maracabo Place','','Central Luzon',519,'1570','82671830126',0x000000000101000000223999B8D53A5E408D87AD8F3D2D2F40,'2014-09-25 22:32:39'),
+(511,'1152 al-Qatif Lane','','Kalimantan Barat',412,'44816','131370665218',0x000000000101000000107FA88F9B545B4021037976F9D69FBF,'2014-09-25 22:31:34'),
+(512,'1269 Ipoh Avenue','','Eskisehir',163,'54674','402630109080',0x000000000101000000E9D32AFA43853E40767D303A6AE34340,'2014-09-25 22:33:24'),
+(513,'758 Korolev Parkway','','Andhra Pradesh',568,'75474','441628280920',0x00000000010100000031DA99F859285440AF528BD2EF843040,'2014-09-25 22:31:29'),
+(514,'1747 Rustenburg Place','','Bihar',110,'51369','442673923363',0x0000000001010000000BFD5DE9C62E554041C4BC7D0CC83940,'2014-09-25 22:31:14'),
+(515,'886 Tonghae Place','','Volgograd',259,'19450','711928348157',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:50'),
+(516,'1574 Goinia Boulevard','','Heilongjiang',502,'39529','59634255214',0x00000000010100000017128B73AFBF5F40C5ECC094DC514740,'2014-09-25 22:30:43'),
+(517,'548 Uruapan Street','','Ontario',312,'35653','879347453467',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:38'),
+(519,'962 Tama Loop','','',583,'65952','282667506728',0x000000000101000000FA545FA722DD6440AA7A9EE4B321E1BF,'2014-09-25 22:32:19'),
+(520,'1778 Gijn Manor','','Hubei',594,'35156','288910576761',0x000000000101000000E358727044305C40A58A3D0F49104040,'2014-09-25 22:30:50'),
+(521,'568 Dhule (Dhulia) Loop','','Coquimbo',127,'92568','602101369463',0x0000000001010000000000804A296FC5C1DDA85F330AC13EC0,'2014-09-25 22:30:30'),
+(522,'1768 Udine Loop','','Battambang',60,'32347','448876499197',0x000000000101000000708802C7AFCC59402ABC15D396342A40,'2014-09-25 22:30:24'),
+(523,'608 Birgunj Parkway','','Taipei',116,'400','627425618482',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:14'),
+(524,'680 A Corua (La Corua) Manor','','Sivas',482,'49806','158326114853',0x000000000101000000936EF02A10824240F2F6D676C9DF4340,'2014-09-25 22:33:28'),
+(525,'1949 Sanya Street','','Gumma',224,'61244','132100972047',0x000000000101000000943F29A406696140E4CA8FAE88284240,'2014-09-25 22:31:47'),
+(526,'617 Klerksdorp Place','','Khanh Hoa',366,'94707','574973479129',0x0000000001010000004A1751C96F4C5B4032F504D37A7D2840,'2014-09-25 22:34:07'),
+(527,'1993 0 Loop','','Liaoning',588,'41214','25865528181',0x000000000101000000B65E1D119D8E5E40171A3ED818554440,'2014-09-25 22:30:49'),
+(528,'1176 Southend-on-Sea Manor','','Southern Tagalog',458,'81651','236679267178',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:39'),
+(529,'600 Purnea (Purnia) Avenue','','Nghe An',571,'18043','638409958875',0x000000000101000000962364204F6C5A407A6D365662AC3240,'2014-09-25 22:34:07'),
+(530,'1003 Qinhuangdao Street','','West Java',419,'25972','35533115997',0x0000000001010000005EA516A55FDC5A40A21639FA4E3A1AC0,'2014-09-25 22:31:35'),
+(531,'1986 Sivas Place','','Friuli-Venezia Giuli',551,'95775','182059202712',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:44'),
+(532,'1427 Tabuk Place','','Florida',101,'31342','214756839122',0x0000000001010000003C702942C57C54C02A5D555117903A40,'2014-09-25 22:33:47'),
+(533,'556 Asuncin Way','','Mogiljov',339,'35364','338244023543',0x0000000001010000006B6DD04D51583E40673513C259F54A40,'2014-09-25 22:30:13'),
+(534,'486 Ondo Parkway','','Benguela',67,'35202','105882218332',0x000000000101000000BD83E9C59ACF2A40B9FA56900B2729C0,'2014-09-25 22:30:02'),
+(535,'635 Brest Manor','','Andhra Pradesh',75,'40899','80593242951',0x00000000010100000079FA52897C615440D2C9ADA4708A3040,'2014-09-25 22:31:13'),
+(536,'166 Jinchang Street','','Buenos Aires',165,'86760','717566026669',0x0000000001010000003EB896242A434DC0E0771DBB556D41C0,'2014-09-25 22:30:05'),
+(537,'958 Sagamihara Lane','','Mie',287,'88408','427274926505',0x000000000101000000BED29E37BA1761409B5F837467884140,'2014-09-25 22:31:50'),
+(538,'1817 Livorno Way','','Khanh Hoa',100,'79401','478380208348',0x000000000101000000944A78422F4A5B40236D3E09C7D72740,'2014-09-25 22:34:05'),
+(539,'1332 Gaziantep Lane','','Shandong',80,'22813','383353187467',0x000000000101000000BC2F1D2911815D4074B0A316EFAE4240,'2014-09-25 22:30:31'),
+(540,'949 Allende Lane','','Uttar Pradesh',24,'67521','122981120653',0x0000000001010000008C91DBE5119E534039A8B34934E73C40,'2014-09-25 22:31:11'),
+(541,'195 Ilorin Street','','Chari-Baguirmi',363,'49250','8912935608',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:29'),
+(542,'193 Bhusawal Place','','Kang-won',539,'9750','745267607502',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:07'),
+(543,'43 Vilnius Manor','','Colorado',42,'79814','484500282381',0x0000000001010000009389004C3E355AC0D03582435EDD4340,'2014-09-25 22:33:44'),
+(544,'183 Haiphong Street','','Jilin',46,'69953','488600270038',0x000000000101000000AFA3607C87B45E4038A85890C1CD4640,'2014-09-25 22:30:30'),
+(545,'163 Augusta-Richmond County Loop','','Carabobo',561,'33030','754579047924',0x000000000101000000CC0C1B657D0051C06B7F677BF4522440,'2014-09-25 22:34:05'),
+(546,'191 Jos Azueta Parkway','','Ruse',436,'13629','932156667696',0x00000000010100000067A9ABF188F83940CD6CA1759EED4540,'2014-09-25 22:30:23'),
+(547,'379 Lublin Parkway','','Toscana',309,'74568','921960450089',0x00000000010100000090920D5AFEA62440CC13BEADAAC54540,'2014-09-25 22:31:44'),
+(548,'1658 Cuman Loop','','Sumatera Selatan',396,'51309','784907335610',0x00000000010100000018D75306E9885A40E8209EDB3A4E01C0,'2014-09-25 22:31:34'),
+(549,'454 Qinhuangdao Drive','','Tadla-Azilal',68,'25866','786270036240',0x000000000101000000419479F53B6619C04F09E3022B2B4040,'2014-09-25 22:32:16'),
+(550,'1715 Okayama Street','','So Paulo',485,'55676','169352919175',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:22'),
+(551,'182 Nukualofa Drive','','Sumy',275,'15414','426346224043',0x00000000010100000079F71109F099404055BBCBEAC29E4940,'2014-09-25 22:33:32'),
+(552,'390 Wroclaw Way','','Hainan',462,'5753','357593328658',0x000000000101000000F70FD88B57605B40364E5480393E3240,'2014-09-25 22:30:41'),
+(553,'1421 Quilmes Lane','','Ishikawa',260,'19151','135407755975',0x0000000001010000008F9F32A30414614053AEF02E174C4240,'2014-09-25 22:31:49'),
+(554,'947 Trshavn Place','','Central Luzon',528,'841','50898428626',0x000000000101000000C56DD9C644265E4002B5BD82D9F52E40,'2014-09-25 22:32:40'),
+(555,'1764 Jalib al-Shuyukh Parkway','','Galicia',459,'77642','84794532510',0x00000000010100000090FFB8B3651721C09DB23FF5B4704540,'2014-09-25 22:33:10'),
+(556,'346 Cam Ranh Avenue','','Zhejiang',599,'39976','978430786151',0x000000000101000000A0E63FFF188D5E4056DBA8A9C0023E40,'2014-09-25 22:30:51'),
+(557,'1407 Pachuca de Soto Place','','Rio Grande do Sul',21,'26284','380077794770',0x000000000101000000A3CEDC43C28449C0608209922DFD3DC0,'2014-09-25 22:30:14'),
+(558,'904 Clarksville Drive','','Zhejiang',193,'52234','955349440539',0x000000000101000000E5886B6BFA2A5E4038E04E7D7B7A3E40,'2014-09-25 22:30:34'),
+(559,'1917 Kumbakonam Parkway','','Vojvodina',368,'11892','698182547686',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:11'),
+(560,'1447 Imus Place','','Gujarat',426,'12905','62127829280',0x000000000101000000667F4523C4B25140819C8B1AA74A3640,'2014-09-25 22:31:25'),
+(561,'1497 Fengshan Drive','','KwaZulu-Natal',112,'63022','368738360376',0x000000000101000000938FDD054AE43E402AF97DA42DEB3DC0,'2014-09-25 22:33:03'),
+(562,'869 Shikarpur Way','','England',496,'57380','590764256785',0x000000000101000000894FF003460D08C0828472ECEAD24A40,'2014-09-25 22:33:40'),
+(563,'1059 Yuncheng Avenue','','Vilna',570,'47498','107092893983',0x00000000010100000046B82462A5473940BA0ACE8536584B40,'2014-09-25 22:31:58'),
+(564,'505 Madiun Boulevard','','Dolnoslaskie',577,'97271','970638808606',0x000000000101000000F0D46D9A8808314023A93B05AF914940,'2014-09-25 22:32:44'),
+(565,'1741 Hoshiarpur Boulevard','','al-Sharqiya',79,'22372','855066328617',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:30:56'),
+(566,'1229 Varanasi (Benares) Manor','','Buenos Aires',43,'40195','817740355461',0x00000000010100000014DA28A1AA2A4DC02E156580555541C0,'2014-09-25 22:30:04'),
+(567,'1894 Boa Vista Way','','Texas',178,'77464','239357986667',0x000000000101000000C1D1448EE32858C0AD8D0CCDD0744040,'2014-09-25 22:33:51'),
+(568,'1342 Sharja Way','','Sokoto & Kebbi & Zam',488,'93655','946114054231',0x0000000001010000005B087250C2F41440E711ED74311F2A40,'2014-09-25 22:32:27'),
+(569,'1342 Abha Boulevard','','Bukarest',95,'10714','997453607116',0x000000000101000000924FD9FA331B3A40B1CBA61254374640,'2014-09-25 22:32:46'),
+(570,'415 Pune Avenue','','Shandong',580,'44274','203202500108',0x000000000101000000CC3857DE1F705D408F26CDD545F34140,'2014-09-25 22:30:47'),
+(571,'1746 Faaa Way','','Huanuco',214,'32515','863080561151',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:33'),
+(572,'539 Hami Way','','Tokat',538,'52196','525518075499',0x0000000001010000006F302F1BF8464240AD7B759F2D284440,'2014-09-25 22:33:29'),
+(573,'1407 Surakarta Manor','','Moskova',466,'33224','324346485054',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:56'),
+(574,'502 Mandi Bahauddin Parkway','','Anzotegui',55,'15992','618156722572',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:34:03'),
+(575,'1052 Pathankot Avenue','','Sichuan',299,'77397','128499386727',0x000000000101000000AA054026E3F05940CCC12275F18F3D40,'2014-09-25 22:30:39'),
+(576,'1351 Sousse Lane','','Coahuila de Zaragoza',341,'37815','203804046132',0x0000000001010000006AB86D84EA5A59C027AA12C028E83A40,'2014-09-25 22:32:10'),
+(577,'1501 Pangkal Pinang Avenue','','Mazowieckie',409,'943','770864062795',0x0000000001010000001646C4DED5B43340308AD46AFE454A40,'2014-09-25 22:32:43'),
+(578,'1405 Hagonoy Avenue','','Slaskie',133,'86587','867287719310',0x0000000001010000002431F77FC41F3340F5B06197F2654940,'2014-09-25 22:32:42'),
+(579,'521 San Juan Bautista Tuxtepec Place','','Qaraghandy',598,'95093','844018348565',0x0000000001010000006848CB3711F15040E32A604C44E44740,'2014-09-25 22:31:56'),
+(580,'923 Tangail Boulevard','','Tokyo-to',10,'33384','315528269898',0x00000000010100000078E5C468A76B6140C3A27D079ADA4140,'2014-09-25 22:31:45'),
+(581,'186 Skikda Lane','','Morelos',131,'89422','14465669789',0x00000000010100000048C2BE9DC4CE58C0DA3DD4111BED3240,'2014-09-25 22:32:05'),
+(582,'1568 Celaya Parkway','','Kaohsiung',168,'34750','278669994384',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:15'),
+(583,'1489 Kakamigahara Lane','','Taipei',526,'98883','29341849811',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:16'),
+(584,'1819 Alessandria Loop','','Campeche',103,'53829','377633994405',0x0000000001010000008636A5611DF556C0374F1A0F5BA53240,'2014-09-25 22:32:02'),
+(585,'1208 Tama Loop','','Ninawa',344,'73605','954786054144',0x000000000101000000314F9DFD378F4540961EF23BF22A4240,'2014-09-25 22:31:40'),
+(586,'951 Springs Lane','','Central Mindanao',219,'96115','165164761435',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:37'),
+(587,'760 Miyakonojo Drive','','Guerrero',246,'64682','294449058179',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:32:08'),
+(588,'966 Asuncin Way','','Hidalgo',212,'62703','995527378381',0x000000000101000000EBBD4230D89A58C0E30632F1FD233540,'2014-09-25 22:32:07'),
+(589,'1584 Ljubertsy Lane','','England',494,'22954','285710089439',0x00000000010100000035385B8AF577F6BF8C7560EFB4734940,'2014-09-25 22:33:38'),
+(590,'247 Jining Parkway','','Banjul',54,'53446','170115379190',0x0000000001010000001BE4E434FA9330C08A8F4FC8CEE72A40,'2014-09-25 22:31:04'),
+(591,'773 Dallas Manor','','Buenos Aires',424,'12664','914466027044',0x00000000010100000009C3802557204DC0B75CA21FB25C41C0,'2014-09-25 22:30:06'),
+(592,'1923 Stara Zagora Lane','','Nantou',546,'95179','182178609211',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:33:17'),
+(593,'1402 Zanzibar Boulevard','','Guanajuato',106,'71102','387448063440',0x000000000101000000FCB7DCAA353459C05CA8A1B206863440,'2014-09-25 22:32:03'),
+(594,'1464 Kursk Parkway','','Shandong',574,'17381','338758048786',0x0000000001010000008CA2073E86C65D40055669E6245B4240,'2014-09-25 22:30:44'),
+(595,'1074 Sanaa Parkway','','Loja',311,'22474','154124128457',0x00000000010100000092DBE51112CD53C00EF96706F1F10FC0,'2014-09-25 22:30:55'),
+(596,'1759 Niznekamsk Avenue','','al-Manama',14,'39414','864392582257',0x000000000101000000044D9539A74A49401224004922373A40,'2014-09-25 22:30:11'),
+(597,'32 Liaocheng Way','','Minas Gerais',248,'1944','410877354933',0x000000000101000000C2757BFFD5AC45C0424F1432A1C335C0,'2014-09-25 22:30:19'),
+(598,'42 Fontana Avenue','','Fejr',512,'14684','437829801725',0x00000000010100000000000000000000000000000000000000,'2014-09-25 22:31:09'),
+(599,'1895 Zhezqazghan Drive','','California',177,'36693','137809746111',0x0000000001010000003EC7ECD1407C5DC057FA1A930FE34040,'2014-09-25 22:33:51'),
+(600,'1837 Kaduna Parkway','','Inner Mongolia',241,'82580','640843562301',0x000000000101000000D61A4AEDC5465C400E64E2FB87834440,'2014-09-25 22:30:37'),
+(601,'844 Bucuresti Place','','Liaoning',242,'36603','935952366111',0x000000000101000000B88086EDDD6D5E407CED9925018D4340,'2014-09-25 22:30:37'),
+(602,'1101 Bucuresti Boulevard','','West Greece',401,'97661','199514580428',0x000000000101000000AAC1EA7E04BC3540E65F26E5491F4340,'2014-09-25 22:31:07'),
+(603,'1103 Quilmes Boulevard','','Piura',503,'52137','644021380889',0x000000000101000000AD9685C0DB2B54C09B012EC8969D13C0,'2014-09-25 22:32:34'),
+(604,'1331 Usak Boulevard','','Vaud',296,'61960','145308717464',0x000000000101000000CE273CB203881A40205734E72A424740,'2014-09-25 22:33:14'),
+(605,'1325 Fukuyama Street','','Heilongjiang',537,'27107','288241215394',0x00000000010100000017540A70700160401E1C47077F7D4740,'2014-09-25 22:30:44');
+COMMIT;
+
+DROP TABLE address;
diff --git a/mysql-test/suite/innodb_undo/include/have_undo_tablespaces.inc b/mysql-test/suite/innodb_undo/include/have_undo_tablespaces.inc
new file mode 100644
index 00000000000..87830a4a5f0
--- /dev/null
+++ b/mysql-test/suite/innodb_undo/include/have_undo_tablespaces.inc
@@ -0,0 +1,4 @@
+if (`select count(*) = 0 from information_schema.global_variables where variable_name like 'innodb_undo_tablespaces' and variable_value >= 2`)
+{
+ --skip Test requires InnoDB with at-least 2 undo tablespaces.
+}
diff --git a/mysql-test/suite/innodb_undo/include/truncate_recover.inc b/mysql-test/suite/innodb_undo/include/truncate_recover.inc
new file mode 100644
index 00000000000..fe068afa6e3
--- /dev/null
+++ b/mysql-test/suite/innodb_undo/include/truncate_recover.inc
@@ -0,0 +1,8 @@
+begin;
+update t1 set c = 'MariaDB';
+update t1 set c = 'InnoDB';
+eval set global debug_dbug = '+d,$SEARCH_PATTERN';
+commit;
+--source include/shutdown_mysqld.inc
+--source include/search_pattern_in_file.inc
+--source include/start_mysqld.inc
diff --git a/mysql-test/suite/innodb_undo/r/truncate.result b/mysql-test/suite/innodb_undo/r/truncate.result
new file mode 100644
index 00000000000..4f62d85e08a
--- /dev/null
+++ b/mysql-test/suite/innodb_undo/r/truncate.result
@@ -0,0 +1,11 @@
+SET GLOBAL innodb_fast_shutdown=0;
+create table t1(keyc int primary key, c1 char(100)) engine = innodb;
+begin;
+update t1 set c1 = 'mysql';
+update t1 set c1 = 'oracle';
+delete from t1;
+commit;
+drop table t1;
+SET GLOBAL innodb_fast_shutdown=0;
+SET GLOBAL innodb_undo_log_truncate=1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
diff --git a/mysql-test/suite/innodb_undo/r/truncate_multi_client.result b/mysql-test/suite/innodb_undo/r/truncate_multi_client.result
new file mode 100644
index 00000000000..c1ce2845996
--- /dev/null
+++ b/mysql-test/suite/innodb_undo/r/truncate_multi_client.result
@@ -0,0 +1,51 @@
+SET GLOBAL innodb_fast_shutdown=0;
+create table t1(keyc int primary key, c char(100)) engine = innodb;
+create table t2(keyc int primary key, c char(100)) engine = innodb;
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i INT DEFAULT 1;
+while (i <= 20000) DO
+insert into t1 values (i, 'a');
+SET i = i + 1;
+END WHILE;
+END |
+CREATE PROCEDURE populate_t2()
+BEGIN
+DECLARE i INT DEFAULT 1;
+while (i <= 20000) DO
+insert into t2 values (i, 'a');
+SET i = i + 1;
+END WHILE;
+END |
+connect con1,localhost,root,,;
+begin;
+call populate_t1();
+connect con2,localhost,root,,;
+begin;
+call populate_t2();
+connection con1;
+update t1 set c = 'mysql';
+connection con2;
+update t2 set c = 'mysql';
+connection con1;
+update t1 set c = 'oracle';
+connection con2;
+update t2 set c = 'oracle';
+connection con1;
+delete from t1;
+connection con2;
+delete from t2;
+connection con1;
+commit;
+disconnect con1;
+connection con2;
+commit;
+disconnect con2;
+connection default;
+drop table t1, t2;
+drop PROCEDURE populate_t1;
+drop PROCEDURE populate_t2;
+SET GLOBAL innodb_fast_shutdown=0;
+SET GLOBAL innodb_undo_log_truncate=1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+FOUND 1 /Truncating UNDO tablespace 1/ in mysqld.1.err
diff --git a/mysql-test/suite/innodb_undo/r/truncate_recover.result b/mysql-test/suite/innodb_undo/r/truncate_recover.result
new file mode 100644
index 00000000000..f89bc0a9e47
--- /dev/null
+++ b/mysql-test/suite/innodb_undo/r/truncate_recover.result
@@ -0,0 +1,15 @@
+create table t1(keyc int primary key, c char(100)) engine = innodb;
+begin;
+commit;
+begin;
+update t1 set c = 'MariaDB';
+update t1 set c = 'InnoDB';
+set global debug_dbug = '+d,ib_undo_trunc_before_truncate';
+commit;
+FOUND 1 /ib_undo_trunc_before_truncate/ in mysqld.1.err
+begin;
+update t1 set c = 'MariaDB';
+update t1 set c = 'InnoDB';
+set global debug_dbug = '+d,ib_undo_trunc_before_ddl_log_end';
+commit;
+FOUND 1 /ib_undo_trunc_before_ddl_log_end/ in mysqld.1.err
diff --git a/mysql-test/suite/innodb_undo/t/truncate.test b/mysql-test/suite/innodb_undo/t/truncate.test
new file mode 100644
index 00000000000..2c612478929
--- /dev/null
+++ b/mysql-test/suite/innodb_undo/t/truncate.test
@@ -0,0 +1,72 @@
+#
+# WL#6965: Truncate UNDO logs.
+#
+
+--source include/have_innodb.inc
+--source include/have_innodb_max_16k.inc
+--source include/have_undo_tablespaces.inc
+
+# The test is restarting the server to force undo truncation.
+--source include/not_embedded.inc
+
+SET GLOBAL innodb_fast_shutdown=0;
+--let $restart_parameters=--innodb_undo_tablespaces=2 --innodb_undo_logs=4
+--source include/restart_mysqld.inc
+
+let MYSQLD_DATADIR = `select @@datadir`;
+
+#-----------------------------------------------------------------------------
+#
+# 1. Perform enough DML action so that undo tablespace size grows beyond
+# set threshold and then wait and see if it is being truncated.
+#
+create table t1(keyc int primary key, c1 char(100)) engine = innodb;
+begin;
+--disable_query_log
+let $i=30000;
+while ($i) {
+ eval insert into t1 values(30000-$i, '');
+ dec $i;
+}
+--enable_query_log
+update t1 set c1 = 'mysql';
+update t1 set c1 = 'oracle';
+delete from t1;
+commit;
+drop table t1;
+
+let CHECKFILE = $MYSQL_TMP_DIR/check.txt;
+perl;
+($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size1)
+ = stat("$ENV{MYSQLD_DATADIR}/undo001");
+($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size2)
+ = stat("$ENV{MYSQLD_DATADIR}/undo002");
+open(OUT, ">$ENV{CHECKFILE}") || die;
+print OUT "let \$size1='$size1,$size2';\n";
+close(OUT);
+EOF
+SET GLOBAL innodb_fast_shutdown=0;
+SET GLOBAL innodb_undo_log_truncate=1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+--source include/shutdown_mysqld.inc
+--source $CHECKFILE
+perl;
+($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size1)
+ = stat("$ENV{MYSQLD_DATADIR}/undo001");
+($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size2)
+ = stat("$ENV{MYSQLD_DATADIR}/undo002");
+open(OUT, ">$ENV{CHECKFILE}") || die;
+print OUT "let \$size2='$size1,$size2';\n";
+close(OUT);
+EOF
+
+--source $CHECKFILE
+--remove_file $CHECKFILE
+
+if ($size1 == $size2)
+{
+ echo Truncation did not happen: $size1 == $size2;
+}
+
+--let $restart_parameters=
+--source include/start_mysqld.inc
diff --git a/mysql-test/suite/innodb_undo/t/truncate_multi_client.test b/mysql-test/suite/innodb_undo/t/truncate_multi_client.test
new file mode 100644
index 00000000000..ac4ead00b51
--- /dev/null
+++ b/mysql-test/suite/innodb_undo/t/truncate_multi_client.test
@@ -0,0 +1,77 @@
+#
+# WL#6965: Truncate UNDO logs.
+#
+
+--source include/have_innodb.inc
+# This test is restarting the server.
+--source include/not_embedded.inc
+# With larger innodb_page_size, the undo log tablespaces do not grow enough.
+--source include/have_innodb_max_16k.inc
+--source include/have_undo_tablespaces.inc
+
+SET GLOBAL innodb_fast_shutdown=0;
+--let $restart_parameters=--innodb_undo_tablespaces=2 --innodb_undo_logs=4
+--source include/restart_mysqld.inc
+
+#-----------------------------------------------------------------------------
+#
+# Perform DML action using multiple clients and multiple undo tablespace.
+#
+#
+create table t1(keyc int primary key, c char(100)) engine = innodb;
+create table t2(keyc int primary key, c char(100)) engine = innodb;
+#
+delimiter |;
+CREATE PROCEDURE populate_t1()
+BEGIN
+ DECLARE i INT DEFAULT 1;
+ while (i <= 20000) DO
+ insert into t1 values (i, 'a');
+ SET i = i + 1;
+ END WHILE;
+END |
+delimiter ;|
+#
+delimiter |;
+CREATE PROCEDURE populate_t2()
+BEGIN
+ DECLARE i INT DEFAULT 1;
+ while (i <= 20000) DO
+ insert into t2 values (i, 'a');
+ SET i = i + 1;
+ END WHILE;
+END |
+delimiter ;|
+#
+#
+connect (con1,localhost,root,,);
+begin;
+send call populate_t1();
+
+connect (con2,localhost,root,,);
+begin;
+send call populate_t2();
+
+connection con1; reap; send update t1 set c = 'mysql';
+connection con2; reap; send update t2 set c = 'mysql';
+connection con1; reap; send update t1 set c = 'oracle';
+connection con2; reap; send update t2 set c = 'oracle';
+connection con1; reap; send delete from t1;
+connection con2; reap; send delete from t2;
+connection con1; reap; commit; disconnect con1;
+connection con2; reap; commit; disconnect con2;
+
+connection default;
+drop table t1, t2;
+drop PROCEDURE populate_t1;
+drop PROCEDURE populate_t2;
+
+SET GLOBAL innodb_fast_shutdown=0;
+SET GLOBAL innodb_undo_log_truncate=1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
+
+--source include/restart_mysqld.inc
+
+let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+let SEARCH_PATTERN = Truncating UNDO tablespace 1;
+--source include/search_pattern_in_file.inc
diff --git a/mysql-test/suite/innodb_undo/t/truncate_recover.test b/mysql-test/suite/innodb_undo/t/truncate_recover.test
new file mode 100644
index 00000000000..8087d191f1e
--- /dev/null
+++ b/mysql-test/suite/innodb_undo/t/truncate_recover.test
@@ -0,0 +1,50 @@
+#
+# WL#6965: Truncate UNDO logs.
+#
+
+--source include/have_innodb.inc
+--source include/have_debug.inc
+# With larger innodb_page_size, the undo log tablespaces do not grow enough.
+--source include/have_innodb_max_16k.inc
+--source include/have_undo_tablespaces.inc
+
+# Valgrind would complain about memory leaks when we crash on purpose.
+--source include/not_valgrind.inc
+# Embedded server does not support crashing
+--source include/not_embedded.inc
+# Avoid CrashReporter popup on Mac
+--source include/not_crashrep.inc
+
+--disable_query_log
+# FIXME: The doublewrite buffer should not issue these warnings.
+# FIXME: Maybe buf_dblwr_process() should empty the buffer at the end?
+call mtr.add_suppression("InnoDB: A copy of page.*in the doublewrite buffer slot.*is not within space bounds");
+FLUSH TABLES;
+--enable_query_log
+
+--let $restart_parameters=--innodb-undo-logs=4 --innodb-undo-tablespaces=2 --innodb-undo-log-truncate=1 --innodb-max-undo-log-size=10485760 --innodb-purge-rseg-truncate-frequency=1 --innodb-fast-shutdown=0
+--source include/restart_mysqld.inc
+
+let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
+
+create table t1(keyc int primary key, c char(100)) engine = innodb;
+begin;
+--disable_query_log
+let $i=30000;
+while ($i) {
+ eval insert into t1 values(30000-$i, '');
+ dec $i;
+}
+--enable_query_log
+commit;
+
+let SEARCH_PATTERN = ib_undo_trunc_before_truncate;
+--source include/truncate_recover.inc
+
+let SEARCH_PATTERN = ib_undo_trunc_before_ddl_log_end;
+--source include/truncate_recover.inc
+
+let SEARCH_PATTERN = ib_undo_trunc_trunc_done;
+let $restart_parameters=
+--source include/truncate_recover.inc
+drop table t1;
diff --git a/mysql-test/suite/maria/maria-gis-rtree-dynamic.result b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result
index a0535026722..8bea5edb6fb 100644
--- a/mysql-test/suite/maria/maria-gis-rtree-dynamic.result
+++ b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result
@@ -168,7 +168,7 @@ count(*)
150
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL g NULL NULL NULL 150 Using where
+1 SIMPLE t1 range g g 34 NULL 11 Using where
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
fid AsText(g)
1 LINESTRING(150 150,150 150)
@@ -302,7 +302,7 @@ count(*)
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range g g 34 NULL 1 Using where
+1 SIMPLE t2 range g g 34 NULL 4 Using where
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
diff --git a/mysql-test/suite/maria/maria-gis-rtree-trans.result b/mysql-test/suite/maria/maria-gis-rtree-trans.result
index dbcbdeb1661..4a2f97fbd41 100644
--- a/mysql-test/suite/maria/maria-gis-rtree-trans.result
+++ b/mysql-test/suite/maria/maria-gis-rtree-trans.result
@@ -168,7 +168,7 @@ count(*)
150
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL g NULL NULL NULL 150 Using where
+1 SIMPLE t1 range g g 34 NULL 11 Using where
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
fid AsText(g)
1 LINESTRING(150 150,150 150)
@@ -302,7 +302,7 @@ count(*)
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range g g 34 NULL 1 Using where
+1 SIMPLE t2 range g g 34 NULL 4 Using where
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
diff --git a/mysql-test/suite/maria/maria-gis-rtree.result b/mysql-test/suite/maria/maria-gis-rtree.result
index 3ecdcc64928..901a7bee397 100644
--- a/mysql-test/suite/maria/maria-gis-rtree.result
+++ b/mysql-test/suite/maria/maria-gis-rtree.result
@@ -168,7 +168,7 @@ count(*)
150
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL g NULL NULL NULL 150 Using where
+1 SIMPLE t1 range g g 34 NULL 11 Using where
SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
fid AsText(g)
1 LINESTRING(150 150,150 150)
@@ -302,7 +302,7 @@ count(*)
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range g g 34 NULL 1 Using where
+1 SIMPLE t2 range g g 34 NULL 4 Using where
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)
diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_view.result b/mysql-test/suite/rpl/r/rpl_create_drop_view.result
index ea1e3354045..0c18249ca08 100644
--- a/mysql-test/suite/rpl/r/rpl_create_drop_view.result
+++ b/mysql-test/suite/rpl/r/rpl_create_drop_view.result
@@ -99,7 +99,7 @@ DROP VIEW v1;
ERROR 42S02: Unknown VIEW: 'test.v1'
DROP VIEW IF EXISTS v2;
Warnings:
-Note 4067 Unknown VIEW: 'test.v2'
+Note 4068 Unknown VIEW: 'test.v2'
# Syncing slave with master
connection slave;
SELECT * FROM v1;
diff --git a/mysql-test/suite/sql_sequence/create.result b/mysql-test/suite/sql_sequence/create.result
index 70f9745d409..59dfe62acee 100644
--- a/mysql-test/suite/sql_sequence/create.result
+++ b/mysql-test/suite/sql_sequence/create.result
@@ -165,7 +165,7 @@ drop sequence t1;
ERROR 42S02: 'test.t1' is not a SEQUENCE
drop sequence if exists t1;
Warnings:
-Note 4066 Unknown SEQUENCE: 'test.t1'
+Note 4067 Unknown SEQUENCE: 'test.t1'
create sequence t1 start with 10 maxvalue=9;
ERROR HY000: Sequence 'test.t1' values are conflicting
create sequence t1 minvalue= 100 maxvalue=10;
@@ -374,7 +374,7 @@ key key1 (next_value)
ERROR HY000: Sequence 'test.t1' table structure is invalid (Sequence tables cannot have any keys)
drop sequence if exists t1;
Warnings:
-Note 4066 Unknown SEQUENCE: 'test.t1'
+Note 4067 Unknown SEQUENCE: 'test.t1'
create sequence t1;
create sequence t2;
create table t3 (a int) engine=myisam;
@@ -384,8 +384,8 @@ CREATE SEQUENCE s1;
drop sequence s1;
drop sequence if exists t1,t2,t3,t4;
Warnings:
-Note 4066 Unknown SEQUENCE: 'test.t3'
-Note 4066 Unknown SEQUENCE: 'test.t4'
+Note 4067 Unknown SEQUENCE: 'test.t3'
+Note 4067 Unknown SEQUENCE: 'test.t4'
drop table if exists t1,t2,t3;
Warnings:
Note 1051 Unknown table 'test.t1'
@@ -411,9 +411,9 @@ CREATE TABLE t2 (a int);
CREATE SEQUENCE s1;
drop sequence if exists t1,t2,s1,s2;
Warnings:
-Note 4066 Unknown SEQUENCE: 'test.t1'
-Note 4066 Unknown SEQUENCE: 'test.t2'
-Note 4066 Unknown SEQUENCE: 'test.s2'
+Note 4067 Unknown SEQUENCE: 'test.t1'
+Note 4067 Unknown SEQUENCE: 'test.t2'
+Note 4067 Unknown SEQUENCE: 'test.s2'
drop table if exists t1,t2;
CREATE TEMPORARY SEQUENCE s1;
DROP SEQUENCE s1;
diff --git a/mysql-test/suite/sys_vars/r/innodb_deadlock_detect_basic.result b/mysql-test/suite/sys_vars/r/innodb_deadlock_detect_basic.result
new file mode 100644
index 00000000000..615fc782ad5
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_deadlock_detect_basic.result
@@ -0,0 +1,56 @@
+SET @start_global_value = @@global.innodb_deadlock_detect;
+SELECT @start_global_value;
+@start_global_value
+1
+Valid values are 'ON' and 'OFF'
+select @@global.innodb_deadlock_detect in (0, 1);
+@@global.innodb_deadlock_detect in (0, 1)
+1
+select @@global.innodb_deadlock_detect;
+@@global.innodb_deadlock_detect
+1
+select @@session.innodb_deadlock_detect in (0, 1);
+ERROR HY000: Variable 'innodb_deadlock_detect' is a GLOBAL variable
+select @@session.innodb_deadlock_detect;
+ERROR HY000: Variable 'innodb_deadlock_detect' is a GLOBAL variable
+show global variables like 'innodb_deadlock_detect';
+Variable_name Value
+innodb_deadlock_detect ON
+show session variables like 'innodb_deadlock_detect';
+Variable_name Value
+innodb_deadlock_detect ON
+set global innodb_deadlock_detect='OFF';
+set session innodb_deadlock_detect='OFF';
+ERROR HY000: Variable 'innodb_deadlock_detect' is a GLOBAL variable and should be set with SET GLOBAL
+select @@global.innodb_deadlock_detect;
+@@global.innodb_deadlock_detect
+0
+set @@global.innodb_deadlock_detect=1;
+select @@global.innodb_deadlock_detect;
+@@global.innodb_deadlock_detect
+1
+set global innodb_deadlock_detect=0;
+select @@global.innodb_deadlock_detect;
+@@global.innodb_deadlock_detect
+0
+set @@global.innodb_deadlock_detect='ON';
+select @@global.innodb_deadlock_detect;
+@@global.innodb_deadlock_detect
+1
+set global innodb_deadlock_detect=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_deadlock_detect'
+set global innodb_deadlock_detect=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_deadlock_detect'
+set global innodb_deadlock_detect=2;
+ERROR 42000: Variable 'innodb_deadlock_detect' can't be set to the value of '2'
+set global innodb_deadlock_detect='AUTO';
+ERROR 42000: Variable 'innodb_deadlock_detect' can't be set to the value of 'AUTO'
+set global innodb_deadlock_detect=-3;
+ERROR 42000: Variable 'innodb_deadlock_detect' can't be set to the value of '-3'
+select @@global.innodb_deadlock_detect;
+@@global.innodb_deadlock_detect
+1
+SET @@global.innodb_deadlock_detect = @start_global_value;
+SELECT @@global.innodb_deadlock_detect;
+@@global.innodb_deadlock_detect
+1
diff --git a/mysql-test/suite/sys_vars/r/innodb_max_undo_log_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_max_undo_log_size_basic.result
index 3854060b33b..47565ac40ad 100644
--- a/mysql-test/suite/sys_vars/r/innodb_max_undo_log_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_max_undo_log_size_basic.result
@@ -4,17 +4,21 @@ COUNT(@@GLOBAL.innodb_max_undo_log_size)
1
1 Expected
'#---------------------BS_STVARS_035_02----------------------#'
+SET @save = @@GLOBAL.innodb_max_undo_log_size;
SET @@GLOBAL.innodb_max_undo_log_size=1073741824;
SELECT COUNT(@@GLOBAL.innodb_max_undo_log_size);
COUNT(@@GLOBAL.innodb_max_undo_log_size)
1
1 Expected
SET @@GLOBAL.innodb_max_undo_log_size=18446744073709551615;
-SELECT @@GLOBAL.innodb_max_undo_log_size;
-@@GLOBAL.innodb_max_undo_log_size
-18446744073709551615
-18446744073709551615 Expected
+Warnings:
+Warning 1292 Truncated incorrect innodb_max_undo_log_size value: '18446744073709551615'
+SELECT FLOOR(@@GLOBAL.innodb_max_undo_log_size / @@GLOBAL.innodb_page_size);
+FLOOR(@@GLOBAL.innodb_max_undo_log_size / @@GLOBAL.innodb_page_size)
+4294967296
+4294967296 Expected
SET @@GLOBAL.innodb_max_undo_log_size=1073741824;
+SET GLOBAL innodb_max_undo_log_size = @save;
'#---------------------BS_STVARS_035_03----------------------#'
SELECT @@GLOBAL.innodb_max_undo_log_size = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
index 9bf02940d75..2b9e9ad6baf 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
@@ -571,9 +571,9 @@
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
- VARIABLE_COMMENT Number of undo tablespaces to use.
+ VARIABLE_COMMENT Number of undo tablespaces to use.
NUMERIC_MIN_VALUE 0
- NUMERIC_MAX_VALUE 95
+ NUMERIC_MAX_VALUE 127
@@ -2630,7 +2630,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index d7d35da8459..4822f43fbb2 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -580,6 +580,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_DEADLOCK_DETECT
+SESSION_VALUE NULL
+GLOBAL_VALUE ON
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE ON
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Enable/disable InnoDB deadlock detector (default ON). if set to OFF, deadlock detection is skipped, and we rely on innodb_lock_wait_timeout in case of deadlock.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME INNODB_DEBUG_FORCE_SCRUBBING
SESSION_VALUE NULL
GLOBAL_VALUE OFF
@@ -1604,14 +1618,14 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_MAX_UNDO_LOG_SIZE
SESSION_VALUE NULL
-GLOBAL_VALUE 1073741824
+GLOBAL_VALUE 10485760
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 1073741824
+DEFAULT_VALUE 10485760
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Maximum size of UNDO tablespace in MB (If UNDO tablespace grows beyond this size it will be truncated in due course).
+VARIABLE_COMMENT Desired maximum UNDO tablespace size in bytes
NUMERIC_MIN_VALUE 10485760
-NUMERIC_MAX_VALUE 18446744073709551615
+NUMERIC_MAX_VALUE 281474976710656
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -2120,6 +2134,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME INNODB_STATS_INCLUDE_DELETE_MARKED
+SESSION_VALUE NULL
+GLOBAL_VALUE OFF
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE OFF
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE BOOLEAN
+VARIABLE_COMMENT Include delete marked records when calculating persistent statistics
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST OFF,ON
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_STATS_METHOD
SESSION_VALUE NULL
GLOBAL_VALUE nulls_equal
@@ -2477,9 +2505,9 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
-VARIABLE_COMMENT Number of undo tablespaces to use.
+VARIABLE_COMMENT Number of undo tablespaces to use.
NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 95
+NUMERIC_MAX_VALUE 127
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
index 53838366a16..802ee3b1c6d 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
@@ -367,7 +367,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME WSREP_PATCH_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE wsrep_25.16
+GLOBAL_VALUE wsrep_25.19
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/t/innodb_deadlock_detect_basic.test b/mysql-test/suite/sys_vars/t/innodb_deadlock_detect_basic.test
new file mode 100644
index 00000000000..8cac13906c8
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_deadlock_detect_basic.test
@@ -0,0 +1,53 @@
+--source include/have_innodb.inc
+
+SET @start_global_value = @@global.innodb_deadlock_detect;
+SELECT @start_global_value;
+
+#
+# exists as global
+#
+--echo Valid values are 'ON' and 'OFF'
+select @@global.innodb_deadlock_detect in (0, 1);
+select @@global.innodb_deadlock_detect;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_deadlock_detect in (0, 1);
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_deadlock_detect;
+show global variables like 'innodb_deadlock_detect';
+show session variables like 'innodb_deadlock_detect';
+
+#
+# show that it's writable
+#
+set global innodb_deadlock_detect='OFF';
+--error ER_GLOBAL_VARIABLE
+set session innodb_deadlock_detect='OFF';
+select @@global.innodb_deadlock_detect;
+set @@global.innodb_deadlock_detect=1;
+select @@global.innodb_deadlock_detect;
+set global innodb_deadlock_detect=0;
+select @@global.innodb_deadlock_detect;
+set @@global.innodb_deadlock_detect='ON';
+select @@global.innodb_deadlock_detect;
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_deadlock_detect=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_deadlock_detect=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_deadlock_detect=2;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_deadlock_detect='AUTO';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_deadlock_detect=-3;
+select @@global.innodb_deadlock_detect;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_deadlock_detect = @start_global_value;
+SELECT @@global.innodb_deadlock_detect;
diff --git a/mysql-test/suite/sys_vars/t/innodb_max_undo_log_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_undo_log_size_basic.test
index 9882578923e..e311d6fb873 100644
--- a/mysql-test/suite/sys_vars/t/innodb_max_undo_log_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_max_undo_log_size_basic.test
@@ -37,17 +37,21 @@ SELECT COUNT(@@GLOBAL.innodb_max_undo_log_size);
# Check if Value can set #
####################################################################
+SET @save = @@GLOBAL.innodb_max_undo_log_size;
+
SET @@GLOBAL.innodb_max_undo_log_size=1073741824;
SELECT COUNT(@@GLOBAL.innodb_max_undo_log_size);
--echo 1 Expected
SET @@GLOBAL.innodb_max_undo_log_size=18446744073709551615;
-SELECT @@GLOBAL.innodb_max_undo_log_size;
---echo 18446744073709551615 Expected
+SELECT FLOOR(@@GLOBAL.innodb_max_undo_log_size / @@GLOBAL.innodb_page_size);
+--echo 4294967296 Expected
SET @@GLOBAL.innodb_max_undo_log_size=1073741824;
+SET GLOBAL innodb_max_undo_log_size = @save;
+
--echo '#---------------------BS_STVARS_035_03----------------------#'
#################################################################
# Check if the value in GLOBAL Table matches value in variable #
diff --git a/mysql-test/suite/wsrep/r/binlog_format.result b/mysql-test/suite/wsrep/r/binlog_format.result
index 83af2b67762..079ceb975dd 100644
--- a/mysql-test/suite/wsrep/r/binlog_format.result
+++ b/mysql-test/suite/wsrep/r/binlog_format.result
@@ -1,4 +1,4 @@
-call mtr.add_suppression("WSREP: MariaDB Galera and flashback do not support binlog format.*");
+call mtr.add_suppression("WSREP: MariaDB Galera does not support binlog format");
call mtr.add_suppression("WSREP: Cannot get fake transaction ID from storage engine.");
#
# MDEV-4227: Galera server should stop crashing on setting binlog_format STATEMENT
diff --git a/mysql-test/suite/wsrep/r/wsrep_rpl.result b/mysql-test/suite/wsrep/r/wsrep_rpl.result
index 20ebb4802de..0d8f7bd9d7a 100644
--- a/mysql-test/suite/wsrep/r/wsrep_rpl.result
+++ b/mysql-test/suite/wsrep/r/wsrep_rpl.result
@@ -8,14 +8,14 @@ connection master;
connection slave;
connection master;
CREATE TABLE t1(i INT) ENGINE = INNODB;
-SET @@GLOBAL.wsrep_max_ws_rows = 1;
+SET @@GLOBAL.wsrep_max_ws_rows = 2;
INSERT INTO t1 VALUES(1), (2);
connection slave;
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
connection slave;
-SET @@GLOBAL.wsrep_max_ws_rows = 1;
+SET @@GLOBAL.wsrep_max_ws_rows = 2;
connection master;
DELETE FROM t1;
connection slave;
diff --git a/mysql-test/suite/wsrep/t/binlog_format.test b/mysql-test/suite/wsrep/t/binlog_format.test
index 02602b9cb2b..07001b17a84 100644
--- a/mysql-test/suite/wsrep/t/binlog_format.test
+++ b/mysql-test/suite/wsrep/t/binlog_format.test
@@ -1,7 +1,7 @@
--source include/have_wsrep_provider.inc
--source include/have_binlog_format_row.inc
-call mtr.add_suppression("WSREP: MariaDB Galera and flashback do not support binlog format.*");
+call mtr.add_suppression("WSREP: MariaDB Galera does not support binlog format");
call mtr.add_suppression("WSREP: Cannot get fake transaction ID from storage engine.");
--echo #
diff --git a/mysql-test/suite/wsrep/t/wsrep_rpl.test b/mysql-test/suite/wsrep/t/wsrep_rpl.test
index 1cc7214325d..4f34aadc365 100644
--- a/mysql-test/suite/wsrep/t/wsrep_rpl.test
+++ b/mysql-test/suite/wsrep/t/wsrep_rpl.test
@@ -15,18 +15,13 @@ let $wsrep_max_ws_rows_slave = `SELECT @@GLOBAL.wsrep_max_ws_rows`;
connection master;
CREATE TABLE t1(i INT) ENGINE = INNODB;
-# Setting wsrep_max_ws_rows should have no impact on replication master
-# unless its a cluster node.
-SET @@GLOBAL.wsrep_max_ws_rows = 1;
+SET @@GLOBAL.wsrep_max_ws_rows = 2;
INSERT INTO t1 VALUES(1), (2);
-
sync_slave_with_master;
SELECT COUNT(*) = 2 FROM t1;
connection slave;
-# Setting wsrep_max_ws_rows should have no impact on replication slave
-# unless its a cluster node.
-SET @@GLOBAL.wsrep_max_ws_rows = 1;
+SET @@GLOBAL.wsrep_max_ws_rows = 2;
connection master;
DELETE FROM t1;
@@ -38,7 +33,6 @@ connection master;
DROP TABLE t1;
sync_slave_with_master;
-
# Restore wsrep_max_ws_rows on master and slave
connection master;
eval SET @@GLOBAL.wsrep_max_ws_rows = $wsrep_max_ws_rows_master;
diff --git a/mysql-test/t/check_constraint.test b/mysql-test/t/check_constraint.test
index 437463ee457..c70a208f774 100644
--- a/mysql-test/t/check_constraint.test
+++ b/mysql-test/t/check_constraint.test
@@ -88,6 +88,12 @@ alter table t1 drop column a;
drop table t1;
#
+# MDEV-11117 CHECK constraint fails on intermediate step of ALTER
+#
+-- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
+create or replace table t1( c1 int auto_increment primary key, check( c1 > 0 or c1 is null ) );
+
+#
# MDEV-12421 Check constraint with query crashes server and renders DB unusable
#
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test
index bcdc06afbad..0cc63104fa5 100644
--- a/mysql-test/t/cte_nonrecursive.test
+++ b/mysql-test/t/cte_nonrecursive.test
@@ -644,7 +644,7 @@ show create view v1;
drop view v1;
--echo #
---echo # MDEV-12440: the same CTE table is used in twice
+--echo # MDEV-12440: the same CTE table is used twice
--echo #
create table t1 (a int, b varchar(32));
@@ -665,4 +665,19 @@ cte2 as (select * from cte1 where b > 'c'),
cte3 as (select * from cte2 where a > 1 union select * from cte2 where a > 1)
select * from cte3;
-drop table t1; \ No newline at end of file
+drop table t1;
+
+--echo #
+--echo # MDEV-12558: CTE with the same name as temporary table
+--echo #
+
+CREATE TABLE t ENGINE=MyISAM AS SELECT 1 AS i;
+CREATE TEMPORARY TABLE cte ENGINE=MyISAM AS SELECT 2 AS f;
+
+WITH cte AS ( SELECT i FROM t ) SELECT * FROM cte;
+WITH cte AS ( SELECT i FROM t GROUP BY i) SELECT * FROM cte;
+
+SELECT * FROM cte;
+
+DROP TABLE cte;
+DROP TABLE t;
diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test
index dd49582e719..5701ee896cb 100644
--- a/mysql-test/t/cte_recursive.test
+++ b/mysql-test/t/cte_recursive.test
@@ -1661,3 +1661,270 @@ select * from applied_modules;
drop table value_nodes, module_nodes, module_arguments, module_results;
+--echo #
+--echo # mdev-12519: recursive references in subqueries
+--echo #
+
+create table t1 (lp char(4) not null, rp char(4) not null);
+insert into t1 values
+ ('p1','p2'), ('p2','p3'), ('p3','p4'), ('p4','p5'),
+ ('p2','p7'), ('p7','p8'), ('p8','p3'), ('p8','p4');
+
+set standard_compliant_cte=0;
+
+with recursive
+reachables(p) as
+(
+ select lp from t1 where lp = 'p1'
+ union
+ select t1.rp from reachables, t1
+ where t1.lp = reachables.p
+)
+select * from reachables;
+
+with recursive
+reachables(p) as
+(
+ select lp from t1 where lp = 'p1'
+ union
+ select t1.rp from reachables, t1
+ where 'p3' not in (select * from reachables) and
+ t1.lp = reachables.p
+)
+select * from reachables;
+
+with recursive
+reachables(p) as
+(
+ select lp from t1 where lp = 'p1'
+ union
+ select t1.rp from reachables, t1
+ where 'p3' not in (select p from reachables where p <= 'p5'
+ union
+ select p from reachables where p > 'p5') and
+ t1.lp = reachables.p
+)
+select * from reachables;
+
+prepare stmt from "
+with recursive
+reachables(p) as
+(
+ select lp from t1 where lp = 'p1'
+ union
+ select t1.rp from reachables, t1
+ where 'p3' not in (select p from reachables where p <= 'p5'
+ union
+ select p from reachables where p > 'p5') and
+ t1.lp = reachables.p
+)
+select * from reachables;
+";
+
+execute stmt;
+execute stmt;
+
+deallocate prepare stmt;
+
+drop table t1;
+
+create table objects(v char(4) not null);
+insert into objects values
+ ('v1'), ('v2'), ('v3'), ('v4'), ('v5'),
+ ('v6'), ('v7'), ('v8'), ('v9'), ('v10');
+
+create table modules(m char(4) not null);
+insert into modules values
+ ('m1'), ('m2'), ('m3'), ('m4');
+
+create table module_arguments(m char(4) not null, v char(4) not null);
+insert into module_arguments values
+ ('m1','v3'), ('m1','v9'),
+ ('m2','v4'), ('m2','v7'),
+ ('m3','v6'), ('m4','v2');
+
+create table module_results(m char(4) not null, v char(4) not null);
+insert into module_results values
+ ('m1','v4'),
+ ('m2','v1'), ('m2','v6'),
+ ('m3','v10'), ('m4','v7');
+
+set standard_compliant_cte=0;
+
+with recursive
+reached_objects as
+(
+ select v, 'init' as m from objects where v in ('v3','v7','v9')
+ union
+ select module_results.v, module_results.m from module_results, applied_modules
+ where module_results.m = applied_modules.m
+),
+applied_modules as
+(
+ select * from modules where 1=0
+ union
+ select modules.m
+ from
+ modules
+ where
+ not exists (select * from module_arguments
+ where module_arguments.m = modules.m and
+ module_arguments.v not in
+ (select v from reached_objects))
+)
+select * from reached_objects;
+
+with recursive
+reached_objects as
+(
+ select v, 'init' as m from objects where v in ('v3','v7','v9')
+ union
+ select module_results.v, module_results.m from module_results, applied_modules
+ where module_results.m = applied_modules.m
+),
+applied_modules as
+(
+ select * from modules where 1=0
+ union
+ select modules.m
+ from
+ modules
+ where
+ 'v6' not in (select v from reached_objects) and
+ not exists (select * from module_arguments
+ where module_arguments.m = modules.m and
+ module_arguments.v not in
+ (select v from reached_objects))
+)
+select * from reached_objects;
+
+prepare stmt from "
+with recursive
+reached_objects as
+(
+ select v, 'init' as m from objects where v in ('v3','v7','v9')
+ union
+ select module_results.v, module_results.m from module_results, applied_modules
+ where module_results.m = applied_modules.m
+),
+applied_modules as
+(
+ select * from modules where 1=0
+ union
+ select modules.m
+ from
+ modules
+ where
+ 'v6' not in (select v from reached_objects) and
+ not exists (select * from module_arguments
+ where module_arguments.m = modules.m and
+ module_arguments.v not in
+ (select v from reached_objects))
+)
+select * from reached_objects;
+";
+
+execute stmt;
+execute stmt;
+
+deallocate prepare stmt;
+
+drop table objects, modules, module_arguments, module_results;
+
+set standard_compliant_cte=default;
+select @@standard_compliant_cte;
+
+--echo #
+--echo # mdev-12554: impossible where in recursive select
+--echo #
+
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES (1),(2);
+
+WITH RECURSIVE
+cte(f) AS ( SELECT i FROM t1 UNION SELECT f FROM t1, cte WHERE 1=0 )
+SELECT * FROM cte;
+
+DROP TABLE t1;
+
+--echo #
+--echo # mdev-12556: recursive execution uses Aria temporary tables
+--echo #
+
+CREATE TABLE t (c1 varchar(255), c2 tinytext);
+INSERT INTO t VALUES ('a','a'),('b','b'),('c','c'),('d','d');
+
+let $q1=
+WITH RECURSIVE cte(f) AS (
+ SELECT c1 FROM t
+ UNION
+ SELECT c1 FROM t, cte
+) SELECT COUNT(*) FROM cte;
+
+let $q2=
+WITH RECURSIVE cte(f) AS (
+ SELECT c2 FROM t
+ UNION
+ SELECT c2 FROM t, cte
+) SELECT COUNT(*) FROM cte;
+
+eval ANALYZE $q1;
+eval $q1;
+
+eval ANALYZE $q2;
+eval $q2;
+
+DROP TABLE t;
+
+--echo #
+--echo # mdev-12563: no recursive references on the top level of the CTE spec
+--echo #
+
+CREATE TABLE t (i int);
+INSERT INTO t VALUES (3), (1),(2);
+
+SET standard_compliant_cte=0;
+
+WITH RECURSIVE cte(f) AS (
+ SELECT i FROM t
+ UNION
+ SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte )
+) SELECT * FROM cte;
+
+WITH RECURSIVE cte(f) AS (
+ SELECT i FROM t
+ UNION
+ SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte WHERE i < 2 )
+ UNION
+ SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte WHERE i > 2 )
+) SELECT * FROM cte;
+
+WITH RECURSIVE cte(f) AS (
+ SELECT i FROM t
+ UNION
+ SELECT i FROM t
+ WHERE i NOT IN ( SELECT * FROM cte WHERE i < 2
+ UNION
+ SELECT * FROM cte WHERE i > 2)
+) SELECT * FROM cte;
+
+WITH RECURSIVE cte(f) AS (
+ SELECT i FROM t
+ UNION
+ SELECT i FROM t
+ WHERE i NOT IN ( SELECT * FROM t
+ WHERE i IN ( SELECT * FROM cte ) GROUP BY i )
+) SELECT * FROM cte;
+
+WITH RECURSIVE cte(f) AS (
+ SELECT i FROM t
+ UNION
+ SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte )
+ UNION
+ SELECT * FROM cte WHERE f > 2
+) SELECT * FROM cte;
+
+set standard_compliant_cte=default;
+
+DROP TABLE t;
+
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index 2a043e78ea9..a3b349bb384 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -1287,6 +1287,20 @@ INSERT INTO t1 (a,b) VALUES ('2003-02-01','2003-05-01 12:05:55');
SELECT * FROM t1;
DROP TABLE t1;
+#
+# MDEV-10355 Weird error message upon CREATE TABLE with DEFAULT
+#
+# Column default value expression that includes a temporal function
+#
+CREATE OR REPLACE TABLE t1 ( col INT DEFAULT ( 1 LIKE ( NOW() BETWEEN '2000-01-01' AND '2012-12-12' ) ) );
+SHOW CREATE TABLE t1;
+SET timestamp = UNIX_TIMESTAMP( '2004-04-04' );
+INSERT INTO t1 VALUES( DEFAULT );
+SET timestamp = DEFAULT;
+INSERT INTO t1 VALUES( DEFAULT );
+SELECT * FROM t1;
+DROP TABLE t1;
+
--echo #
--echo # Hybrid type functions
diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test
index 47d01617b83..bc448093e33 100644
--- a/mysql-test/t/derived_cond_pushdown.test
+++ b/mysql-test/t/derived_cond_pushdown.test
@@ -1353,3 +1353,102 @@ DEALLOCATE PREPARE stmt2;
DROP VIEW v1;
DROP TABLE t1,t2;
+--echo #
+--echo # MDEV-12373: pushdown into derived with side effects is prohibited
+--echo #
+
+CREATE TABLE sales_documents (
+ id int NOT NULL AUTO_INCREMENT,
+ sale_id int NULL DEFAULT NULL,
+ type tinyint unsigned NULL DEFAULT NULL,
+ data text NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
+ date date NULL DEFAULT NULL,
+ order_number int unsigned NULL DEFAULT NULL,
+ created_at int NULL DEFAULT NULL,
+ updated_at int NULL DEFAULT NULL,
+ generated tinyint NOT NULL DEFAULT '0',
+ synced_at int NOT NULL DEFAULT '0',
+ sum decimal(13,2) NOT NULL DEFAULT '0',
+ PRIMARY KEY (id)
+);
+
+INSERT INTO sales_documents
+(id, sale_id, type, order_number, data, created_at,
+ updated_at, date, generated, synced_at, sum)
+VALUES
+(555, 165, 3, 5, '{}', 1486538300, 1486722835, '2017-02-17', 0, 1486538313, 2320.00),
+(556, 165, 2, 3, '{}', 1486538304, 1486563125, '2017-02-08', 1, 1486538302, 2320.00),
+(557, 158, 2, 2, '{}', 1486538661, 1486538661, '2017-02-08', 0, 1486538660, 2320.00),
+(558, 171, 1, 3, '{}', 1486539104, 1488203405, '2017-02-08', 1, 1486539102, 23230.00),
+(559, 171, 2, 5, '{}', 1486549233, 1487146010, '2017-02-08', 1, 1486549225, 37690.00),
+(560, 172, 1, 1, '{}', 1486658260, 1488203409, '2017-02-09', 1, 1486658256, 40312.00),
+(561, 172, 2, 1, '{}', 1486711997, 1486711997, '2017-02-10', 1, 1486711996, 40312.00),
+(562, 172, 3, 1, '{}', 1486712104, 1486721395, '2017-02-10', 1, 1486712101, 40312.00),
+(563, 171, 3, 2, '{}', 1486712953, 1486720244, '2017-02-10', 1, 1486712910, 23230.00),
+(564, 170, 1, 2, '{}', 1486715948, 1488203410, '2017-02-10', 1, 1486715930, 28873.00),
+(565, 170, 3, 3, '{}', 1486716782, 1486717426, '2017-02-10', 1, 1486716779, 61948.00),
+(566, 166, 3, 4, '{}', 1486720947, 1486720947, '2017-02-10', 1, 1486720945, 4640.00),
+(567, 167, 3, 5, '{}', 1486722741, 1486722783, '2017-02-26', 0, 1486722738, 14755.00),
+(568, 165, 1, 4, '{}', 1486722849, 1486722849, '2017-02-10', 0, 1486722846, 2320.00),
+(569, 173, 2, 2, '{}', 1486723073, 1487071275, '2017-02-10', 1, 1486723071, 14282.00),
+(570, 173, 1, 4, '{}', 1486723100, 1488203412, '2017-02-10', 1, 1486723099, 14282.00),
+(571, 167, 2, 4, '{}', 1486730859, 1486730859, '2017-02-10', 1, 1486730856, 18655.00),
+(572, 167, 1, 5, '{}', 1486730883, 1488203412, '2017-02-10', 1, 1486730877, 18655.00),
+(573, 174, 2, 51, '{}', 1486731622, 1487060259, '2017-02-10', 1, 1486731620, 7140.00),
+(574, 174, 3, 5, '{}', 1486993472, 1486993472, '2017-02-13', 1, 1488216147, 28020.00),
+(575, 174, 1, 6, '{}', 1486993530, 1488203412, '2017-02-13', 1, 1486993505, 7140.00),
+(576, 173, 3, 6, '{}', 1487071425, 1487071425, '2017-02-14', 0, 1487071422, 14282.00),
+(577, 178, 2, 6, '{}', 1487327372, 1487327372, '2017-02-17', 1, 1487327370, 12321.00),
+(578, 177, 2, 7, '{}', 1487327394, 1487327394, '2017-02-17', 0, 1487327391, 4270.00),
+(579, 182, 3, 6, '{}', 1487750589, 1487751693, '2017-02-22', 1, 1487751688, 4270.00),
+(580, 182, 2, 7, '{}', 1487750601, 1487750663, '2017-02-22', 1, 1487750598, 4270.00),
+(581, 182, 1, 7, '{}', 1487750694, 1488203412, '2017-02-22', 1, 1487750692, 4270.00),
+(582, 185, 3, 7, '{}', 1487774051, 1487774051, '2017-02-22', 0, 1487774043, 8913.00),
+(583, 184, 3, 7, '{}', 1487774071, 1487774235, '2017-02-22', 0, 1487774093, 3285.00),
+(584, 184, 2, 8, '{}', 1487774074, 1487774074, '2017-02-22', 0, 1487774073, 3285.00),
+(585, 184, 1, 8, '{}', 1487774081, 1487774081, '2017-02-22', 0, 1487774075, 3285.00),
+(586, 193, 2, 8, '{}', 1487955294, 1487955318, '2017-02-24', 0, 1487955311, 4270.00),
+(587, 193, 1, 8, '{}', 1487955324, 1487955324, '2017-02-24', 0, 1487955320, 4270.00),
+(588, 193, 3, 7, '{}', 1487955341, 1487955341, '2017-02-24', 0, 1487955325, 4270.00),
+(589, 186, 1, 8, '{}', 1487957291, 1487957464, '2017-02-24', 0, 1487957459, 6960.00),
+(590, 186, 2, 8, '{}', 1487957308, 1487957468, '2017-02-24', 0, 1487957465, 6960.00),
+(591, 186, 3, 7, '{}', 1487957312, 1487957473, '2017-02-24', 0, 1487957469, 6960.00),
+(592, 194, 1, 8, '{}', 1488193293, 1488203412, '2017-02-27', 1, 1488193280, 2320.00),
+(593, 194, 2, 8, '{}', 1488193304, 1488193304, '2017-02-27', 1, 1488193303, 2320.00),
+(594, 210, 1, 9, '{}', 1488198896, 1488198896, '2017-02-27', 0, 1488198885, 4270.00),
+(595, 210, 2, 12, '{}', 1488198901, 1488198901, '2017-02-27', 1, 1488532585, 4270.00),
+(596, 210, 3, 10, '{}', 1488198904, 1488198904, '2017-02-27', 1, 1488532565, 4270.00),
+(597, 209, 2, 9, '{}', 1488200016, 1488450772, '2017-02-27', 1, 1488450449, 4270.00),
+(598, 209, 1, 9, '{}', 1488200020, 1488200063, '2017-02-27', 1, 1488200017, 4271.00),
+(599, 209, 3, 7, '{}', 1488200053, 1488200053, '2017-02-27', 0, 1488200021, 4271.00),
+(600, 211, 2, 10, '{}', 1488216265, 1489402027, '2017-02-27', 1, 1488216264, 2320.00),
+(601, 211, 3, 7, '{}', 1488216281, 1488216281, '2017-02-27', 1, 1488216276, 2320.00),
+(602, 211, 1, 10, '{}', 1488216283, 1488216283, '2017-02-27', 1, 1488216282, 2320.00),
+(603, 198, 2, 11, '{}', 1488280125, 1488280125, '2017-02-28', 0, 1488280095, 4270.00),
+(604, 198, 1, 11, '{}', 1488280160, 1488280160, '2017-02-28', 0, 1488280126, 4270.00),
+(605, 198, 3, 8, '{}', 1488280440, 1488280440, '2017-02-28', 0, 1488280435, 4270.00),
+(606, 212, 1, 12, '{}', 1488286301, 1489402168, '2017-02-28', 1, 1488286295, 13825.00),
+(607, 212, 3, 8, '{}', 1488289644, 1488289690, '2017-02-28', 1, 1488289642, 25295.00),
+(608, 212, 2, 13, '{}', 1488290350, 1488290431, '2017-02-28', 1, 1488290347, 13133.75),
+(609, 213, 1, 11, '{}', 1488529470, 1488529470, '2017-03-03', 1, 1488529461, 5660.00),
+(610, 213, 2, 11, '{}', 1488529484, 1488529484, '2017-03-03', 1, 1488529479, 5660.00),
+(611, 213, 3, 9, '{}', 1488529493, 1488529493, '2017-03-03', 1, 1488529489, 5660.00),
+(612, 197, 2, 13, '{}', 1489400715, 1489400715, '2017-03-13', 0, 1489398959, 4270.00),
+(613, 219, 3, 11, '{}', 1490084337, 1490181958, '2017-03-21', 1, 1490084334, 73526.00),
+(614, 216, 3, 11, '{}', 1490085757, 1490086717, '2017-03-21', 0, 1490085755, 5377.00);
+
+SELECT * FROM
+(SELECT @row := @row + 1 as row, a.* from (
+ SELECT t.order_number
+ FROM sales_documents t
+ WHERE
+ t.type = 2 AND
+ t.date >= '2017-01-01' AND
+ t.date <= '2017-12-31' AND
+ t.order_number IS NOT NULL AND
+ t.generated = 1
+ GROUP BY t.order_number
+) a, (SELECT @row := 0) r) t
+WHERE row <> order_number;
+
+DROP TABLE sales_documents;
diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test
index 72b8681ac44..0fc8e97b284 100644
--- a/mysql-test/t/func_json.test
+++ b/mysql-test/t/func_json.test
@@ -274,3 +274,25 @@ insert into t1 values
('{"a":1,"b":2,"c":3}','$.c');
select j, p, json_remove(j, p) from t1;
drop table t1;
+
+#
+# MDEV-12364 Server crashes in __memcpy_sse2_unaligned / String::copy on JSON_SEARCH with variables.
+#
+SET @str = 'bar', @path = '$';
+SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
+
+#
+# MDEV-12351 Assertion `cur_step->type & JSON_PATH_KEY' failed in json_find_path.
+#
+
+SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
+
+#
+# MDEV-12363 Assertion `0' failed in Type_handler_string_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*)
+#
+
+CREATE TABLE t1 (f INT NOT NULL);
+INSERT INTO t1 VALUES (0);
+SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
+DROP TABLE t1;
+
diff --git a/mysql-test/t/keyread.test b/mysql-test/t/keyread.test
new file mode 100644
index 00000000000..d9d3002d392
--- /dev/null
+++ b/mysql-test/t/keyread.test
@@ -0,0 +1,10 @@
+--source include/have_innodb.inc
+
+#
+# MDEV-12293 Assertion `table->no_keyread || !table->covering_keys.is_set(tab->index) || table->file->keyread == tab->index' failed
+#
+create table t1 (f1 int not null, f2 int, f3 int, primary key (f1,f2), key(f2,f3)) engine=innodb;
+create view v1 as select * from t1 where f2 = 1;
+select distinct f1 from v1;
+drop view v1;
+drop table t1;
diff --git a/mysql-test/t/loadxml.test b/mysql-test/t/loadxml.test
index 93e6e82189f..b26a2eacc00 100644
--- a/mysql-test/t/loadxml.test
+++ b/mysql-test/t/loadxml.test
@@ -130,3 +130,16 @@ CREATE TABLE t1 (col1 VARCHAR(3), col2 VARCHAR(3), col3 INTEGER);
LOAD XML INFILE '../../std_data/bug16171518_2.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY col1, col2, col3;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-12696 Crash with LOAD XML and non-updatable VIEW column
+--echo #
+
+CREATE TABLE t1 (c1 TEXT);
+CREATE VIEW v1 AS SELECT CONCAT(c1,'') AS c1, NULL AS c2 FROM t1;
+--error ER_LOAD_DATA_INVALID_COLUMN
+LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c1);
+--error ER_LOAD_DATA_INVALID_COLUMN,
+LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c2);
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index ea08f540cf3..6d4e0e3f2b9 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -2582,3 +2582,15 @@ let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/bug11505.sql;
let SEARCH_PATTERN=Database: mysql;
exec $MYSQL_DUMP mysql func > $SEARCH_FILE;
source include/search_pattern_in_file.inc;
+
+--echo #
+--echo # Test for --add-drop-trigger
+--echo #
+use test;
+CREATE TABLE t1 (a int, b int);
+CREATE TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW
+ SET NEW.b=NEW.a + 10;
+
+INSERT INTO t1 (a) VALUES (1),(2),(3);
+--exec $MYSQL_DUMP --triggers --no-data --no-create-info --add-drop-trigger --skip-comments --databases test
+DROP TABLE t1;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index f2e0adf9d53..282013222de 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -6056,3 +6056,20 @@ DROP TABLE t1, t2;
SET NAMES default;
--echo End of 10.1 tests
+
+--echo #
+--echo # MDEV-12564: IN TO EXISTS transformation for rows after
+--echo # conversion an outer join to inner join
+--echo #
+
+CREATE TABLE t (
+pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
+) ENGINE=MyISAM;
+INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
+
+SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
+ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
+
+DROP TABLE t;
+
+--echo End of 10.2 tests
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index 82c1dadf5ad..95d32c5bd14 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -1856,3 +1856,24 @@ from
) q;
drop table t1;
+
+--echo #
+--echo # MDEV-11990: window function over min/max aggregation
+--echo #
+
+create table t1 (id int);
+insert into t1 values (1), (2), (3), (2), (4), (2);
+
+select sum(max(id)) over (order by max(id)) from t1;
+explain
+select sum(max(id)) over (order by max(id)) from t1;
+
+create index idx on t1(id);
+select sum(max(id)) over (order by max(id)) from t1;
+explain
+select sum(max(id)) over (order by max(id)) from t1;
+select sum(max(id)) over (order by max(id)) from t1 where id < 3;
+select count(max(id)) over (order by max(id)) from t1 where id < 3;
+select max(id), rank() over (order by max(id)) from t1 where id < 3;
+
+drop table t1;
diff --git a/plugin/aws_key_management/CMakeLists.txt b/plugin/aws_key_management/CMakeLists.txt
index 59fdd1684f2..2202efe9e41 100644
--- a/plugin/aws_key_management/CMakeLists.txt
+++ b/plugin/aws_key_management/CMakeLists.txt
@@ -108,11 +108,19 @@ ELSE()
SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${loc})
ENDFOREACH()
+ # To be compatible with older cmake, we use older version of the SDK
+ # We increase the version for macs however, so the newest mac could built it.
+ IF(APPLE)
+ SET(GIT_TAG "1.0.100")
+ ELSE()
+ SET(GIT_TAG "1.0.8")
+ ENDIF()
+
SET(AWS_SDK_PATCH_COMMAND )
ExternalProject_Add(
aws_sdk_cpp
GIT_REPOSITORY "https://github.com/awslabs/aws-sdk-cpp.git"
- GIT_TAG "1.0.8"
+ GIT_TAG ${GIT_TAG}
UPDATE_COMMAND ""
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp"
${byproducts}
diff --git a/plugin/user_variables/CMakeLists.txt b/plugin/user_variables/CMakeLists.txt
index b9ec7d18ba1..6638a5cb622 100644
--- a/plugin/user_variables/CMakeLists.txt
+++ b/plugin/user_variables/CMakeLists.txt
@@ -1 +1,2 @@
-MYSQL_ADD_PLUGIN(user_variables user_variables.cc)
+MYSQL_ADD_PLUGIN(user_variables user_variables.cc
+ DEFAULT RECOMPILE_FOR_EMBEDDED)
diff --git a/plugin/user_variables/mysql-test/user_variables/basic.result b/plugin/user_variables/mysql-test/user_variables/basic.result
index 02de31b5e09..5650fa0dcce 100644
--- a/plugin/user_variables/mysql-test/user_variables/basic.result
+++ b/plugin/user_variables/mysql-test/user_variables/basic.result
@@ -7,7 +7,7 @@ PLUGIN_AUTHOR Sergey Vojtovich
PLUGIN_DESCRIPTION User-defined variables
PLUGIN_LICENSE GPL
LOAD_OPTION ON
-PLUGIN_MATURITY Alpha
+PLUGIN_MATURITY Gamma
SHOW CREATE TABLE INFORMATION_SCHEMA.USER_VARIABLES;
Table Create Table
user_variables CREATE TEMPORARY TABLE `user_variables` (
diff --git a/plugin/user_variables/mysql-test/user_variables/suite.pm b/plugin/user_variables/mysql-test/user_variables/suite.pm
index ae757eedee4..b927bf40ecc 100644
--- a/plugin/user_variables/mysql-test/user_variables/suite.pm
+++ b/plugin/user_variables/mysql-test/user_variables/suite.pm
@@ -6,7 +6,8 @@ return "No USER_VARIABLES plugin" unless
$ENV{USER_VARIABLES_SO} or
$::mysqld_variables{'user-variables'} eq "ON";
-return "Not run for embedded server" if $::opt_embedded_server;
+return "Not run for embedded server" if $::opt_embedded_server and
+ $ENV{USER_VARIABLES_SO};
sub is_default { 1 }
diff --git a/plugin/user_variables/user_variables.cc b/plugin/user_variables/user_variables.cc
index 981c39cdb86..9190b2effb7 100644
--- a/plugin/user_variables/user_variables.cc
+++ b/plugin/user_variables/user_variables.cc
@@ -134,6 +134,6 @@ maria_declare_plugin(user_variables)
NULL,
NULL,
"1.0",
- MariaDB_PLUGIN_MATURITY_ALPHA
+ MariaDB_PLUGIN_MATURITY_GAMMA
}
maria_declare_plugin_end;
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index eb15b884481..e7f20e78a63 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -255,6 +255,7 @@ ELSE()
IF(WITH_WSREP)
SET(WSREP_SCRIPTS
wsrep_sst_mysqldump
+ wsrep_sst_common
wsrep_sst_rsync
wsrep_sst_xtrabackup
wsrep_sst_xtrabackup-v2
diff --git a/scripts/wsrep_sst_common b/scripts/wsrep_sst_common
index 466bb46b382..466bb46b382 100644..100755
--- a/scripts/wsrep_sst_common
+++ b/scripts/wsrep_sst_common
diff --git a/sql/field.h b/sql/field.h
index ccc116f7a25..1333c924fa5 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -518,7 +518,10 @@ inline bool is_temporal_type(enum_field_types type)
enum enum_vcol_info_type
{
VCOL_GENERATED_VIRTUAL, VCOL_GENERATED_STORED,
- VCOL_DEFAULT, VCOL_CHECK_FIELD, VCOL_CHECK_TABLE
+ VCOL_DEFAULT, VCOL_CHECK_FIELD, VCOL_CHECK_TABLE,
+ /* Additional types should be added here */
+ /* Following is the highest value last */
+ VCOL_TYPE_NONE = 127 // Since the 0 value is already in use
};
static inline const char *vcol_type_name(enum_vcol_info_type type)
@@ -533,6 +536,8 @@ static inline const char *vcol_type_name(enum_vcol_info_type type)
case VCOL_CHECK_FIELD:
case VCOL_CHECK_TABLE:
return "CHECK";
+ case VCOL_TYPE_NONE:
+ return "UNTYPED";
}
return 0;
}
@@ -546,7 +551,8 @@ static inline const char *vcol_type_name(enum_vcol_info_type type)
#define VCOL_NON_DETERMINISTIC 2
#define VCOL_SESSION_FUNC 4 /* uses session data, e.g. USER or DAYNAME */
#define VCOL_TIME_FUNC 8
-#define VCOL_IMPOSSIBLE 16
+#define VCOL_AUTO_INC 16
+#define VCOL_IMPOSSIBLE 32
#define VCOL_NOT_STRICTLY_DETERMINISTIC \
(VCOL_NON_DETERMINISTIC | VCOL_TIME_FUNC | VCOL_SESSION_FUNC)
@@ -564,6 +570,7 @@ static inline const char *vcol_type_name(enum_vcol_info_type type)
class Virtual_column_info: public Sql_alloc
{
private:
+ enum_vcol_info_type vcol_type; /* Virtual column expression type */
/*
The following data is only updated by the parser and read
when a Create_field object is created/initialized.
@@ -581,7 +588,8 @@ public:
uint flags;
Virtual_column_info()
- : field_type((enum enum_field_types)MYSQL_TYPE_VIRTUAL),
+ : vcol_type((enum_vcol_info_type)VCOL_TYPE_NONE),
+ field_type((enum enum_field_types)MYSQL_TYPE_VIRTUAL),
in_partitioning_expr(FALSE), stored_in_db(FALSE),
utf8(TRUE), expr(NULL), flags(0)
{
@@ -589,6 +597,19 @@ public:
name.length= 0;
};
~Virtual_column_info() {}
+ enum_vcol_info_type get_vcol_type() const
+ {
+ return vcol_type;
+ }
+ void set_vcol_type(enum_vcol_info_type v_type)
+ {
+ vcol_type= v_type;
+ }
+ const char *get_vcol_type_name() const
+ {
+ DBUG_ASSERT(vcol_type != VCOL_TYPE_NONE);
+ return vcol_type_name(vcol_type);
+ }
enum_field_types get_real_type() const
{
return field_type;
diff --git a/sql/handler.h b/sql/handler.h
index b379f4e8b4d..7966351d02d 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -2889,10 +2889,9 @@ public:
bool keyread_enabled() { return keyread < MAX_KEY; }
int ha_start_keyread(uint idx)
{
- if (keyread_enabled())
- return 0;
+ int res= keyread_enabled() ? 0 : extra(HA_EXTRA_KEYREAD);
keyread= idx;
- return extra(HA_EXTRA_KEYREAD);
+ return res;
}
int ha_end_keyread()
{
diff --git a/sql/item.cc b/sql/item.cc
index bf962777a48..bb3dd1a1c6a 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -604,8 +604,9 @@ void Item::print_value(String *str)
str->append("NULL");
else
{
- switch (result_type()) {
+ switch (cmp_type()) {
case STRING_RESULT:
+ case TIME_RESULT:
append_unescaped(str, ptr->ptr(), ptr->length());
break;
case DECIMAL_RESULT:
@@ -614,7 +615,6 @@ void Item::print_value(String *str)
str->append(*ptr);
break;
case ROW_RESULT:
- case TIME_RESULT:
DBUG_ASSERT(0);
}
}
@@ -956,7 +956,7 @@ bool Item_field::register_field_in_write_map(void *arg)
This means:
- For default fields we can't access the same field or a field after
itself that doesn't have a non-constant default value.
- - A virtual fields can't access itself or a virtual field after itself.
+ - A virtual field can't access itself or a virtual field after itself.
- user-specified values will not see virtual fields or default expressions,
as in INSERT t1 (a) VALUES (b);
- no virtual fields can access auto-increment values
@@ -4279,7 +4279,7 @@ Item_param::eq(const Item *item, bool binary_cmp) const
void Item_param::print(String *str, enum_query_type query_type)
{
- if (state == NO_VALUE || query_type & QT_NO_DATA_EXPANSION)
+ if (state == NO_VALUE)
{
str->append('?');
}
@@ -9303,6 +9303,14 @@ void Item_cache::store(Item *item)
void Item_cache::print(String *str, enum_query_type query_type)
{
+ if (example && // There is a cached item
+ (query_type & QT_NO_DATA_EXPANSION)) // Caller is show-create-table
+ {
+ // Instead of "cache" or the cached value, print the cached item name
+ example->print(str, query_type);
+ return;
+ }
+
if (value_cached)
{
print_value(str);
@@ -9538,7 +9546,7 @@ int Item_cache_temporal::save_in_field(Field *field, bool no_conversions)
void Item_cache_temporal::store_packed(longlong val_arg, Item *example_arg)
{
- /* An explicit values is given, save it. */
+ /* An explicit value is given, save it. */
store(example_arg);
value_cached= true;
value= val_arg;
@@ -10362,7 +10370,7 @@ void Virtual_column_info::print(String *str)
(enum_query_type)(QT_ITEM_ORIGINAL_FUNC_NULLIF |
QT_ITEM_IDENT_SKIP_DB_NAMES |
QT_ITEM_IDENT_SKIP_TABLE_NAMES |
- QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS |
+ QT_NO_DATA_EXPANSION |
QT_TO_SYSTEM_CHARSET),
LOWEST_PRECEDENCE);
}
diff --git a/sql/item.h b/sql/item.h
index 5b85664bf73..c24ac19e439 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -337,6 +337,19 @@ typedef struct replace_equal_field_arg
struct st_join_table *context_tab;
} REPLACE_EQUAL_FIELD_ARG;
+
+class Load_data_out_param
+{
+public:
+ Load_data_out_param() { }
+ virtual ~Load_data_out_param() { }
+ virtual void load_data_set_null_value(CHARSET_INFO *cs) = 0;
+ virtual void load_data_set_value(const char *str, uint length,
+ CHARSET_INFO *cs) = 0;
+ virtual void load_data_print(THD *thd, String *str) = 0;
+};
+
+
class Settable_routine_parameter
{
public:
@@ -1448,6 +1461,7 @@ public:
/*========= Item processors, to be used with Item::walk() ========*/
virtual bool remove_dependence_processor(void *arg) { return 0; }
virtual bool cleanup_processor(void *arg);
+ virtual bool cleanup_excluding_fields_processor(void *arg) { return cleanup_processor(arg); }
virtual bool cleanup_excluding_const_fields_processor(void *arg) { return cleanup_processor(arg); }
virtual bool collect_item_field_processor(void *arg) { return 0; }
virtual bool collect_outer_ref_processor(void *arg) {return 0; }
@@ -1689,6 +1703,14 @@ public:
delete this;
}
+ virtual Load_data_out_param *get_load_data_out_param() { return 0; }
+ Load_data_out_param *get_load_data_out_param_or_error()
+ {
+ Load_data_out_param *res= get_load_data_out_param();
+ if (!res)
+ my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), full_name());
+ return res;
+ }
virtual Item_splocal *get_item_splocal() { return 0; }
virtual Rewritable_query_parameter *get_rewritable_query_parameter()
{ return 0; }
@@ -2763,6 +2785,11 @@ public:
bool check_vcol_func_processor(void *arg)
{
context= 0;
+ if (field && (field->unireg_check == Field::NEXT_NUMBER))
+ {
+ // Auto increment fields are unsupported
+ return mark_unsupported_function(field_name.str, arg, VCOL_FIELD_REF | VCOL_AUTO_INC);
+ }
return mark_unsupported_function(field_name.str, arg, VCOL_FIELD_REF);
}
void cleanup();
@@ -2781,6 +2808,8 @@ public:
virtual void print(String *str, enum_query_type query_type);
bool exclusive_dependence_on_table_processor(void *map);
bool exclusive_dependence_on_grouping_fields_processor(void *arg);
+ bool cleanup_excluding_fields_processor(void *arg)
+ { return field ? 0 : cleanup_processor(arg); }
bool cleanup_excluding_const_fields_processor(void *arg)
{ return field && const_item() ? 0 : cleanup_processor(arg); }
@@ -4427,6 +4456,14 @@ public:
{ return depended_from != NULL; }
bool exclusive_dependence_on_grouping_fields_processor(void *arg)
{ return depended_from != NULL; }
+ bool cleanup_excluding_fields_processor(void *arg)
+ {
+ Item *item= real_item();
+ if (item && item->type() == FIELD_ITEM &&
+ ((Item_field *)item)->field)
+ return 0;
+ return cleanup_processor(arg);
+ }
bool cleanup_excluding_const_fields_processor(void *arg)
{
Item *item= real_item();
@@ -5566,8 +5603,25 @@ public:
}
bool check_vcol_func_processor(void *arg)
{
+ if (example)
+ {
+ Item::vcol_func_processor_result *res= (Item::vcol_func_processor_result*)arg;
+ example->check_vcol_func_processor(arg);
+ /*
+ Item_cache of a non-deterministic function requires re-fixing
+ even if the function itself doesn't (e.g. CURRENT_TIMESTAMP)
+ */
+ if (res->errors & VCOL_NOT_STRICTLY_DETERMINISTIC)
+ res->errors|= VCOL_SESSION_FUNC;
+ return false;
+ }
return mark_unsupported_function("cache", arg, VCOL_IMPOSSIBLE);
}
+ void cleanup()
+ {
+ clear();
+ Item_basic_constant::cleanup();
+ }
/**
Check if saved item has a non-NULL value.
Will cache value of saved item if not already done.
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 9fc626b54f5..684b5a4f67d 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4425,7 +4425,10 @@ bool Item_func_set_user_var::fix_fields(THD *thd, Item **ref)
for (derived= unit->derived;
derived;
derived= derived->select_lex->master_unit()->derived)
+ {
derived->set_materialized_derived();
+ derived->prohibit_cond_pushdown= true;
+ }
}
return FALSE;
@@ -5400,14 +5403,15 @@ bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref)
}
-void Item_user_var_as_out_param::set_null_value(CHARSET_INFO* cs)
+void Item_user_var_as_out_param::load_data_set_null_value(CHARSET_INFO* cs)
{
::update_hash(entry, TRUE, 0, 0, STRING_RESULT, cs, 0 /* unsigned_arg */);
}
-void Item_user_var_as_out_param::set_value(const char *str, uint length,
- CHARSET_INFO* cs)
+void Item_user_var_as_out_param::load_data_set_value(const char *str,
+ uint length,
+ CHARSET_INFO* cs)
{
::update_hash(entry, FALSE, (void*)str, length, STRING_RESULT, cs,
0 /* unsigned_arg */);
@@ -5442,7 +5446,7 @@ my_decimal* Item_user_var_as_out_param::val_decimal(my_decimal *decimal_buffer)
}
-void Item_user_var_as_out_param::print_for_load(THD *thd, String *str)
+void Item_user_var_as_out_param::load_data_print(THD *thd, String *str)
{
str->append('@');
append_identifier(thd, str, name.str, name.length);
diff --git a/sql/item_func.h b/sql/item_func.h
index 33726cd2d84..3fcde96b81a 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -2339,7 +2339,8 @@ public:
in List<Item> and desire to place this code somewhere near other functions
working with user variables.
*/
-class Item_user_var_as_out_param :public Item
+class Item_user_var_as_out_param :public Item,
+ public Load_data_out_param
{
LEX_CSTRING name;
user_var_entry *entry;
@@ -2355,9 +2356,10 @@ public:
my_decimal *val_decimal(my_decimal *decimal_buffer);
/* fix_fields() binds variable name with its entry structure */
bool fix_fields(THD *thd, Item **ref);
- void print_for_load(THD *thd, String *str);
- void set_null_value(CHARSET_INFO* cs);
- void set_value(const char *str, uint length, CHARSET_INFO* cs);
+ Load_data_out_param *get_load_data_out_param() { return this; }
+ void load_data_print(THD *thd, String *str);
+ void load_data_set_null_value(CHARSET_INFO* cs);
+ void load_data_set_value(const char *str, uint length, CHARSET_INFO* cs);
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
{ return get_item_copy<Item_user_var_as_out_param>(thd, mem_root, this); }
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 8a61ab583c9..f2162e08323 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -1063,11 +1063,11 @@ Item_func_spatial_rel::get_mm_leaf(RANGE_OPT_PARAM *param,
tree->max_flag= NO_MAX_RANGE;
break;
case SP_WITHIN_FUNC:
- tree->min_flag= GEOM_FLAG | HA_READ_MBR_WITHIN;// NEAR_MIN;//512;
+ tree->min_flag= GEOM_FLAG | HA_READ_MBR_CONTAIN;// NEAR_MIN;//512;
tree->max_flag= NO_MAX_RANGE;
break;
case SP_CONTAINS_FUNC:
- tree->min_flag= GEOM_FLAG | HA_READ_MBR_CONTAIN;// NEAR_MIN;//512;
+ tree->min_flag= GEOM_FLAG | HA_READ_MBR_WITHIN;// NEAR_MIN;//512;
tree->max_flag= NO_MAX_RANGE;
break;
case SP_OVERLAPS_FUNC:
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index b8471dc8244..c7639bc2513 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -444,6 +444,7 @@ void Item_func_json_value::fix_length_and_dec()
collation.set(args[0]->collation);
max_length= args[0]->max_length;
path.set_constant_flag(args[1]->const_item());
+ maybe_null= 1;
}
@@ -582,6 +583,7 @@ void Item_func_json_unquote::fix_length_and_dec()
{
collation.set(&my_charset_utf8_general_ci);
max_length= args[0]->max_length;
+ maybe_null= 1;
}
@@ -683,6 +685,7 @@ void Item_func_json_extract::fix_length_and_dec()
max_length= args[0]->max_length * (arg_count - 1);
mark_constant_paths(paths, args+1, arg_count-1);
+ maybe_null= 1;
}
@@ -884,6 +887,7 @@ void Item_func_json_contains::fix_length_and_dec()
{
a2_constant= args[1]->const_item();
a2_parsed= FALSE;
+ maybe_null= 1;
if (arg_count > 2)
path.set_constant_flag(args[2]->const_item());
Item_int_func::fix_length_and_dec();
@@ -1129,6 +1133,7 @@ void Item_func_json_contains_path::fix_length_and_dec()
{
ooa_constant= args[1]->const_item();
ooa_parsed= FALSE;
+ maybe_null= 1;
mark_constant_paths(paths, args+2, arg_count-2);
Item_int_func::fix_length_and_dec();
}
@@ -2042,6 +2047,7 @@ void Item_func_json_length::fix_length_and_dec()
{
if (arg_count > 1)
path.set_constant_flag(args[1]->const_item());
+ maybe_null= 1;
}
@@ -2178,6 +2184,7 @@ void Item_func_json_type::fix_length_and_dec()
{
collation.set(&my_charset_utf8_general_ci);
max_length= 12;
+ maybe_null= 1;
}
@@ -2245,6 +2252,7 @@ void Item_func_json_insert::fix_length_and_dec()
}
fix_char_length_ulonglong(char_length);
+ maybe_null= 1;
}
@@ -2491,6 +2499,7 @@ void Item_func_json_remove::fix_length_and_dec()
max_length= args[0]->max_length;
mark_constant_paths(paths, args+1, arg_count-1);
+ maybe_null= 1;
}
@@ -2674,6 +2683,7 @@ void Item_func_json_keys::fix_length_and_dec()
{
collation.set(args[0]->collation);
max_length= args[0]->max_length;
+ maybe_null= 1;
if (arg_count > 1)
path.set_constant_flag(args[1]->const_item());
}
@@ -2815,6 +2825,7 @@ void Item_func_json_search::fix_length_and_dec()
if (arg_count > 4)
mark_constant_paths(paths, args+4, arg_count-4);
+ maybe_null= 1;
}
@@ -2898,7 +2909,7 @@ String *Item_func_json_search::val_str(String *str)
json_path_with_flags *c_path= paths + n_arg - 4;
if (!c_path->parsed)
{
- String *s_p= args[n_arg]->val_str(tmp_paths + (n_arg-1));
+ String *s_p= args[n_arg]->val_str(tmp_paths + (n_arg-4));
if (s_p &&
json_path_setup(&c_path->p,s_p->charset(),(const uchar *) s_p->ptr(),
(const uchar *) s_p->ptr() + s_p->length()))
@@ -2996,6 +3007,7 @@ void Item_func_json_format::fix_length_and_dec()
{
decimals= 0;
max_length= args[0]->max_length;
+ maybe_null= 1;
}
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 8c2afe79d9b..b38bdcb7d4f 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -40,6 +40,7 @@
#include "set_var.h"
#include "sql_select.h"
#include "sql_parse.h" // check_stack_overrun
+#include "sql_cte.h"
#include "sql_test.h"
double get_post_group_estimate(JOIN* join, double join_op_rows);
@@ -311,7 +312,8 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref)
else
goto end;
- if ((uncacheable= engine->uncacheable() & ~UNCACHEABLE_EXPLAIN))
+ if ((uncacheable= engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
+ with_recursive_reference)
{
const_item_cache= 0;
if (uncacheable & UNCACHEABLE_RAND)
@@ -916,7 +918,7 @@ table_map Item_subselect::used_tables() const
bool Item_subselect::const_item() const
{
DBUG_ASSERT(thd);
- return (thd->lex->context_analysis_only ?
+ return (thd->lex->context_analysis_only || with_recursive_reference ?
FALSE :
forced_const || const_item_cache);
}
@@ -936,7 +938,8 @@ void Item_subselect::update_used_tables()
if (!(engine->uncacheable() & ~UNCACHEABLE_EXPLAIN))
{
// did all used tables become static?
- if (!(used_tables_cache & ~engine->upper_select_const_tables()))
+ if (!(used_tables_cache & ~engine->upper_select_const_tables()) &&
+ ! with_recursive_reference)
const_item_cache= 1;
}
}
@@ -1739,7 +1742,7 @@ bool Item_in_subselect::val_bool()
if (forced_const)
return value;
DBUG_ASSERT((engine->uncacheable() & ~UNCACHEABLE_EXPLAIN) ||
- ! engine->is_executed());
+ ! engine->is_executed() || with_recursive_reference);
null_value= was_null= FALSE;
if (exec())
{
@@ -2393,7 +2396,8 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
&list_ref));
Item *col_item= new (thd->mem_root)
Item_cond_or(thd, item_eq, item_isnull);
- if (!abort_on_null && left_expr->element_index(i)->maybe_null)
+ if (!abort_on_null && left_expr->element_index(i)->maybe_null &&
+ get_cond_guard(i))
{
disable_cond_guard_for_const_null_left_expr(i);
if (!(col_item= new (thd->mem_root)
@@ -2411,7 +2415,8 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
ref_pointer_array[i],
(char *)"<no matter>",
&list_ref));
- if (!abort_on_null && left_expr->element_index(i)->maybe_null)
+ if (!abort_on_null && left_expr->element_index(i)->maybe_null &&
+ get_cond_guard(i) )
{
disable_cond_guard_for_const_null_left_expr(i);
if (!(item_nnull_test=
@@ -2471,7 +2476,7 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
(char *)"<no matter>",
&list_ref));
item= new (thd->mem_root) Item_cond_or(thd, item, item_isnull);
- if (left_expr->element_index(i)->maybe_null)
+ if (left_expr->element_index(i)->maybe_null && get_cond_guard(i))
{
disable_cond_guard_for_const_null_left_expr(i);
if (!(item= new (thd->mem_root)
@@ -2483,7 +2488,8 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join,
}
*having_item= and_items(thd, *having_item, having_col_item);
}
- if (!abort_on_null && left_expr->element_index(i)->maybe_null)
+ if (!abort_on_null && left_expr->element_index(i)->maybe_null &&
+ get_cond_guard(i))
{
if (!(item= new (thd->mem_root)
Item_func_trig_cond(thd, item, get_cond_guard(i))))
@@ -2835,7 +2841,8 @@ bool Item_exists_subselect::exists2in_processor(void *opt_arg)
join->having ||
first_select->with_sum_func ||
!first_select->leaf_tables.elements||
- !join->conds)
+ !join->conds ||
+ with_recursive_reference)
DBUG_RETURN(FALSE);
DBUG_ASSERT(first_select->order_list.elements == 0 &&
@@ -3487,6 +3494,11 @@ int subselect_single_select_engine::get_identifier()
return select_lex->select_number;
}
+void subselect_single_select_engine::force_reexecution()
+{
+ executed= false;
+}
+
void subselect_single_select_engine::cleanup()
{
DBUG_ENTER("subselect_single_select_engine::cleanup");
@@ -3515,6 +3527,11 @@ bool subselect_union_engine::is_executed() const
return unit->executed;
}
+void subselect_union_engine::force_reexecution()
+{
+ unit->executed= false;
+}
+
/*
Check if last execution of the subquery engine produced any rows
@@ -3831,7 +3848,8 @@ int subselect_single_select_engine::exec()
tab->read_record.read_record= tab->save_read_record;
}
executed= 1;
- if (!(uncacheable() & ~UNCACHEABLE_EXPLAIN))
+ if (!(uncacheable() & ~UNCACHEABLE_EXPLAIN) &&
+ !item->with_recursive_reference)
item->make_const();
thd->where= save_where;
thd->lex->current_select= save_select;
@@ -6678,6 +6696,13 @@ void subselect_table_scan_engine::cleanup()
}
+void Item_subselect::register_as_with_rec_ref(With_element *with_elem)
+{
+ with_elem->sq_with_rec_ref.link_in_list(this, &this->next_with_rec_ref);
+ with_recursive_reference= true;
+}
+
+
/*
Create an execution tracker for the expression cache we're using for this
subselect; add the tracker to the query plan.
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 22fc48391de..4c4af25edf5 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -32,6 +32,7 @@ class subselect_engine;
class subselect_hash_sj_engine;
class Item_bool_func2;
class Comp_creator;
+class With_element;
typedef class st_select_lex SELECT_LEX;
@@ -135,6 +136,9 @@ public:
*/
bool with_recursive_reference;
+ /* To link Item_subselects containing references to the same recursive CTE */
+ Item_subselect *next_with_rec_ref;
+
enum subs_type {UNKNOWN_SUBS, SINGLEROW_SUBS,
EXISTS_SUBS, IN_SUBS, ALL_SUBS, ANY_SUBS};
@@ -256,6 +260,7 @@ public:
return TRUE;
}
+ void register_as_with_rec_ref(With_element *with_elem);
void init_expr_cache_tracker(THD *thd);
Item* build_clone(THD *thd, MEM_ROOT *mem_root) { return 0; }
@@ -831,6 +836,7 @@ public:
virtual bool no_rows() = 0;
virtual enum_engine_type engine_type() { return ABSTRACT_ENGINE; }
virtual int get_identifier() { DBUG_ASSERT(0); return 0; }
+ virtual void force_reexecution() {}
protected:
void set_row(List<Item> &item_list, Item_cache **row);
};
@@ -864,6 +870,7 @@ public:
bool no_rows();
virtual enum_engine_type engine_type() { return SINGLE_SELECT_ENGINE; }
int get_identifier();
+ void force_reexecution();
friend class subselect_hash_sj_engine;
friend class Item_in_subselect;
@@ -894,6 +901,7 @@ public:
bool temp= FALSE);
bool no_tables();
bool is_executed() const;
+ void force_reexecution();
bool no_rows();
virtual enum_engine_type engine_type() { return UNION_ENGINE; }
};
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 1dca656ee08..383972d1a54 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -8403,6 +8403,11 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
Record any GTID in the same transaction, so slave state is transactionally
consistent.
*/
+#ifdef WITH_WSREP
+ /*Set wsrep_affected_rows = 0 */
+ thd->wsrep_affected_rows= 0;
+#endif
+
if (rgi->gtid_pending)
{
sub_id= rgi->gtid_sub_id;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 915387d6ba9..065f4d83367 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -9445,14 +9445,6 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
between options, setting of multiple variables, etc.
Do them here.
*/
-
- if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes ||
- opt_log_slow_slave_statements) &&
- !global_system_variables.sql_log_slow)
- sql_print_information("options --log-slow-admin-statements, "
- "--log-queries-not-using-indexes and "
- "--log-slow-slave-statements have no "
- "effect if --log-slow-queries is not set");
if (global_system_variables.net_buffer_length >
global_system_variables.max_allowed_packet)
{
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index e7bf4658d5c..9bc21ab3ac3 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -461,7 +461,7 @@ int opt_sum_query(THD *thd,
{
if (recalc_const_item)
item->update_used_tables();
- if (!item->const_item())
+ if (!item->const_item() && item->type() != Item::WINDOW_FUNC_ITEM)
const_result= 0;
}
}
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index 6788f422cbd..aaa72da29db 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -1164,7 +1164,8 @@ handle_rpl_parallel_thread(void *arg)
thd->wait_for_commit_ptr= &rgi->commit_orderer;
- if (opt_gtid_ignore_duplicates)
+ if (opt_gtid_ignore_duplicates &&
+ rgi->rli->mi->using_gtid != Master_info::USE_GTID_NO)
{
int res=
rpl_global_gtid_slave_state->check_duplicate_gtid(&rgi->current_gtid,
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index b2e895b0775..97a6421ec5c 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7453,6 +7453,8 @@ ER_JSON_PATH_EMPTY
eng "Path expression '$' is not allowed in argument %d to function '%s'."
ER_SLAVE_SAME_ID
eng "A slave with the same server_uuid/server_id as this slave has connected to the master"
+ER_FLASHBACK_NOT_SUPPORTED
+ eng "Flashback does not support %s %s"
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
eng "Illegal parameter data types %s and %s for operation '%s'"
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
diff --git a/sql/slave.cc b/sql/slave.cc
index 3ebd1b2ec46..b28bc1d8dc5 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3977,7 +3977,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
DBUG_RETURN(1);
}
- if (opt_gtid_ignore_duplicates)
+ if (opt_gtid_ignore_duplicates &&
+ rli->mi->using_gtid != Master_info::USE_GTID_NO)
{
int res= rpl_global_gtid_slave_state->check_duplicate_gtid
(&serial_rgi->current_gtid, serial_rgi);
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index 7c2a8cf9e65..c163044547f 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -141,7 +141,7 @@ bool With_clause::check_dependencies()
/*
Mark those elements where tables are defined with direct or indirect
- make recursion.
+ recursion.
*/
for (With_element *with_elem= with_list.first;
with_elem;
@@ -342,6 +342,8 @@ void With_element::check_dependencies_in_select(st_select_lex *sl,
tbl->with_internal_reference_map= get_elem_map();
if (in_subq)
sq_dep_map|= tbl->with->get_elem_map();
+ else
+ top_level_dep_map|= tbl->with->get_elem_map();
}
}
/* Now look for the dependencies in the subqueries of sl */
@@ -353,6 +355,53 @@ void With_element::check_dependencies_in_select(st_select_lex *sl,
/**
@brief
+ Find a recursive reference to this with element in subqueries of a select
+
+ @param sel The select in whose subqueries the reference
+ to be looked for
+
+ @details
+ The function looks for a recursive reference to this with element in
+ subqueries of select sl. When the first such reference is found
+ it is returned as the result.
+ The function assumes that the identification of all CTE references
+ has been performed earlier.
+
+ @retval
+ Pointer to the found recursive reference if the search succeeded
+ NULL - otherwise
+*/
+
+TABLE_LIST *With_element::find_first_sq_rec_ref_in_select(st_select_lex *sel)
+{
+ TABLE_LIST *rec_ref= NULL;
+ st_select_lex_unit *inner_unit= sel->first_inner_unit();
+ for (; inner_unit; inner_unit= inner_unit->next_unit())
+ {
+ st_select_lex *sl= inner_unit->first_select();
+ for (; sl; sl= sl->next_select())
+ {
+ for (TABLE_LIST *tbl= sl->table_list.first; tbl; tbl= tbl->next_local)
+ {
+ if (tbl->derived || tbl->nested_join)
+ continue;
+ if (tbl->with && tbl->with->owner== this->owner &&
+ (tbl->with_internal_reference_map & mutually_recursive))
+ {
+ rec_ref= tbl;
+ return rec_ref;
+ }
+ }
+ if ((rec_ref= find_first_sq_rec_ref_in_select(sl)))
+ return rec_ref;
+ }
+ }
+ return 0;
+}
+
+
+/**
+ @brief
Find the dependencies of this element on its siblings in a unit
@param unit The unit where to look for the dependencies
@@ -602,6 +651,10 @@ void With_clause::move_anchors_ahead()
@details
If the specification of this with element contains anchors the method
moves them at the very beginning of the specification.
+ Additionally for the other selects of the specification if none of them
+ contains a recursive reference to this with element or a mutually recursive
+ one the method looks for the first such reference in the first recursive
+ select and set a pointer to it in this->sq_rec_ref.
*/
void With_element::move_anchors_ahead()
@@ -618,6 +671,11 @@ void With_element::move_anchors_ahead()
sl->move_node(new_pos);
new_pos= sl->next_select();
}
+ else if (!sq_rec_ref && no_rec_ref_on_top_level())
+ {
+ sq_rec_ref= find_first_sq_rec_ref_in_select(sl);
+ DBUG_ASSERT(sq_rec_ref != NULL);
+ }
last_sl= sl;
}
if (spec->union_distinct)
@@ -967,6 +1025,17 @@ With_element *st_select_lex::find_table_def_in_with_clauses(TABLE_LIST *table)
bool TABLE_LIST::set_as_with_table(THD *thd, With_element *with_elem)
{
+ if (table)
+ {
+ /*
+ This table was prematurely identified as a temporary table.
+ We correct it here, but it's not a nice solution in the case
+ when the temporary table with this name is not used anywhere
+ else in the query.
+ */
+ thd->mark_tmp_table_as_free_for_reuse(table);
+ table= 0;
+ }
with= with_elem;
if (!with_elem->is_referenced() || with_elem->is_recursive)
derived= with_elem->spec;
@@ -1228,6 +1297,7 @@ bool st_select_lex::check_subqueries_with_recursive_references()
continue;
Item_subselect *subq= (Item_subselect *) sl_master->item;
subq->with_recursive_reference= true;
+ subq->register_as_with_rec_ref(tbl->with);
}
}
return false;
diff --git a/sql/sql_cte.h b/sql/sql_cte.h
index a87c1b8acbd..85676df9d39 100644
--- a/sql/sql_cte.h
+++ b/sql/sql_cte.h
@@ -46,6 +46,16 @@ private:
/* Dependency map of with elements mutually recursive with this with element */
table_map mutually_recursive;
/*
+ Dependency map built only for the top level references i.e. for those that
+ are encountered in from lists of the selects of the specification unit
+ */
+ table_map top_level_dep_map;
+ /*
+ Points to a recursive reference in subqueries.
+ Used only for specifications without recursive references on the top level.
+ */
+ TABLE_LIST *sq_rec_ref;
+ /*
The next with element from the circular chain of the with elements
mutually recursive with this with element.
(If This element is simply recursive than next_mutually_recursive contains
@@ -119,11 +129,15 @@ public:
*/
select_union_recursive *rec_result;
+ /* List of Item_subselects containing recursive references to this CTE */
+ SQL_I_List<Item_subselect> sq_with_rec_ref;
+
With_element(LEX_CSTRING *name,
List <LEX_CSTRING> list,
st_select_lex_unit *unit)
: next(NULL), base_dep_map(0), derived_dep_map(0),
sq_dep_map(0), work_dep_map(0), mutually_recursive(0),
+ top_level_dep_map(0), sq_rec_ref(NULL),
next_mutually_recursive(NULL), references(0),
query_name(name), column_list(list), spec(unit),
is_recursive(false), with_anchor(false),
@@ -151,6 +165,8 @@ public:
bool check_dependency_on(With_element *with_elem)
{ return base_dep_map & with_elem->get_elem_map(); }
+ TABLE_LIST *find_first_sq_rec_ref_in_select(st_select_lex *sel);
+
bool set_unparsed_spec(THD *thd, char *spec_start, char *spec_end);
st_select_lex_unit *clone_parsed_spec(THD *thd, TABLE_LIST *with_table);
@@ -174,11 +190,16 @@ public:
bool contains_sq_with_recursive_reference()
{ return sq_dep_map & mutually_recursive; }
+ bool no_rec_ref_on_top_level()
+ { return !(top_level_dep_map & mutually_recursive); }
+
table_map get_mutually_recursive() { return mutually_recursive; }
With_element *get_next_mutually_recursive()
{ return next_mutually_recursive; }
+ TABLE_LIST *get_sq_rec_ref() { return sq_rec_ref; }
+
bool is_anchor(st_select_lex *sel);
void move_anchors_ahead();
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 827fb21edf4..cd8540eb072 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -646,6 +646,23 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
SELECT_LEX *first_select= unit->first_select();
+ if (derived->is_recursive_with_table() &&
+ !derived->is_with_table_recursive_reference() &&
+ !derived->with->rec_result && derived->with->get_sq_rec_ref())
+ {
+ /*
+ This is a non-recursive reference to a recursive CTE whose
+ specification unit has not been prepared at the regular processing of
+ derived table references. This can happen only in the case when
+ the specification unit has no recursive references at the top level.
+ Force the preparation of the specification unit. Use a recursive
+ table reference from a subquery for this.
+ */
+ DBUG_ASSERT(derived->with->get_sq_rec_ref());
+ if (mysql_derived_prepare(lex->thd, lex, derived->with->get_sq_rec_ref()))
+ DBUG_RETURN(TRUE);
+ }
+
if (unit->prepared && derived->is_recursive_with_table() &&
!derived->table)
{
@@ -1148,6 +1165,9 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
st_select_lex_unit *unit= derived->get_unit();
st_select_lex *sl= unit->first_select();
+ if (derived->prohibit_cond_pushdown)
+ DBUG_RETURN(false);
+
/* Do not push conditions into constant derived */
if (unit->executed)
DBUG_RETURN(false);
diff --git a/sql/sql_derived.h b/sql/sql_derived.h
index c451e423032..f098cf39083 100644
--- a/sql/sql_derived.h
+++ b/sql/sql_derived.h
@@ -39,10 +39,6 @@ bool mysql_derived_cleanup(THD *thd, LEX *lex, TABLE_LIST *derived);
Item *delete_not_needed_parts(THD *thd, Item *cond);
-#if 0
-bool pushdown_cond_for_derived(THD *thd, Item **cond, TABLE_LIST *derived);
-#else
bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived);
-#endif
#endif /* SQL_DERIVED_INCLUDED */
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index b430aea4c0b..1a5fac30536 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -431,7 +431,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
else
tot_length+= field->field_length;
}
- else if (item->type() == Item::STRING_ITEM)
+ else if (item->get_load_data_out_param())
use_vars= 1;
}
if (use_blobs && !ex->line_term->length() && !field_term->length())
@@ -814,11 +814,7 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
if (item->real_type() == Item::FIELD_ITEM)
append_identifier(thd, &query_str, item->name.str, item->name.length);
else
- {
- /* Actually Item_user_var_as_out_param despite claiming STRING_ITEM. */
- DBUG_ASSERT(item->type() == Item::STRING_ITEM);
- ((Item_user_var_as_out_param *)item)->print_for_load(thd, &query_str);
- }
+ item->get_load_data_out_param()->load_data_print(thd, &query_str);
}
query_str.append(")");
}
@@ -1062,6 +1058,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
uint length;
uchar *pos;
Item *real_item;
+ Load_data_out_param *out_param;
if (read_info.read_field())
break;
@@ -1104,18 +1101,11 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
}
/* Do not auto-update this field. */
field->set_has_explicit_value();
- }
- else if (item->type() == Item::STRING_ITEM)
- {
- ((Item_user_var_as_out_param *)item)->set_null_value(
- read_info.read_charset);
}
+ else if ((out_param= item->get_load_data_out_param_or_error()))
+ out_param->load_data_set_null_value(read_info.read_charset);
else
- {
- my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name());
DBUG_RETURN(1);
- }
-
continue;
}
@@ -1129,16 +1119,11 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
field->store((char*) pos, length, read_info.read_charset);
field->set_has_explicit_value();
}
- else if (item->type() == Item::STRING_ITEM)
- {
- ((Item_user_var_as_out_param *)item)->set_value((char*) pos, length,
- read_info.read_charset);
- }
+ else if ((out_param= item->get_load_data_out_param_or_error()))
+ out_param->load_data_set_value((const char *) pos, length,
+ read_info.read_charset);
else
- {
- my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name());
DBUG_RETURN(1);
- }
}
if (thd->is_error())
@@ -1158,6 +1143,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
break;
for (; item ; item= it++)
{
+ Load_data_out_param *out_param;
Item *real_item= item->real_item();
if (real_item->type() == Item::FIELD_ITEM)
{
@@ -1183,16 +1169,10 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
ER_THD(thd, ER_WARN_TOO_FEW_RECORDS),
thd->get_stmt_da()->current_row_for_warning());
}
- else if (item->type() == Item::STRING_ITEM)
- {
- ((Item_user_var_as_out_param *)item)->set_null_value(
- read_info.read_charset);
- }
+ else if ((out_param= item->get_load_data_out_param_or_error()))
+ out_param->load_data_set_null_value(read_info.read_charset);
else
- {
- my_error(ER_LOAD_DATA_INVALID_COLUMN, MYF(0), item->full_name());
DBUG_RETURN(1);
- }
}
}
@@ -1288,6 +1268,7 @@ read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
while ((item= it++))
{
+ Load_data_out_param *out_param;
/* If this line is to be skipped we don't want to fill field or var */
if (skip_lines)
continue;
@@ -1319,14 +1300,15 @@ read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
/* Do not auto-update this field. */
field->set_has_explicit_value();
}
+ else if ((out_param= item->get_load_data_out_param_or_error()))
+ out_param->load_data_set_null_value(cs);
else
- ((Item_user_var_as_out_param *) item)->set_null_value(cs);
+ DBUG_RETURN(1);
continue;
}
if (item->type() == Item::FIELD_ITEM)
{
-
Field *field= ((Item_field *)item)->field;
field->set_notnull();
if (field == table->next_number_field)
@@ -1334,10 +1316,12 @@ read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
field->store((char *) tag->value.ptr(), tag->value.length(), cs);
field->set_has_explicit_value();
}
+ else if ((out_param= item->get_load_data_out_param_or_error()))
+ out_param->load_data_set_value((const char *) tag->value.ptr(),
+ tag->value.length(), cs);
else
- ((Item_user_var_as_out_param *) item)->set_value(
- (char *) tag->value.ptr(),
- tag->value.length(), cs);
+ DBUG_RETURN(1);
+
}
if (read_info.error)
@@ -1357,6 +1341,7 @@ read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
for ( ; item; item= it++)
{
+ Load_data_out_param *out_param;
if (item->type() == Item::FIELD_ITEM)
{
/*
@@ -1371,8 +1356,10 @@ read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
ER_THD(thd, ER_WARN_TOO_FEW_RECORDS),
thd->get_stmt_da()->current_row_for_warning());
}
+ else if ((out_param= item->get_load_data_out_param_or_error()))
+ out_param->load_data_set_null_value(cs);
else
- ((Item_user_var_as_out_param *)item)->set_null_value(cs);
+ DBUG_RETURN(1);
}
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b3c427bf043..280849b8b33 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -868,7 +868,8 @@ JOIN::prepare(TABLE_LIST *tables_init,
select_lex->check_unrestricted_recursive(
thd->variables.only_standard_compliant_cte))
DBUG_RETURN(-1);
- select_lex->check_subqueries_with_recursive_references();
+ if (select_lex->first_execution)
+ select_lex->check_subqueries_with_recursive_references();
int res= check_and_do_in_subquery_rewrites(this);
@@ -1091,7 +1092,7 @@ int JOIN::optimize()
!skip_sort_order && !no_order && (order || group_list),
select_distinct);
uint select_nr= select_lex->select_number;
- JOIN_TAB *curr_tab= join_tab + top_join_tab_count;
+ JOIN_TAB *curr_tab= join_tab + exec_join_tab_cnt();
for (uint i= 0; i < aggr_tables; i++, curr_tab++)
{
if (select_nr == INT_MAX)
@@ -1445,7 +1446,8 @@ JOIN::optimize_inner()
}
DBUG_PRINT("info",("Select tables optimized away"));
- zero_result_cause= "Select tables optimized away";
+ if (!select_lex->have_window_funcs())
+ zero_result_cause= "Select tables optimized away";
tables_list= 0; // All tables resolved
const_tables= top_join_tab_count= table_count;
/*
@@ -2238,13 +2240,14 @@ bool JOIN::make_aggr_tables_info()
bool implicit_grouping_with_window_funcs= implicit_grouping &&
select_lex->have_window_funcs();
-
+ bool implicit_grouping_without_tables= implicit_grouping &&
+ !tables_list;
/*
Setup last table to provide fields and all_fields lists to the next
node in the plan.
*/
- if (join_tab && top_join_tab_count)
+ if (join_tab && top_join_tab_count && tables_list)
{
join_tab[top_join_tab_count - 1].fields= &fields_list;
join_tab[top_join_tab_count - 1].all_fields= &all_fields;
@@ -2290,7 +2293,7 @@ bool JOIN::make_aggr_tables_info()
order= query.order_by;
aggr_tables++;
- curr_tab= join_tab + top_join_tab_count;
+ curr_tab= join_tab + exec_join_tab_cnt();
bzero(curr_tab, sizeof(JOIN_TAB));
curr_tab->ref.key= -1;
curr_tab->join= this;
@@ -2368,7 +2371,7 @@ bool JOIN::make_aggr_tables_info()
single table queries, thus it is sufficient to test only the first
join_tab element of the plan for its access method.
*/
- if (join_tab && top_join_tab_count &&
+ if (join_tab && top_join_tab_count && tables_list &&
join_tab->is_using_loose_index_scan())
tmp_table_param.precomputed_group_by=
!join_tab->is_using_agg_loose_index_scan();
@@ -2378,7 +2381,7 @@ bool JOIN::make_aggr_tables_info()
if (need_tmp)
{
aggr_tables++;
- curr_tab= join_tab + top_join_tab_count;
+ curr_tab= join_tab + exec_join_tab_cnt();
bzero(curr_tab, sizeof(JOIN_TAB));
curr_tab->ref.key= -1;
if (only_const_tables())
@@ -2437,8 +2440,9 @@ bool JOIN::make_aggr_tables_info()
/* Change sum_fields reference to calculated fields in tmp_table */
items1= ref_ptr_array_slice(2);
- if (sort_and_group || curr_tab->table->group ||
- tmp_table_param.precomputed_group_by)
+ if ((sort_and_group || curr_tab->table->group ||
+ tmp_table_param.precomputed_group_by) &&
+ !implicit_grouping_without_tables)
{
if (change_to_use_tmp_fields(thd, items1,
tmp_fields_list1, tmp_all_fields1,
@@ -2778,7 +2782,7 @@ bool JOIN::make_aggr_tables_info()
- duplicate value removal
Both of these operations are done after window function computation step.
*/
- curr_tab= join_tab + top_join_tab_count + aggr_tables - 1;
+ curr_tab= join_tab + exec_join_tab_cnt() + aggr_tables - 1;
if (select_lex->window_funcs.elements)
{
curr_tab->window_funcs_step= new Window_funcs_computation;
@@ -2793,7 +2797,7 @@ bool JOIN::make_aggr_tables_info()
// Reset before execution
set_items_ref_array(items0);
if (join_tab)
- join_tab[top_join_tab_count + aggr_tables - 1].next_select=
+ join_tab[exec_join_tab_cnt() + aggr_tables - 1].next_select=
setup_end_select_func(this, NULL);
group= has_group_by;
@@ -2834,7 +2838,7 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields,
tmp_table_param.using_outer_summary_function=
tab->tmp_table_param->using_outer_summary_function;
tab->join= this;
- DBUG_ASSERT(tab > join_tab || select_lex->have_window_funcs());
+ DBUG_ASSERT(tab > tab->join->join_tab || !top_join_tab_count || !tables_list);
if (tab > join_tab)
(tab - 1)->next_select= sub_select_postjoin_aggr;
tab->aggr= new (thd->mem_root) AGGR_OP(tab);
@@ -2861,7 +2865,8 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields,
if (make_sum_func_list(all_fields, fields_list, true))
goto err;
if (prepare_sum_aggregators(sum_funcs,
- !join_tab->is_using_agg_loose_index_scan()))
+ !(tables_list &&
+ join_tab->is_using_agg_loose_index_scan())))
goto err;
if (setup_sum_funcs(thd, sum_funcs))
goto err;
@@ -3122,7 +3127,7 @@ JOIN::reinit()
if (aggr_tables)
{
- JOIN_TAB *curr_tab= join_tab + top_join_tab_count;
+ JOIN_TAB *curr_tab= join_tab + exec_join_tab_cnt();
JOIN_TAB *end_tab= curr_tab + aggr_tables;
for ( ; curr_tab < end_tab; curr_tab++)
{
@@ -3249,7 +3254,7 @@ void JOIN::save_explain_data(Explain_query *output, bool can_overwrite,
Explain_union *eu= output->get_union(nr);
explain= &eu->fake_select_lex_explain;
join_tab[0].tracker= eu->get_fake_select_lex_tracker();
- for (uint i=0 ; i < top_join_tab_count + aggr_tables; i++)
+ for (uint i=0 ; i < exec_join_tab_cnt() + aggr_tables; i++)
{
if (join_tab[i].filesort)
{
@@ -3318,7 +3323,8 @@ void JOIN::exec_inner()
if (result->prepare2())
DBUG_VOID_RETURN;
- if (!tables_list && (table_count || !select_lex->with_sum_func))
+ if (!tables_list && (table_count || !select_lex->with_sum_func) &&
+ !select_lex->have_window_funcs())
{ // Only test of functions
if (select_options & SELECT_DESCRIBE)
select_describe(this, FALSE, FALSE, FALSE,
@@ -12010,7 +12016,7 @@ void JOIN::cleanup(bool full)
w/o tables: they don't have some members initialized and
WALK_OPTIMIZATION_TABS may not work correctly for them.
*/
- if (table_count)
+ if (top_join_tab_count && tables_list)
{
for (tab= first_breadth_first_tab(); tab;
tab= next_breadth_first_tab(first_breadth_first_tab(),
@@ -12024,7 +12030,7 @@ void JOIN::cleanup(bool full)
cleaned= true;
//psergey2: added (Q: why not in the above loop?)
{
- JOIN_TAB *curr_tab= join_tab + top_join_tab_count;
+ JOIN_TAB *curr_tab= join_tab + exec_join_tab_cnt();
for (uint i= 0; i < aggr_tables; i++, curr_tab++)
{
if (curr_tab->aggr)
@@ -17785,7 +17791,7 @@ void set_postjoin_aggr_write_func(JOIN_TAB *tab)
}
}
else if (join->sort_and_group && !tmp_tbl->precomputed_group_by &&
- !join->sort_and_group_aggr_tab)
+ !join->sort_and_group_aggr_tab && join->tables_list)
{
DBUG_PRINT("info",("Using end_write_group"));
aggr->set_write_func(end_write_group);
@@ -17877,7 +17883,8 @@ do_select(JOIN *join, Procedure *procedure)
if (join->pushdown_query->store_data_in_temp_table)
{
- JOIN_TAB *last_tab= join->join_tab + join->table_count;
+ JOIN_TAB *last_tab= join->join_tab + join->table_count -
+ join->exec_join_tab_cnt();
last_tab->next_select= end_send;
enum_nested_loop_state state= last_tab->aggr->end_send();
@@ -17948,7 +17955,8 @@ do_select(JOIN *join, Procedure *procedure)
dbug_serve_apcs(join->thd, 1);
);
- JOIN_TAB *join_tab= join->join_tab + join->const_tables;
+ JOIN_TAB *join_tab= join->join_tab +
+ (join->tables_list ? join->const_tables : 0);
if (join->outer_ref_cond && !join->outer_ref_cond->val_int())
error= NESTED_LOOP_NO_MORE_ROWS;
else
@@ -23188,8 +23196,11 @@ change_refs_to_tmp_fields(THD *thd, Ref_ptr_array ref_pointer_array,
uint i, border= all_fields.elements - elements;
for (i= 0; (item= it++); i++)
{
- res_all_fields.push_back(new_item= item->get_tmp_table_item(thd),
- thd->mem_root);
+ if (item->type() == Item::SUM_FUNC_ITEM && item->const_item())
+ new_item= item;
+ else
+ new_item= item->get_tmp_table_item(thd);
+ res_all_fields.push_back(new_item, thd->mem_root);
ref_pointer_array[((i < border)? all_fields.elements-i-1 : i-border)]=
new_item;
}
@@ -24444,7 +24455,7 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta,
void save_agg_explain_data(JOIN *join, Explain_select *xpl_sel)
{
- JOIN_TAB *join_tab=join->join_tab + join->top_join_tab_count;
+ JOIN_TAB *join_tab=join->join_tab + join->exec_join_tab_cnt();
Explain_aggr_node *prev_node;
Explain_aggr_node *node= xpl_sel->aggr_tree;
bool is_analyze= join->thd->lex->analyze_stmt;
@@ -24536,6 +24547,7 @@ int JOIN::save_explain_data_intern(Explain_query *output,
if (select_lex->master_unit()->derived)
explain->connection_type= Explain_node::EXPLAIN_NODE_DERIVED;
+ save_agg_explain_data(this, explain);
output->add_node(explain);
}
else if (pushdown_query)
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 86b8a56fb43..96764fd7f00 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -1492,6 +1492,8 @@ public:
/* True if the plan guarantees that it will be returned zero or one row */
bool only_const_tables() { return const_tables == table_count; }
+ /* Number of tables actually joined at the top level */
+ uint exec_join_tab_cnt() { return tables_list ? top_join_tab_count : 0; }
int prepare(TABLE_LIST *tables, uint wind_num,
COND *conds, uint og_num, ORDER *order, bool skip_order_by,
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index ff455e680f7..bf25c0be74e 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -302,7 +302,8 @@ int select_union_recursive::send_data(List<Item> &values)
{
int rc= select_unit::send_data(values);
- if (write_err != HA_ERR_FOUND_DUPP_KEY)
+ if (write_err != HA_ERR_FOUND_DUPP_KEY &&
+ write_err != HA_ERR_FOUND_DUPP_UNIQUE)
{
int err;
if ((err= incr_table->file->ha_write_tmp_row(table->record[0])))
@@ -1205,7 +1206,8 @@ bool st_select_lex_unit::exec()
if (executed && !uncacheable && !describe)
DBUG_RETURN(FALSE);
executed= 1;
- if (!(uncacheable & ~UNCACHEABLE_EXPLAIN) && item)
+ if (!(uncacheable & ~UNCACHEABLE_EXPLAIN) && item &&
+ !item->with_recursive_reference)
item->make_const();
saved_error= optimize();
@@ -1537,9 +1539,15 @@ bool st_select_lex_unit::exec_recursive()
!is_unrestricted);
if (!with_element->rec_result->first_rec_table_to_update)
with_element->rec_result->first_rec_table_to_update= rec_table;
- if (with_element->level == 1)
+ if (with_element->level == 1 && rec_table->reginfo.join_tab)
rec_table->reginfo.join_tab->preread_init_done= true;
}
+ for (Item_subselect *sq= with_element->sq_with_rec_ref.first;
+ sq;
+ sq= sq->next_with_rec_ref)
+ {
+ sq->engine->force_reexecution();
+ }
thd->lex->current_select= lex_select_save;
err:
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index ac70d3d0f32..74e1ad25183 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -2761,7 +2761,7 @@ bool Window_func_runner::exec(THD *thd, TABLE *tbl, SORT_INFO *filesort_result)
bool Window_funcs_sort::exec(JOIN *join)
{
THD *thd= join->thd;
- JOIN_TAB *join_tab= &join->join_tab[join->top_join_tab_count];
+ JOIN_TAB *join_tab= join->join_tab + join->exec_join_tab_cnt();
/* Sort the table based on the most specific sorting criteria of
the window functions. */
@@ -2841,11 +2841,6 @@ bool Window_funcs_sort::setup(THD *thd, SQL_SELECT *sel,
sort_order= order;
}
filesort= new (thd->mem_root) Filesort(sort_order, HA_POS_ERROR, true, NULL);
- if (!join_tab->join->top_join_tab_count)
- {
- filesort->tracker=
- new (thd->mem_root) Filesort_tracker(thd->lex->analyze_stmt);
- }
/* Apply the same condition that the subsequent sort has. */
filesort->select= sel;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index b4583b1c187..e5fe26c6b94 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -456,11 +456,22 @@ static bool binlog_format_check(sys_var *self, THD *thd, set_var *var)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"MariaDB Galera and flashback do not support binlog format: %s",
binlog_format_names[var->save_result.ulonglong_value]);
+ /*
+ We allow setting up binlog_format other then ROW for session scope when
+ wsrep/flasback is enabled.This is done because of 2 reasons
+ 1. User might want to run pt-table-checksum.
+ 2. SuperUser knows what is doing :-)
+ For refrence:- MDEV-7322
+ */
if (var->type == OPT_GLOBAL)
{
- WSREP_ERROR("MariaDB Galera and flashback do not support binlog format: %s",
- binlog_format_names[var->save_result.ulonglong_value]);
+ if (WSREP(thd))
+ WSREP_ERROR("MariaDB Galera does not support binlog format: %s",
+ binlog_format_names[var->save_result.ulonglong_value]);
+ else
+ my_error(ER_FLASHBACK_NOT_SUPPORTED,MYF(0),"binlog_format",
+ binlog_format_names[var->save_result.ulonglong_value]);
return true;
}
}
diff --git a/sql/table.cc b/sql/table.cc
index eac12578b15..fa8ed3c2587 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1980,6 +1980,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
unireg_check == Field::TIMESTAMP_DN_FIELD)
{
reg_field->default_value= new (&share->mem_root) Virtual_column_info();
+ reg_field->default_value->set_vcol_type(VCOL_DEFAULT);
reg_field->default_value->stored_in_db= 1;
share->default_expressions++;
}
@@ -2378,6 +2379,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if (!(vcol_info= new (&share->mem_root) Virtual_column_info()))
goto err;
+
/* The following can only be true for check_constraints */
if (field_nr != UINT_MAX16)
@@ -2387,6 +2389,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
}
vcol_screen_pos+= FRM_VCOL_NEW_HEADER_SIZE;
+ vcol_info->set_vcol_type((enum_vcol_info_type) type);
if (name_length)
{
vcol_info->name.str= strmake_root(&share->mem_root,
@@ -2739,7 +2742,7 @@ bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol)
if (!(vcol->flags & (VCOL_TIME_FUNC|VCOL_SESSION_FUNC)))
DBUG_RETURN(0);
- vcol->expr->cleanup();
+ vcol->expr->walk(&Item::cleanup_excluding_fields_processor, 0, 0);
DBUG_ASSERT(!vcol->expr->fixed);
DBUG_RETURN(fix_vcol_expr(thd, vcol));
}
@@ -2823,9 +2826,24 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table,
int error= func_expr->walk(&Item::check_vcol_func_processor, 0, &res);
if (error || (res.errors & VCOL_IMPOSSIBLE))
- { // this can only happen if the frm was corrupted
+ {
+ // this can only happen if the frm was corrupted
my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), res.name,
- "???", "?????");
+ vcol->get_vcol_type_name(), vcol->name.str);
+ DBUG_RETURN(1);
+ }
+ else if (res.errors & VCOL_AUTO_INC)
+ {
+ /*
+ An auto_increment field may not be used in an expression for
+ a check constraint, a default value or a generated column
+
+ Note that this error condition is not detected during parsing
+ of the statement because the field item does not have a field
+ pointer at that time
+ */
+ my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0),
+ "AUTO_INCREMENT", vcol->get_vcol_type_name(), res.name);
DBUG_RETURN(1);
}
vcol->flags= res.errors;
@@ -2896,6 +2914,7 @@ unpack_vcol_info_from_frm(THD *thd, MEM_ROOT *mem_root, TABLE *table,
if (error)
goto end;
+ vcol_storage.vcol_info->set_vcol_type(vcol->get_vcol_type());
vcol_storage.vcol_info->stored_in_db= vcol->stored_in_db;
vcol_storage.vcol_info->name= vcol->name;
vcol_storage.vcol_info->utf8= vcol->utf8;
diff --git a/sql/table.h b/sql/table.h
index ebe5ced5bc1..a3690b0e8ca 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -2157,6 +2157,8 @@ struct TABLE_LIST
/* I_S: Flags to open_table (e.g. OPEN_TABLE_ONLY or OPEN_VIEW_ONLY) */
uint i_s_requested_object;
+ bool prohibit_cond_pushdown;
+
/*
I_S: how to read the tables (SKIP_OPEN_TABLE/OPEN_FRM_ONLY/OPEN_FULL_TABLE)
*/
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index 0ccd533eac1..1121bb65fe3 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -323,7 +323,7 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
DBUG_ENTER("wsrep_run_wsrep_commit");
if (thd->get_stmt_da()->is_error()) {
- WSREP_ERROR("commit issue, error: %d %s",
+ WSREP_DEBUG("commit issue, error: %d %s",
thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message());
}
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index c553b4ba27e..7eae366df7a 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -51,6 +51,7 @@ struct wsrep_thd_shadow {
char *db;
size_t db_length;
my_hrtime_t user_time;
+ longlong row_count_func;
};
// Global wsrep parameters
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index a2d3b4923ab..4acf8a3bf1e 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -167,6 +167,7 @@ static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
shadow->db = thd->db;
shadow->db_length = thd->db_length;
shadow->user_time = thd->user_time;
+ shadow->row_count_func= thd->get_row_count_func();
thd->reset_db(NULL, 0);
}
@@ -187,6 +188,7 @@ static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
thd->wsrep_rgi->cleanup_after_session();
delete thd->wsrep_rgi;
thd->wsrep_rgi = NULL;
+ thd->set_row_count_func(shadow->row_count_func);
}
void wsrep_replay_transaction(THD *thd)
@@ -201,12 +203,31 @@ void wsrep_replay_transaction(THD *thd)
WSREP_ERROR("replay issue, thd has reported status already");
}
+
/*
PS reprepare observer should have been removed already.
open_table() will fail if we have dangling observer here.
*/
DBUG_ASSERT(thd->m_reprepare_observer == NULL);
+ struct da_shadow
+ {
+ enum Diagnostics_area::enum_diagnostics_status status;
+ ulonglong affected_rows;
+ ulonglong last_insert_id;
+ char message[MYSQL_ERRMSG_SIZE];
+ };
+ struct da_shadow da_status;
+ da_status.status= thd->get_stmt_da()->status();
+ if (da_status.status == Diagnostics_area::DA_OK)
+ {
+ da_status.affected_rows= thd->get_stmt_da()->affected_rows();
+ da_status.last_insert_id= thd->get_stmt_da()->last_insert_id();
+ strmake(da_status.message,
+ thd->get_stmt_da()->message(),
+ sizeof(da_status.message)-1);
+ }
+
thd->get_stmt_da()->reset_diagnostics_area();
thd->wsrep_conflict_state= REPLAYING;
@@ -274,7 +295,17 @@ void wsrep_replay_transaction(THD *thd)
}
else
{
- my_ok(thd);
+ if (da_status.status == Diagnostics_area::DA_OK)
+ {
+ my_ok(thd,
+ da_status.affected_rows,
+ da_status.last_insert_id,
+ da_status.message);
+ }
+ else
+ {
+ my_ok(thd);
+ }
}
break;
case WSREP_TRX_FAIL:
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index e1446b409d1..489b612a17a 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -1602,7 +1602,8 @@ btr_page_reorganize_low(
/* Copy the PAGE_MAX_TRX_ID or PAGE_ROOT_AUTO_INC. */
memcpy(page + (PAGE_HEADER + PAGE_MAX_TRX_ID),
temp_page + (PAGE_HEADER + PAGE_MAX_TRX_ID), 8);
- /* PAGE_MAX_TRX_ID is unused in clustered index pages,
+ /* PAGE_MAX_TRX_ID is unused in clustered index pages
+ (other than the root where it is repurposed as PAGE_ROOT_AUTO_INC),
non-leaf pages, and in temporary tables. It was always
zero-initialized in page_create() in all InnoDB versions.
PAGE_MAX_TRX_ID must be nonzero on dict_index_is_sec_or_ibuf()
@@ -1983,6 +1984,36 @@ btr_root_raise_and_insert(
index);
}
+ if (dict_index_is_sec_or_ibuf(index)) {
+ /* In secondary indexes and the change buffer,
+ PAGE_MAX_TRX_ID can be reset on the root page, because
+ the field only matters on leaf pages, and the root no
+ longer is a leaf page. (Older versions of InnoDB did
+ set PAGE_MAX_TRX_ID on all secondary index pages.) */
+ if (root_page_zip) {
+ page_zip_write_header(
+ root_page_zip,
+ PAGE_HEADER + PAGE_MAX_TRX_ID
+ + root, 0, mtr);
+ } else {
+ mlog_write_ull(PAGE_HEADER + PAGE_MAX_TRX_ID
+ + root, 0, mtr);
+ }
+ } else {
+ /* PAGE_ROOT_AUTO_INC is only present in the clustered index
+ root page; on other clustered index pages, we want to reserve
+ the field PAGE_MAX_TRX_ID for future use. */
+ if (new_page_zip) {
+ page_zip_write_header(
+ new_page_zip,
+ PAGE_HEADER + PAGE_MAX_TRX_ID
+ + new_page, 0, mtr);
+ } else {
+ mlog_write_ull(PAGE_HEADER + PAGE_MAX_TRX_ID
+ + new_page, 0, mtr);
+ }
+ }
+
/* If this is a pessimistic insert which is actually done to
perform a pessimistic update then we have stored the lock
information of the record to be inserted on the infimum of the
@@ -2943,7 +2974,7 @@ func_start:
btr_page_create(new_block, new_page_zip, cursor->index,
btr_page_get_level(page, mtr), mtr);
/* Only record the leaf level page splits. */
- if (btr_page_get_level(page, mtr) == 0) {
+ if (page_is_leaf(page)) {
cursor->index->stat_defrag_n_page_split ++;
cursor->index->stat_defrag_modified_counter ++;
btr_defragment_save_defrag_stats_if_needed(cursor->index);
@@ -5132,9 +5163,9 @@ loop:
rec = btr_cur_get_rec(&node_cur);
fprintf(stderr, "\n"
- "InnoDB: node ptr child page n:o %lu\n",
- (ulong) btr_node_ptr_get_child_page_no(
- rec, offsets));
+ "InnoDB: node ptr child page n:o "
+ ULINTPF "\n",
+ btr_node_ptr_get_child_page_no(rec, offsets));
fputs("InnoDB: record on page ", stderr);
rec_print_new(stderr, rec, offsets);
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index c15784a97a4..773b03775be 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -2175,7 +2175,7 @@ btr_cur_open_at_index_side_func(
page = buf_block_get_frame(block);
if (height == ULINT_UNDEFINED
- && btr_page_get_level(page, mtr) == 0
+ && page_is_leaf(page)
&& rw_latch != RW_NO_LATCH
&& rw_latch != root_leaf_rw_latch) {
/* We should retry to get the page, because the root page
@@ -2532,7 +2532,7 @@ btr_cur_open_at_rnd_pos_func(
page = buf_block_get_frame(block);
if (height == ULINT_UNDEFINED
- && btr_page_get_level(page, mtr) == 0
+ && page_is_leaf(page)
&& rw_latch != RW_NO_LATCH
&& rw_latch != root_leaf_rw_latch) {
/* We should retry to get the page, because the root page
@@ -3683,6 +3683,8 @@ btr_cur_update_in_place(
btr_search_x_lock(index);
}
+
+ assert_block_ahi_valid(block);
#endif /* BTR_CUR_HASH_ADAPT */
row_upd_rec_in_place(rec, index, offsets, update, page_zip);
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index 8c4f27cc78a..06cd1315590 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -233,7 +233,9 @@ btr_defragment_add_index(
return NULL;
}
- if (btr_page_get_level(page, &mtr) == 0) {
+ ut_ad(page_is_root(page));
+
+ if (page_is_leaf(page)) {
// Index root is a leaf page, no need to defragment.
mtr_commit(&mtr);
return NULL;
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc
index 0d59481c4b5..307d6d0ec6c 100644
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@ -1,4 +1,5 @@
// Copyright (c) 2014, Google Inc.
+// Copyright (c) 2017, MariaDB Corporation.
/**************************************************//**
@file btr/btr0scrub.cc
@@ -102,16 +103,9 @@ log_scrub_failure(
scrub_data->scrub_stat.page_split_failures_unknown++;
}
- buf_frame_t* buf = buf_block_get_frame(block);
- const ulint space_id = mach_read_from_4(buf + FIL_PAGE_SPACE_ID);
- const ulint page_no = mach_read_from_4(buf + FIL_PAGE_OFFSET);
- fprintf(stderr,
- "InnoDB: Warning: Failed to scrub index %s table %s page %lu in space %lu : %s\n",
- index->name(),
- index->table->name.m_name,
- page_no,
- space_id,
- reason);
+ ib::warn() << "Failed to scrub index " << index->name
+ << " of table " << index->table->name
+ << " page " << block->page.id << ": " << reason;
}
/****************************************************************
@@ -152,11 +146,10 @@ btr_scrub_lock_dict_func(ulint space_id, bool lock_to_close_table,
if (now >= last + 30) {
fprintf(stderr,
- "WARNING: %s:%u waited %lu seconds for"
+ "WARNING: %s:%u waited %ld seconds for"
" dict_sys lock, space: " ULINTPF
- " lock_to_close_table: %u\n",
- file, line, (unsigned long)(now - start),
- space_id,
+ " lock_to_close_table: %d\n",
+ file, line, long(now - start), space_id,
lock_to_close_table);
last = now;
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index f7a430591ac..3ae9e95819a 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -611,6 +611,7 @@ btr_search_update_hash_ref(
|| rw_lock_own(&(block->lock), RW_LOCK_X));
ut_ad(page_align(btr_cur_get_rec(cursor))
== buf_block_get_frame(block));
+ assert_block_ahi_valid(block);
index = block->index;
@@ -1122,14 +1123,13 @@ btr_search_drop_page_hash_index(buf_block_t* block)
rw_lock_t* latch;
btr_search_t* info;
- if (!btr_search_enabled) {
- return;
- }
-
retry:
/* Do a dirty check on block->index, return if the block is
not in the adaptive hash index. */
index = block->index;
+ /* This debug check uses a dirty read that could theoretically cause
+ false positives while buf_pool_clear_hash_index() is executing. */
+ assert_block_ahi_valid(block);
if (index == NULL) {
return;
@@ -1156,6 +1156,7 @@ retry:
ut_ad(!btr_search_own_any(RW_LOCK_X));
rw_lock_s_lock(latch);
+ assert_block_ahi_valid(block);
if (block->index == NULL) {
rw_lock_s_unlock(latch);
@@ -1172,6 +1173,7 @@ retry:
#ifdef MYSQL_INDEX_DISABLE_AHI
ut_ad(!index->disable_ahi);
#endif
+ ut_ad(btr_search_enabled);
ut_ad(block->page.id.space() == index->space);
ut_a(index_id == index->id);
@@ -1290,23 +1292,8 @@ next_rec:
MONITOR_INC_VALUE(MONITOR_ADAPTIVE_HASH_ROW_REMOVED, n_cached);
cleanup:
-#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- if (UNIV_UNLIKELY(block->n_pointers)) {
- /* Corruption */
- ib::error() << "Corruption of adaptive hash index."
- << " After dropping, the hash index to a page of "
- << index->name
- << ", still " << block->n_pointers
- << " hash nodes remain.";
- rw_lock_x_unlock(latch);
-
- ut_ad(btr_search_validate());
- } else {
- rw_lock_x_unlock(latch);
- }
-#else /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+ assert_block_ahi_valid(block);
rw_lock_x_unlock(latch);
-#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
ut_free(folds);
}
@@ -1533,6 +1520,7 @@ btr_search_build_page_hash_index(
have to take care not to increment the counter in that
case. */
if (!block->index) {
+ assert_block_ahi_empty(block);
index->search_info->ref_count++;
}
@@ -1551,6 +1539,7 @@ btr_search_build_page_hash_index(
MONITOR_INC(MONITOR_ADAPTIVE_HASH_PAGE_ADDED);
MONITOR_INC_VALUE(MONITOR_ADAPTIVE_HASH_ROW_ADDED, n_cached);
exit_func:
+ assert_block_ahi_valid(block);
btr_search_x_unlock(index);
ut_free(folds);
@@ -1590,6 +1579,8 @@ btr_search_move_or_delete_hash_entries(
ut_a(!block->index || block->index == index);
ut_a(!(new_block->index || block->index)
|| !dict_index_is_ibuf(index));
+ assert_block_ahi_valid(block);
+ assert_block_ahi_valid(new_block);
if (new_block->index) {
@@ -1650,6 +1641,7 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor)
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_X));
+ assert_block_ahi_valid(block);
index = block->index;
if (!index) {
@@ -1674,6 +1666,7 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor)
}
btr_search_x_lock(index);
+ assert_block_ahi_valid(block);
if (block->index) {
ut_a(block->index == index);
@@ -1684,6 +1677,8 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor)
MONITOR_INC(
MONITOR_ADAPTIVE_HASH_ROW_REMOVE_NOT_FOUND);
}
+
+ assert_block_ahi_valid(block);
}
btr_search_x_unlock(index);
@@ -1747,6 +1742,7 @@ btr_search_update_hash_node_on_insert(btr_cur_t* cursor)
}
func_exit:
+ assert_block_ahi_valid(block);
btr_search_x_unlock(index);
} else {
btr_search_x_unlock(index);
@@ -1791,6 +1787,7 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
block = btr_cur_get_block(cursor);
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_X));
+ assert_block_ahi_valid(block);
index = block->index;
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index a6ed277a90e..754b2cd1c25 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -347,7 +347,7 @@ typedef std::map<
const byte*,
buf_chunk_t*,
std::less<const byte*>,
- ut_allocator<std::pair<const byte*, buf_chunk_t*> > >
+ ut_allocator<std::pair<const byte* const, buf_chunk_t*> > >
buf_pool_chunk_map_t;
static buf_pool_chunk_map_t* buf_chunk_map_reg;
@@ -405,10 +405,22 @@ buf_pool_register_chunk(
/** Decrypt a page.
@param[in,out] bpage Page control block
+@param[in,out] space tablespace
@return whether the operation was successful */
static
bool
-buf_page_decrypt_after_read(buf_page_t* bpage);
+buf_page_decrypt_after_read(buf_page_t* bpage, fil_space_t* space)
+ MY_ATTRIBUTE((nonnull));
+
+/** Check if page is maybe compressed, encrypted or both when we encounter
+corrupted page. Note that we can't be 100% sure if page is corrupted
+or decrypt/decompress just failed.
+@param[in,out] bpage Page
+@return true if page corrupted, false if not */
+static
+bool
+buf_page_check_corrupt(buf_page_t* bpage)
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx();
@@ -600,10 +612,6 @@ buf_page_is_zeroes(
@param[in] read_buf database page
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
-@param[in] page_no page number of given read_buf
-@param[in] is_log_enabled true if log option is enabled
-@param[in] log_file file pointer to log_file
-@param[in] curr_algo current checksum algorithm
@param[in] use_legacy_big_endian use legacy big endian algorithm
@return true if the page is in crc32 checksum format. */
bool
@@ -611,24 +619,18 @@ buf_page_is_checksum_valid_crc32(
const byte* read_buf,
ulint checksum_field1,
ulint checksum_field2,
-#ifdef UNIV_INNOCHECKSUM
- uintmax_t page_no,
- bool is_log_enabled,
- FILE* log_file,
- const srv_checksum_algorithm_t curr_algo,
-#endif /* UNIV_INNOCHECKSUM */
bool use_legacy_big_endian)
{
const uint32_t crc32 = buf_calc_page_crc32(read_buf,
use_legacy_big_endian);
#ifdef UNIV_INNOCHECKSUM
- if (is_log_enabled
- && curr_algo == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
+ if (log_file
+ && srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
fprintf(log_file, "page::%lu;"
" crc32 calculated = %u;"
" recorded checksum field1 = %lu recorded"
- " checksum field2 =%lu\n", page_no,
+ " checksum field2 =%lu\n", cur_page_num,
crc32, checksum_field1, checksum_field2);
}
#endif /* UNIV_INNOCHECKSUM */
@@ -659,23 +661,12 @@ invalid:
@param[in] read_buf database page
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
-@param[in] page_no page number of given read_buf
-@param[in] is_log_enabled true if log option is enabled
-@param[in] log_file file pointer to log_file
-@param[in] curr_algo current checksum algorithm
@return true if the page is in innodb checksum format. */
bool
buf_page_is_checksum_valid_innodb(
const byte* read_buf,
ulint checksum_field1,
- ulint checksum_field2
-#ifdef UNIV_INNOCHECKSUM
- ,uintmax_t page_no,
- bool is_log_enabled,
- FILE* log_file,
- const srv_checksum_algorithm_t curr_algo
-#endif /* UNIV_INNOCHECKSUM */
- )
+ ulint checksum_field2)
{
/* There are 2 valid formulas for
checksum_field2 (old checksum field) which algo=innodb could have
@@ -691,31 +682,31 @@ buf_page_is_checksum_valid_innodb(
ulint new_checksum = buf_calc_page_new_checksum(read_buf);
#ifdef UNIV_INNOCHECKSUM
- if (is_log_enabled
- && curr_algo == SRV_CHECKSUM_ALGORITHM_INNODB) {
+ if (log_file
+ && srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_INNODB) {
fprintf(log_file, "page::%lu;"
" old style: calculated ="
" %lu; recorded = %lu\n",
- page_no, old_checksum,
+ cur_page_num, old_checksum,
checksum_field2);
fprintf(log_file, "page::%lu;"
" new style: calculated ="
" %lu; crc32 = %u; recorded = %lu\n",
- page_no, new_checksum,
+ cur_page_num, new_checksum,
buf_calc_page_crc32(read_buf), checksum_field1);
}
- if (is_log_enabled
- && curr_algo == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
+ if (log_file
+ && srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
fprintf(log_file, "page::%lu;"
" old style: calculated ="
" %lu; recorded checksum = %lu\n",
- page_no, old_checksum,
+ cur_page_num, old_checksum,
checksum_field2);
fprintf(log_file, "page::%lu;"
" new style: calculated ="
" %lu; recorded checksum = %lu\n",
- page_no, new_checksum,
+ cur_page_num, new_checksum,
checksum_field1);
}
#endif /* UNIV_INNOCHECKSUM */
@@ -755,23 +746,12 @@ buf_page_is_checksum_valid_innodb(
@param[in] read_buf database page
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
-@param[in] page_no page number of given read_buf
-@param[in] is_log_enabled true if log option is enabled
-@param[in] log_file file pointer to log_file
-@param[in] curr_algo current checksum algorithm
@return true if the page is in none checksum format. */
bool
buf_page_is_checksum_valid_none(
const byte* read_buf,
ulint checksum_field1,
- ulint checksum_field2
-#ifdef UNIV_INNOCHECKSUM
- ,uintmax_t page_no,
- bool is_log_enabled,
- FILE* log_file,
- const srv_checksum_algorithm_t curr_algo
-#endif /* UNIV_INNOCHECKSUM */
- )
+ ulint checksum_field2)
{
#ifndef DBUG_OFF
if (checksum_field1 != checksum_field2
@@ -787,13 +767,13 @@ buf_page_is_checksum_valid_none(
#endif /* DBUG_OFF */
#ifdef UNIV_INNOCHECKSUM
- if (is_log_enabled
- && curr_algo == SRV_CHECKSUM_ALGORITHM_STRICT_NONE) {
+ if (log_file
+ && srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_NONE) {
fprintf(log_file,
"page::%lu; none checksum: calculated"
" = %lu; recorded checksum_field1 = %lu"
" recorded checksum_field2 = %lu\n",
- page_no, BUF_NO_CHECKSUM_MAGIC,
+ cur_page_num, BUF_NO_CHECKSUM_MAGIC,
checksum_field1, checksum_field2);
}
#endif /* UNIV_INNOCHECKSUM */
@@ -808,10 +788,6 @@ the LSN
@param[in] read_buf database page
@param[in] page_size page size
@param[in] space tablespace
-@param[in] page_no page number of given read_buf
-@param[in] strict_check true if strict-check option is enabled
-@param[in] is_log_enabled true if log option is enabled
-@param[in] log_file file pointer to log_file
@return TRUE if corrupted */
bool
buf_page_is_corrupted(
@@ -819,12 +795,6 @@ buf_page_is_corrupted(
const byte* read_buf,
const page_size_t& page_size,
const fil_space_t* space
-#ifdef UNIV_INNOCHECKSUM
- ,uintmax_t page_no,
- bool strict_check,
- bool is_log_enabled,
- FILE* log_file
-#endif /* UNIV_INNOCHECKSUM */
)
{
ulint checksum_field1;
@@ -914,15 +884,8 @@ buf_page_is_corrupted(
}
if (page_size.is_compressed()) {
-#ifdef UNIV_INNOCHECKSUM
- return(!page_zip_verify_checksum(read_buf,
- page_size.physical(),
- page_no, strict_check,
- is_log_enabled, log_file));
-#else
return(!page_zip_verify_checksum(read_buf,
page_size.physical()));
-#endif /* UNIV_INNOCHECKSUM */
}
checksum_field1 = mach_read_from_4(
@@ -964,10 +927,10 @@ buf_page_is_corrupted(
}
#ifdef UNIV_INNOCHECKSUM
if (i >= page_size.logical()) {
- if (is_log_enabled) {
+ if (log_file) {
fprintf(log_file, "Page::%lu"
" is empty and uncorrupted\n",
- page_no);
+ cur_page_num);
}
return(false);
}
@@ -993,20 +956,13 @@ buf_page_is_corrupted(
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
if (buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2,
-#ifdef UNIV_INNOCHECKSUM
- page_no, is_log_enabled, log_file, curr_algo,
-#endif /* UNIV_INNOCHECKSUM */
- false)) {
+ checksum_field1, checksum_field2, false)) {
return(false);
}
if (buf_page_is_checksum_valid_none(read_buf,
- checksum_field1, checksum_field2
-#ifdef UNIV_INNOCHECKSUM
- , page_no, is_log_enabled, log_file, curr_algo)) {
-#else /* UNIV_INNOCHECKSUM */
- )) {
+ checksum_field1, checksum_field2)) {
+#ifndef UNIV_INNOCHECKSUM
if (curr_algo
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
page_warn_strict_checksum(
@@ -1014,20 +970,20 @@ buf_page_is_corrupted(
SRV_CHECKSUM_ALGORITHM_NONE,
page_id);
}
-#endif /* UNIV_INNOCHECKSUM */
+#endif /* !UNIV_INNOCHECKSUM */
#ifdef UNIV_INNOCHECKSUM
- if (is_log_enabled) {
+ if (log_file) {
fprintf(log_file, "page::%lu;"
" old style: calculated = " ULINTPF ";"
- " recorded = " ULINTPF "\n", page_no,
+ " recorded = " ULINTPF "\n", cur_page_num,
buf_calc_page_old_checksum(read_buf),
checksum_field2);
fprintf(log_file, "page::%lu;"
" new style: calculated = " ULINTPF ";"
" crc32 = %u; recorded = " ULINTPF "\n",
- page_no,
+ cur_page_num,
buf_calc_page_new_checksum(read_buf),
buf_calc_page_crc32(read_buf),
checksum_field1);
@@ -1043,11 +999,7 @@ buf_page_is_corrupted(
Otherwise we check innodb checksum first. */
if (legacy_big_endian_checksum) {
if (buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2,
-#ifdef UNIV_INNOCHECKSUM
- page_no, is_log_enabled, log_file, curr_algo,
-#endif /* UNIV_INNOCHECKSUM */
- true)) {
+ checksum_field1, checksum_field2, true)) {
return(false);
}
@@ -1055,11 +1007,8 @@ buf_page_is_corrupted(
}
if (buf_page_is_checksum_valid_innodb(read_buf,
- checksum_field1, checksum_field2
-#ifdef UNIV_INNOCHECKSUM
- , page_no, is_log_enabled, log_file, curr_algo)) {
-#else /* UNIV_INNOCHECKSUM */
- )) {
+ checksum_field1, checksum_field2)) {
+#ifndef UNIV_INNOCHECKSUM
if (curr_algo
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
page_warn_strict_checksum(
@@ -1067,27 +1016,23 @@ buf_page_is_corrupted(
SRV_CHECKSUM_ALGORITHM_INNODB,
page_id);
}
-#endif /* UNIV_INNOCHECKSUM */
+#endif /* !UNIV_INNOCHECKSUM */
return(false);
}
/* If legacy checksum is not checked, do it now. */
if (!legacy_checksum_checked && buf_page_is_checksum_valid_crc32(
- read_buf, checksum_field1, checksum_field2,
-#ifdef UNIV_INNOCHECKSUM
- page_no, is_log_enabled, log_file, curr_algo,
-#endif /* UNIV_INNOCHECKSUM */
- true)) {
+ read_buf, checksum_field1, checksum_field2, true)) {
legacy_big_endian_checksum = true;
return(false);
}
#ifdef UNIV_INNOCHECKSUM
- if (is_log_enabled) {
+ if (log_file) {
fprintf(log_file, "Fail; page %lu"
" invalid (fails crc32 checksum)\n",
- page_no);
+ cur_page_num);
}
#endif /* UNIV_INNOCHECKSUM */
return(true);
@@ -1096,20 +1041,13 @@ buf_page_is_corrupted(
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
if (buf_page_is_checksum_valid_innodb(read_buf,
- checksum_field1, checksum_field2
-#ifdef UNIV_INNOCHECKSUM
- , page_no, is_log_enabled, log_file, curr_algo
-#endif /* UNIV_INNOCHECKSUM */
- )) {
+ checksum_field1, checksum_field2)) {
return(false);
}
if (buf_page_is_checksum_valid_none(read_buf,
- checksum_field1, checksum_field2
-#ifdef UNIV_INNOCHECKSUM
- , page_no, is_log_enabled, log_file, curr_algo)) {
-#else /* UNIV_INNOCHECKSUM */
- )) {
+ checksum_field1, checksum_field2)) {
+#ifndef UNIV_INNOCHECKSUM
if (curr_algo
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
page_warn_strict_checksum(
@@ -1117,19 +1055,19 @@ buf_page_is_corrupted(
SRV_CHECKSUM_ALGORITHM_NONE,
page_id);
}
-#endif /* UNIV_INNOCHECKSUM */
+#endif /* !UNIV_INNOCHECKSUM */
#ifdef UNIV_INNOCHECKSUM
- if (is_log_enabled) {
+ if (log_file) {
fprintf(log_file, "page::%lu;"
" old style: calculated = %lu;"
- " recorded = %lu\n", page_no,
+ " recorded = %lu\n", cur_page_num,
buf_calc_page_old_checksum(read_buf),
checksum_field2);
fprintf(log_file, "page::%lu;"
" new style: calculated = %lu;"
" crc32 = %u; recorded = %lu\n",
- page_no,
+ cur_page_num,
buf_calc_page_new_checksum(read_buf),
buf_calc_page_crc32(read_buf),
checksum_field1);
@@ -1138,19 +1076,11 @@ buf_page_is_corrupted(
return(false);
}
-#ifdef UNIV_INNOCHECKSUM
- if (buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2,
- page_no, is_log_enabled, log_file, curr_algo, false)
- || buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2,
- page_no, is_log_enabled, log_file, curr_algo, true)) {
-#else /* UNIV_INNOCHECKSUM */
if (buf_page_is_checksum_valid_crc32(read_buf,
checksum_field1, checksum_field2, false)
|| buf_page_is_checksum_valid_crc32(read_buf,
checksum_field1, checksum_field2, true)) {
-
+#ifndef UNIV_INNOCHECKSUM
if (curr_algo
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
page_warn_strict_checksum(
@@ -1158,16 +1088,16 @@ buf_page_is_corrupted(
SRV_CHECKSUM_ALGORITHM_CRC32,
page_id);
}
-#endif /* UNIV_INNOCHECKSUM */
+#endif /* !UNIV_INNOCHECKSUM */
return(false);
}
#ifdef UNIV_INNOCHECKSUM
- if (is_log_enabled) {
+ if (log_file) {
fprintf(log_file, "Fail; page %lu"
" invalid (fails innodb checksum)\n",
- page_no);
+ cur_page_num);
}
#endif /* UNIV_INNOCHECKSUM */
return(true);
@@ -1175,54 +1105,39 @@ buf_page_is_corrupted(
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
if (buf_page_is_checksum_valid_none(read_buf,
- checksum_field1, checksum_field2
-#ifdef UNIV_INNOCHECKSUM
- , page_no, is_log_enabled, log_file, curr_algo
-#endif /* UNIV_INNOCHECKSUM */
- )) {
+ checksum_field1, checksum_field2)) {
return(false);
}
-#ifdef UNIV_INNOCHECKSUM
- if (buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2,
- page_no, is_log_enabled, log_file, curr_algo, false)
- || buf_page_is_checksum_valid_crc32(read_buf,
- checksum_field1, checksum_field2,
- page_no, is_log_enabled, log_file, curr_algo, true)) {
-#else /* UNIV_INNOCHECKSUM */
if (buf_page_is_checksum_valid_crc32(read_buf,
checksum_field1, checksum_field2, false)
|| buf_page_is_checksum_valid_crc32(read_buf,
checksum_field1, checksum_field2, true)) {
-
+#ifndef UNIV_INNOCHECKSUM
page_warn_strict_checksum(
curr_algo,
SRV_CHECKSUM_ALGORITHM_CRC32,
page_id);
-#endif /* UNIV_INNOCHECKSUM */
+#endif /* !UNIV_INNOCHECKSUM */
return(false);
}
if (buf_page_is_checksum_valid_innodb(read_buf,
- checksum_field1, checksum_field2
-#ifdef UNIV_INNOCHECKSUM
- , page_no, is_log_enabled, log_file, curr_algo)) {
-#else /* UNIV_INNOCHECKSUM */
- )) {
+ checksum_field1, checksum_field2)) {
+#ifndef UNIV_INNOCHECKSUM
page_warn_strict_checksum(
curr_algo,
SRV_CHECKSUM_ALGORITHM_INNODB,
page_id);
-#endif /* UNIV_INNOCHECKSUM */
+#endif /* !UNIV_INNOCHECKSUM */
return(false);
}
#ifdef UNIV_INNOCHECKSUM
- if (is_log_enabled) {
+ if (log_file) {
fprintf(log_file, "Fail; page %lu"
" invalid (fails none checksum)\n",
- page_no);
+ cur_page_num);
}
#endif /* UNIV_INNOCHECKSUM */
return(true);
@@ -1496,6 +1411,10 @@ buf_block_init(
{
UNIV_MEM_DESC(frame, UNIV_PAGE_SIZE);
+ /* This function should only be executed at database startup or by
+ buf_pool_resize(). Either way, adaptive hash index must not exist. */
+ assert_block_ahi_empty_on_init(block);
+
block->frame = frame;
block->page.buf_pool_index = buf_pool_index(buf_pool);
@@ -1526,11 +1445,6 @@ buf_block_init(
ut_d(block->in_unzip_LRU_list = FALSE);
ut_d(block->in_withdraw_list = FALSE);
-#ifdef BTR_CUR_HASH_ADAPT
-# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- block->n_pointers = 0;
-# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-#endif /* BTR_CUR_HASH_ADAPT */
page_zip_des_init(&block->page.zip);
mutex_create(LATCH_ID_BUF_BLOCK_MUTEX, &block->mutex);
@@ -1763,7 +1677,9 @@ buf_chunk_not_freed(
== block->page.newest_modification);
ut_ad(block->page.oldest_modification == 0
|| block->page.oldest_modification
- == recv_sys->recovered_lsn);
+ == recv_sys->recovered_lsn
+ || srv_force_recovery
+ == SRV_FORCE_NO_LOG_REDO);
ut_ad(block->page.buf_fix_count == 0);
ut_ad(block->page.io_fix == BUF_IO_NONE);
break;
@@ -2244,6 +2160,10 @@ buf_page_realloc(
/* set other flags of buf_block_t */
#ifdef BTR_CUR_HASH_ADAPT
+ /* This code should only be executed by buf_pool_resize(),
+ while the adaptive hash index is disabled. */
+ assert_block_ahi_empty(block);
+ assert_block_ahi_empty_on_init(new_block);
ut_ad(!block->index);
new_block->index = NULL;
new_block->n_hash_helps = 0;
@@ -3210,20 +3130,23 @@ buf_pool_clear_hash_index()
for (; i--; block++) {
dict_index_t* index = block->index;
+ assert_block_ahi_valid(block);
/* We can set block->index = NULL
- when we have an x-latch on search latch;
- see the comment in buf0buf.h */
+ and block->n_pointers = 0
+ when btr_search_own_all(RW_LOCK_X);
+ see the comments in buf0buf.h */
if (!index) {
- /* Not hashed */
continue;
}
- block->index = NULL;
+ ut_ad(buf_block_get_state(block)
+ == BUF_BLOCK_FILE_PAGE);
# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
block->n_pointers = 0;
# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+ block->index = NULL;
}
}
}
@@ -3915,6 +3838,9 @@ buf_block_init_low(
{
block->skip_flush_check = false;
#ifdef BTR_CUR_HASH_ADAPT
+ /* No adaptive hash index entries may point to a previously
+ unused (and now freshly allocated) block. */
+ assert_block_ahi_empty_on_init(block);
block->index = NULL;
block->n_hash_helps = 0;
@@ -5266,7 +5192,7 @@ buf_page_init(
ut_d(buf_LRU_print());
ut_d(buf_validate());
ut_d(buf_LRU_validate());
- ut_ad(0);
+ ut_error;
}
ut_ad(!block->page.in_zip_hash);
@@ -5833,16 +5759,14 @@ buf_mark_space_corrupt(
return(ret);
}
-/********************************************************************//**
-Check if page is maybe compressed, encrypted or both when we encounter
+/** Check if page is maybe compressed, encrypted or both when we encounter
corrupted page. Note that we can't be 100% sure if page is corrupted
or decrypt/decompress just failed.
@param[in,out] bpage Page
@return true if page corrupted, false if not */
-UNIV_INTERN
+static
bool
-buf_page_check_corrupt(
- buf_page_t* bpage)
+buf_page_check_corrupt(buf_page_t* bpage)
{
byte* dst_frame = (bpage->zip.data) ? bpage->zip.data :
((buf_block_t*) bpage)->frame;
@@ -5945,8 +5869,13 @@ buf_page_io_complete(
ulint read_space_id;
ut_ad(bpage->zip.data != NULL || ((buf_block_t*)bpage)->frame != NULL);
+ fil_space_t* space = fil_space_acquire_for_io(
+ bpage->id.space());
+ if (!space) {
+ return false;
+ }
- buf_page_decrypt_after_read(bpage);
+ buf_page_decrypt_after_read(bpage, space);
if (bpage->size.is_compressed()) {
frame = bpage->zip.data;
@@ -6020,21 +5949,17 @@ database_corrupted:
&& buf_mark_space_corrupt(bpage)) {
ib::info() << "Simulated IMPORT "
"corruption";
+ fil_space_release_for_io(space);
return(true);
}
goto page_not_corrupt;
);
if (!bpage->encrypted) {
- fil_system_enter();
- fil_space_t* space = fil_space_get_by_id(bpage->id.space());
- fil_system_exit();
-
ib::error()
<< "Database page corruption on disk"
" or a failed file read of tablespace "
- << (space->name ? space->name : "NULL")
- << " page " << bpage->id
+ << space->name << " page " << bpage->id
<< ". You may have to recover from "
<< "a backup.";
@@ -6063,6 +5988,7 @@ database_corrupted:
if (bpage->id.space() > TRX_SYS_SPACE
&& buf_mark_space_corrupt(bpage)) {
+ fil_space_release_for_io(space);
return(false);
} else {
if (!bpage->encrypted) {
@@ -6076,7 +6002,7 @@ database_corrupted:
}
ib_push_warning(innobase_get_trx(), DB_DECRYPTION_FAILED,
- "Table in tablespace %lu encrypted."
+ "Table in tablespace %u encrypted."
"However key management plugin or used key_id %lu is not found or"
" used encryption algorithm or method does not match."
" Can't continue opening the table.",
@@ -6088,6 +6014,7 @@ database_corrupted:
ut_error;
}
+ fil_space_release_for_io(space);
return(false);
}
}
@@ -6131,6 +6058,8 @@ database_corrupted:
}
}
+
+ fil_space_release_for_io(space);
} else {
/* io_type == BUF_IO_WRITE */
if (bpage->slot) {
@@ -7066,15 +6995,16 @@ buf_print_io_instance(
ut_ad(pool_info);
fprintf(file,
- "Buffer pool size %lu\n"
- "Free buffers %lu\n"
- "Database pages %lu\n"
- "Old database pages %lu\n"
- "Modified db pages %lu\n"
+ "Buffer pool size " ULINTPF "\n"
+ "Free buffers " ULINTPF "\n"
+ "Database pages " ULINTPF "\n"
+ "Old database pages " ULINTPF "\n"
+ "Modified db pages " ULINTPF "\n"
"Percent of dirty pages(LRU & free pages): %.3f\n"
"Max dirty pages percent: %.3f\n"
- "Pending reads %lu\n"
- "Pending writes: LRU %lu, flush list %lu, single page %lu\n",
+ "Pending reads " ULINTPF "\n"
+ "Pending writes: LRU " ULINTPF ", flush list " ULINTPF
+ ", single page " ULINTPF "\n",
pool_info->pool_size,
pool_info->free_list_len,
pool_info->lru_len,
@@ -7089,9 +7019,10 @@ buf_print_io_instance(
pool_info->n_pending_flush_single_page);
fprintf(file,
- "Pages made young %lu, not young %lu\n"
+ "Pages made young " ULINTPF ", not young " ULINTPF "\n"
"%.2f youngs/s, %.2f non-youngs/s\n"
- "Pages read %lu, created %lu, written %lu\n"
+ "Pages read " ULINTPF ", created " ULINTPF
+ ", written " ULINTPF "\n"
"%.2f reads/s, %.2f creates/s, %.2f writes/s\n",
pool_info->n_pages_made_young,
pool_info->n_pages_not_made_young,
@@ -7105,23 +7036,22 @@ buf_print_io_instance(
pool_info->pages_written_rate);
if (pool_info->n_page_get_delta) {
- double hit_rate = ((1000 * pool_info->page_read_delta)
- / pool_info->n_page_get_delta);
+ double hit_rate = double(pool_info->page_read_delta)
+ / pool_info->n_page_get_delta;
- if (hit_rate > 1000) {
- hit_rate = 1000;
+ if (hit_rate > 1) {
+ hit_rate = 1;
}
- hit_rate = 1000 - hit_rate;
-
fprintf(file,
- "Buffer pool hit rate %lu / 1000,"
- " young-making rate %lu / 1000 not %lu / 1000\n",
- (ulint) hit_rate,
- (ulint) (1000 * pool_info->young_making_delta
- / pool_info->n_page_get_delta),
- (ulint) (1000 * pool_info->not_young_making_delta
- / pool_info->n_page_get_delta));
+ "Buffer pool hit rate " ULINTPF " / 1000,"
+ " young-making rate " ULINTPF " / 1000 not "
+ ULINTPF " / 1000\n",
+ ulint(1000 * (1 - hit_rate)),
+ ulint(1000 * double(pool_info->young_making_delta)
+ / pool_info->n_page_get_delta),
+ ulint(1000 * double(pool_info->not_young_making_delta)
+ / pool_info->n_page_get_delta));
} else {
fputs("No buffer pool page gets since the last printout\n",
file);
@@ -7372,72 +7302,55 @@ buf_pool_reserve_tmp_slot(
return (free_slot);
}
-/********************************************************************//**
-Encrypts a buffer page right before it's flushed to disk
-@param[in,out] bpage Page control block
-@param[in,out] src_frame Source page
-@param[in] space_id Tablespace id
-@return either unencrypted source page or decrypted page.
-*/
+/** Encryption and page_compression hook that is called just before
+a page is written to disk.
+@param[in,out] space tablespace
+@param[in,out] bpage buffer page
+@param[in] src_frame physical page frame that is being encrypted
+@return page frame to be written to file
+(may be src_frame or an encrypted/compressed copy of it) */
UNIV_INTERN
byte*
buf_page_encrypt_before_write(
+ fil_space_t* space,
buf_page_t* bpage,
- byte* src_frame,
- ulint space_id)
+ byte* src_frame)
{
+ ut_ad(space->id == bpage->id.space());
bpage->real_size = UNIV_PAGE_SIZE;
fil_page_type_validate(src_frame);
- if (bpage->id.page_no() == 0) {
+ switch (bpage->id.page_no()) {
+ case 0:
/* Page 0 of a tablespace is not encrypted/compressed */
ut_ad(bpage->key_version == 0);
return src_frame;
- }
-
- if (space_id == TRX_SYS_SPACE && bpage->id.page_no() == TRX_SYS_PAGE_NO) {
- /* don't encrypt/compress page as it contains address to dblwr buffer */
- bpage->key_version = 0;
- return src_frame;
- }
-
- fil_space_t* space = fil_space_acquire_silent(space_id);
-
- /* Tablespace must exist during write operation */
- if (!space) {
- /* This could be true on discard if we have injected a error
- case e.g. in innodb.innodb-wl5522-debug-zip so that space
- is already marked as stop_new_ops = true. */
- return src_frame;
+ case TRX_SYS_PAGE_NO:
+ if (bpage->id.space() == TRX_SYS_SPACE) {
+ /* don't encrypt/compress page as it contains
+ address to dblwr buffer */
+ bpage->key_version = 0;
+ return src_frame;
+ }
}
const page_size_t page_size(space->flags);
fil_space_crypt_t* crypt_data = space->crypt_data;
- bool encrypted = true;
-
- if (space->crypt_data != NULL && space->crypt_data->not_encrypted()) {
- /* Encryption is disabled */
- encrypted = false;
- }
-
- if (!srv_encrypt_tables && (crypt_data == NULL || crypt_data->is_default_encryption())) {
- /* Encryption is disabled */
- encrypted = false;
- }
+ const bool encrypted = crypt_data
+ && !crypt_data->not_encrypted()
+ && crypt_data->type != CRYPT_SCHEME_UNENCRYPTED
+ && (!crypt_data->is_default_encryption()
+ || srv_encrypt_tables);
- /* Is encryption needed? */
- if (crypt_data == NULL || crypt_data->type == CRYPT_SCHEME_UNENCRYPTED) {
- /* An unencrypted table */
+ if (!encrypted) {
bpage->key_version = 0;
- encrypted = false;
}
- bool page_compressed = fil_space_is_page_compressed(bpage->id.space());
+ bool page_compressed = FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags);
if (!encrypted && !page_compressed) {
/* No need to encrypt or page compress the page */
- fil_space_release(space);
return src_frame;
}
@@ -7464,25 +7377,21 @@ buf_page_encrypt_before_write(
bpage->real_size = page_size.physical();
slot->out_buf = dst_frame = tmp;
-#ifdef UNIV_DEBUG
- fil_page_type_validate(tmp);
-#endif
-
+ ut_d(fil_page_type_validate(tmp));
} else {
/* First we compress the page content */
ulint out_len = 0;
- ulint block_size = fil_space_get_block_size(space_id, bpage->id.page_no(), page_size.logical());
-
- byte *tmp = fil_compress_page(space_id,
- (byte *)src_frame,
- slot->comp_buf,
- page_size.logical(),
- fil_space_get_page_compression_level(space_id),
- block_size,
- encrypted,
- &out_len,
- IF_LZO(slot->lzo_mem, NULL)
- );
+
+ byte *tmp = fil_compress_page(
+ space,
+ (byte *)src_frame,
+ slot->comp_buf,
+ page_size.logical(),
+ fsp_flags_get_page_compression_level(space->flags),
+ fil_space_get_block_size(space, bpage->id.page_no()),
+ encrypted,
+ &out_len,
+ IF_LZO(slot->lzo_mem, NULL));
bpage->real_size = out_len;
@@ -7505,18 +7414,21 @@ buf_page_encrypt_before_write(
ut_d(fil_page_type_validate(dst_frame));
- fil_space_release(space);
// return dst_frame which will be written
return dst_frame;
}
/** Decrypt a page.
@param[in,out] bpage Page control block
+@param[in,out] space tablespace
@return whether the operation was successful */
static
bool
-buf_page_decrypt_after_read(buf_page_t* bpage)
+buf_page_decrypt_after_read(buf_page_t* bpage, fil_space_t* space)
{
+ ut_ad(space->n_pending_ios > 0);
+ ut_ad(space->id == bpage->id.space());
+
bool compressed = bpage->size.is_compressed();
const page_size_t& size = bpage->size;
byte* dst_frame = compressed ? bpage->zip.data :
@@ -7535,12 +7447,10 @@ buf_page_decrypt_after_read(buf_page_t* bpage)
return (true);
}
- FilSpace space(bpage->id.space(), true);
-
/* Page is encrypted if encryption information is found from
tablespace and page contains used key_version. This is true
also for pages first compressed and then encrypted. */
- if (!space() || !space()->crypt_data) {
+ if (!space->crypt_data) {
key_version = 0;
}
@@ -7553,9 +7463,9 @@ buf_page_decrypt_after_read(buf_page_t* bpage)
/* decompress using comp_buf to dst_frame */
fil_decompress_page(slot->comp_buf,
- dst_frame,
- size.logical(),
- &bpage->write_size);
+ dst_frame,
+ ulong(size.logical()),
+ &bpage->write_size);
/* Mark this slot as free */
slot->reserved = false;
@@ -7600,9 +7510,9 @@ buf_page_decrypt_after_read(buf_page_t* bpage)
ut_d(fil_page_type_validate(dst_frame));
/* decompress using comp_buf to dst_frame */
fil_decompress_page(slot->comp_buf,
- dst_frame,
- size.logical(),
- &bpage->write_size);
+ dst_frame,
+ ulong(size.logical()),
+ &bpage->write_size);
ut_d(fil_page_type_validate(dst_frame));
}
@@ -7612,6 +7522,7 @@ buf_page_decrypt_after_read(buf_page_t* bpage)
}
}
+ ut_ad(space->n_pending_ios > 0);
return (success);
}
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index fcf6d55f660..f99fc6434de 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -168,8 +168,7 @@ doublewrite buffer is placed on the trx system header page.
@return true if successful, false if not. */
MY_ATTRIBUTE((warn_unused_result))
bool
-buf_dblwr_create(void)
-/*==================*/
+buf_dblwr_create()
{
buf_block_t* block2;
buf_block_t* new_block;
@@ -510,7 +509,7 @@ buf_dblwr_init_or_load_pages(
/** Process and remove the double write buffer pages for all tablespaces. */
void
-buf_dblwr_process(void)
+buf_dblwr_process()
{
ulint page_no_dblwr = 0;
byte* read_buf;
@@ -527,9 +526,7 @@ buf_dblwr_process(void)
i != recv_dblwr.pages.end();
++i, ++page_no_dblwr) {
byte* page = *i;
- ulint page_no = page_get_page_no(page);
ulint space_id = page_get_space_id(page);
-
fil_space_t* space = fil_space_get(space_id);
if (space == NULL) {
@@ -540,6 +537,7 @@ buf_dblwr_process(void)
fil_space_open_if_needed(space);
+ const ulint page_no = page_get_page_no(page);
const page_id_t page_id(space_id, page_no);
if (page_no >= space->size) {
@@ -595,7 +593,7 @@ buf_dblwr_process(void)
/* Decompress the page before
validating the checksum. */
fil_decompress_page(
- NULL, read_buf, UNIV_PAGE_SIZE,
+ NULL, read_buf, srv_page_size,
NULL, true);
}
@@ -621,7 +619,7 @@ buf_dblwr_process(void)
/* Decompress the page before
validating the checksum. */
fil_decompress_page(
- NULL, page, UNIV_PAGE_SIZE, NULL, true);
+ NULL, page, srv_page_size, NULL, true);
}
if (!fil_space_verify_crypt_checksum(page, page_size,
@@ -676,8 +674,7 @@ buf_dblwr_process(void)
/****************************************************************//**
Frees doublewrite buffer. */
void
-buf_dblwr_free(void)
-/*================*/
+buf_dblwr_free()
{
/* Free the double write data structures. */
ut_a(buf_dblwr != NULL);
@@ -932,8 +929,7 @@ important to call this function after a batch of writes has been posted,
and also when we may have to wait for a page latch! Otherwise a deadlock
of threads can occur. */
void
-buf_dblwr_flush_buffered_writes(void)
-/*=================================*/
+buf_dblwr_flush_buffered_writes()
{
byte* write_buf;
ulint first_free;
diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc
index 9b86b1c16da..ce7488e3d1f 100644
--- a/storage/innobase/buf/buf0dump.cc
+++ b/storage/innobase/buf/buf0dump.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -796,6 +796,7 @@ extern "C"
os_thread_ret_t
DECLARE_THREAD(buf_dump_thread)(void*)
{
+ my_thread_init();
ut_ad(!srv_read_only_mode);
/* JAN: TODO: MySQL 5.7 PSI
#ifdef UNIV_PFS_THREAD
@@ -836,6 +837,7 @@ DECLARE_THREAD(buf_dump_thread)(void*)
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();
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index a0ed243d74b..d0c0316bf13 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1006,11 +1006,16 @@ buf_flush_write_block_low(
buf_flush_t flush_type, /*!< in: type of flush */
bool sync) /*!< in: true if sync IO request */
{
+ fil_space_t* space = fil_space_acquire_for_io(bpage->id.space());
+ if (!space) {
+ return;
+ }
+ ut_ad(space->purpose == FIL_TYPE_TEMPORARY
+ || space->purpose == FIL_TYPE_IMPORT
+ || space->purpose == FIL_TYPE_TABLESPACE);
+ const bool is_temp = space->purpose == FIL_TYPE_TEMPORARY;
+ ut_ad(is_temp == fsp_is_system_temporary(space->id));
page_t* frame = NULL;
- ulint space_id = bpage->id.space();
- const bool is_temp = fsp_is_system_temporary(space_id);
- bool atomic_writes = is_temp || fil_space_get_atomic_writes(space_id);
-
#ifdef UNIV_DEBUG
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
ut_ad(!buf_pool_mutex_own(buf_pool));
@@ -1076,28 +1081,27 @@ buf_flush_write_block_low(
break;
}
- frame = buf_page_encrypt_before_write(bpage, frame, space_id);
+ frame = buf_page_encrypt_before_write(space, bpage, frame);
/* Disable use of double-write buffer for temporary tablespace.
Given the nature and load of temporary tablespace doublewrite buffer
adds an overhead during flushing. */
- if (!srv_use_doublewrite_buf
- || buf_dblwr == NULL
- || srv_read_only_mode
- || atomic_writes) {
-
- ut_ad(!srv_read_only_mode
- || fsp_is_system_temporary(bpage->id.space()));
+ if (is_temp || space->atomic_write_supported
+ || !srv_use_doublewrite_buf
+ || buf_dblwr == NULL) {
ulint type = IORequest::WRITE | IORequest::DO_NOT_WAKE;
IORequest request(type, bpage);
+ /* TODO: pass the tablespace to fil_io() */
fil_io(request,
sync, bpage->id, bpage->size, 0, bpage->size.physical(),
- frame, bpage);
+ frame, bpage);
} else {
+ ut_ad(!srv_read_only_mode);
+
if (flush_type == BUF_FLUSH_SINGLE_PAGE) {
buf_dblwr_write_single_page(bpage, sync);
} else {
@@ -1111,13 +1115,23 @@ buf_flush_write_block_low(
are working on. */
if (sync) {
ut_ad(flush_type == BUF_FLUSH_SINGLE_PAGE);
- fil_flush(bpage->id.space());
+ if (!is_temp) {
+ fil_flush(space);
+ }
/* true means we want to evict this page from the
LRU list as well. */
+ /* The tablespace could already have been dropped,
+ because fil_io(request, sync) would already have
+ decremented the node->n_pending. However,
+ buf_page_io_complete() only needs to look up the
+ tablespace during read requests, not during writes. */
+ ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_WRITE);
buf_page_io_complete(bpage, true);
}
+ fil_space_release_for_io(space);
+
/* Increment the counter of I/O operations used
for selecting LRU policy. */
buf_LRU_stat_inc_io();
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index d6d5db3dfa9..10a8561d38d 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -294,21 +295,29 @@ next_page:
continue;
}
- mutex_enter(&((buf_block_t*) bpage)->mutex);
+ buf_block_t* block = reinterpret_cast<buf_block_t*>(bpage);
- {
- bool skip = bpage->buf_fix_count > 0
- || !((buf_block_t*) bpage)->index;
+ mutex_enter(&block->mutex);
- mutex_exit(&((buf_block_t*) bpage)->mutex);
+ /* This debug check uses a dirty read that could
+ theoretically cause false positives while
+ buf_pool_clear_hash_index() is executing.
+ (Other conflicting access paths to the adaptive hash
+ index should not be possible, because when a
+ tablespace is being discarded or dropped, there must
+ be no concurrect access to the contained tables.) */
+ assert_block_ahi_valid(block);
- if (skip) {
- /* Skip this block, because there are
- no adaptive hash index entries
- pointing to it, or because we cannot
- drop them due to the buffer-fix. */
- goto next_page;
- }
+ bool skip = bpage->buf_fix_count > 0 || !block->index;
+
+ mutex_exit(&block->mutex);
+
+ if (skip) {
+ /* Skip this block, because there are
+ no adaptive hash index entries
+ pointing to it, or because we cannot
+ drop them due to the buffer-fix. */
+ goto next_page;
}
/* Store the page number so that we can drop the hash
@@ -799,6 +808,17 @@ scan_again:
bpage->id, bpage->size);
goto scan_again;
+ } else {
+ /* This debug check uses a dirty read that could
+ theoretically cause false positives while
+ buf_pool_clear_hash_index() is executing,
+ if the writes to block->index=NULL and
+ block->n_pointers=0 are reordered.
+ (Other conflicting access paths to the adaptive hash
+ index should not be possible, because when a
+ tablespace is being discarded or dropped, there must
+ be no concurrect access to the contained tables.) */
+ assert_block_ahi_empty((buf_block_t*) bpage);
}
#endif /* BTR_CUR_HASH_ADAPT */
@@ -1155,6 +1175,9 @@ buf_LRU_get_free_only(
|| !buf_block_will_withdrawn(buf_pool, block)) {
/* found valid free block */
buf_page_mutex_enter(block);
+ /* No adaptive hash index entries may point to
+ a free block. */
+ assert_block_ahi_empty(block);
buf_block_set_state(block, BUF_BLOCK_READY_FOR_USE);
UNIV_MEM_ALLOC(block->frame, UNIV_PAGE_SIZE);
@@ -2029,17 +2052,10 @@ buf_LRU_block_free_non_file_page(
case BUF_BLOCK_READY_FOR_USE:
break;
default:
- ib::error() << "Block:" << block
- << " incorrect state:" << buf_get_state_name(block)
- << " in buf_LRU_block_free_non_file_page";
- return; /* Continue */
+ ut_error;
}
-#ifdef BTR_CUR_HASH_ADAPT
-# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- ut_a(block->n_pointers == 0);
-# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-#endif /* BTR_CUR_HASH_ADAPT */
+ assert_block_ahi_empty(block);
ut_ad(!block->page.in_free_list);
ut_ad(!block->page.in_flush_list);
ut_ad(!block->page.in_LRU_list);
@@ -2664,13 +2680,13 @@ buf_LRU_print_instance(
}
if (bpage->buf_fix_count) {
- fprintf(stderr, "buffix count %lu ",
- (ulong) bpage->buf_fix_count);
+ fprintf(stderr, "buffix count %u ",
+ bpage->buf_fix_count);
}
if (buf_page_get_io_fix(bpage)) {
- fprintf(stderr, "io_fix %lu ",
- (ulong) buf_page_get_io_fix(bpage));
+ fprintf(stderr, "io_fix %d ",
+ buf_page_get_io_fix(bpage));
}
if (bpage->oldest_modification) {
@@ -2681,23 +2697,23 @@ buf_LRU_print_instance(
const byte* frame;
case BUF_BLOCK_FILE_PAGE:
frame = buf_block_get_frame((buf_block_t*) bpage);
- fprintf(stderr, "\ntype %lu"
+ fprintf(stderr, "\ntype " ULINTPF
" index id " IB_ID_FMT "\n",
- (ulong) fil_page_get_type(frame),
+ fil_page_get_type(frame),
btr_page_get_index_id(frame));
break;
case BUF_BLOCK_ZIP_PAGE:
frame = bpage->zip.data;
- fprintf(stderr, "\ntype %lu size %lu"
+ fprintf(stderr, "\ntype " ULINTPF " size " ULINTPF
" index id " IB_ID_FMT "\n",
- (ulong) fil_page_get_type(frame),
- (ulong) bpage->size.physical(),
+ fil_page_get_type(frame),
+ bpage->size.physical(),
btr_page_get_index_id(frame));
break;
default:
- fprintf(stderr, "\n!state %lu!\n",
- (ulong) buf_page_get_state(bpage));
+ fprintf(stderr, "\n!state %d!\n",
+ buf_page_get_state(bpage));
break;
}
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index 4d68ad5ac51..f5bd088ce5c 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2016 MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -290,6 +290,24 @@ buf_read_ahead_random(
below: if DISCARD + IMPORT changes the actual .ibd file meanwhile, we
do not try to read outside the bounds of the tablespace! */
if (fil_space_t* space = fil_space_acquire(page_id.space())) {
+
+#ifdef UNIV_DEBUG
+ if (srv_file_per_table) {
+ ulint size = 0;
+
+ for (const fil_node_t* node =
+ UT_LIST_GET_FIRST(space->chain);
+ node != NULL;
+ node = UT_LIST_GET_NEXT(chain, node)) {
+
+ size += os_file_get_size(node->handle)
+ / page_size.physical();
+ }
+
+ ut_ad(size == space->size);
+ }
+#endif /* UNIV_DEBUG */
+
if (high > space->size) {
high = space->size;
}
@@ -896,4 +914,3 @@ buf_read_recv_pages(
DBUG_PRINT("ib_buf", ("recovery read-ahead (%u pages)",
unsigned(n_stored)));
}
-
diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc
index 8b1900face7..d819ad50ed9 100644
--- a/storage/innobase/data/data0data.cc
+++ b/storage/innobase/data/data0data.cc
@@ -429,7 +429,7 @@ print_hex:
fputs(" Hex: ",stderr);
for (i = 0; i < len; i++) {
- fprintf(stderr, "%02lx", static_cast<ulong>(*data++));
+ fprintf(stderr, "%02x", *data++);
}
if (dfield_is_ext(dfield)) {
diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc
index 8d5bde4e0e2..3ae6639cd73 100644
--- a/storage/innobase/dict/dict0boot.cc
+++ b/storage/innobase/dict/dict0boot.cc
@@ -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) 2016, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -488,7 +488,9 @@ dict_boot(void)
err = ibuf_init_at_db_start();
if (err == DB_SUCCESS) {
- if (srv_read_only_mode && !ibuf_is_empty()) {
+ if (srv_read_only_mode
+ && srv_force_recovery != SRV_FORCE_NO_LOG_REDO
+ && !ibuf_is_empty()) {
if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
ib::error() << "Change buffer must be empty when"
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 0db194b7e52..0d949a00b27 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -6597,7 +6597,7 @@ dict_table_schema_check(
if ((ulint) table->n_def - n_sys_cols != req_schema->n_cols) {
/* the table has a different number of columns than required */
ut_snprintf(errstr, errstr_sz,
- "%s has %lu columns but should have %lu.",
+ "%s has %lu columns but should have " ULINTPF ".",
ut_format_name(req_schema->table_name,
buf, sizeof(buf)),
table->n_def - n_sys_cols,
@@ -6695,7 +6695,7 @@ dict_table_schema_check(
ut_snprintf(
errstr, errstr_sz,
"Table %s has " ULINTPF " foreign key(s) pointing"
- " to other tables, but it must have %lu.",
+ " to other tables, but it must have " ULINTPF ".",
ut_format_name(req_schema->table_name,
buf, sizeof(buf)),
static_cast<ulint>(table->foreign_set.size()),
@@ -6707,7 +6707,7 @@ dict_table_schema_check(
ut_snprintf(
errstr, errstr_sz,
"There are " ULINTPF " foreign key(s) pointing to %s, "
- "but there must be %lu.",
+ "but there must be " ULINTPF ".",
static_cast<ulint>(table->referenced_set.size()),
ut_format_name(req_schema->table_name,
buf, sizeof(buf)),
@@ -6747,7 +6747,7 @@ dict_fs2utf8(
strconvert(
&my_charset_filename, db, db_len, system_charset_info,
- db_utf8, db_utf8_size, &errors);
+ db_utf8, uint(db_utf8_size), &errors);
/* convert each # to @0023 in table name and store the result in buf */
const char* table = dict_remove_db_name(db_and_table);
@@ -6774,7 +6774,7 @@ dict_fs2utf8(
strconvert(
&my_charset_filename, buf, (uint) (buf_p - buf),
system_charset_info,
- table_utf8, table_utf8_size,
+ table_utf8, uint(table_utf8_size),
&errors);
if (errors != 0) {
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index 13db213259c..7a6f09569a6 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -810,7 +810,12 @@ dict_mem_fill_vcol_from_v_indexes(
index;
index = dict_table_get_next_index(index)) {
- if (!dict_index_has_virtual(index)) {
+ /* Skip if the index have newly added
+ virtual column because field name is NULL.
+ Later virtual column set will be
+ refreshed during loading of table. */
+ if (!dict_index_has_virtual(index)
+ || index->has_new_v_col) {
continue;
}
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index 9eb033a7eb9..537a70c2069 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
-Copyright (c) 2009, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2009, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -138,7 +139,7 @@ then we would store 5,7,10,11,12 in the array. */
typedef std::vector<ib_uint64_t, ut_allocator<ib_uint64_t> > boundaries_t;
/** Allocator type used for index_map_t. */
-typedef ut_allocator<std::pair<const char*, dict_index_t*> >
+typedef ut_allocator<std::pair<const char* const, dict_index_t*> >
index_map_t_allocator;
/** Auxiliary map used for sorting indexes by name in dict_stats_save(). */
@@ -1046,8 +1047,8 @@ dict_stats_analyze_index_level(
ulint* prev_rec_offsets;
ulint i;
- DEBUG_PRINTF(" %s(table=%s, index=%s, level=%lu)\n", __func__,
- index->table->name, index->name, level);
+ DEBUG_PRINTF(" %s(table=%s, index=%s, level=" ULINTPF ")\n",
+ __func__, index->table->name, index->name, level);
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
MTR_MEMO_SX_LOCK));
@@ -1151,10 +1152,11 @@ dict_stats_analyze_index_level(
them away) which brings non-determinism. We skip only
leaf-level delete marks because delete marks on
non-leaf level do not make sense. */
- if (level == 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
@@ -1175,7 +1177,6 @@ dict_stats_analyze_index_level(
continue;
}
-
rec_offsets = rec_get_offsets(
rec, index, rec_offsets, n_uniq, &heap);
@@ -1292,7 +1293,7 @@ dict_stats_analyze_index_level(
DEBUG_PRINTF(" %s(): total recs: " UINT64PF
", total pages: " UINT64PF
- ", n_diff[%lu]: " UINT64PF "\n",
+ ", n_diff[" ULINTPF "]: " UINT64PF "\n",
__func__, *total_recs,
*total_pages,
i, n_diff[i]);
@@ -1333,8 +1334,12 @@ enum page_scan_method_t {
the given page and count the number of
distinct ones, also ignore delete marked
records */
- QUIT_ON_FIRST_NON_BORING/* quit when the first record that differs
+ QUIT_ON_FIRST_NON_BORING,/* quit when the first record that differs
from its right neighbor is found */
+ COUNT_ALL_NON_BORING_INCLUDE_DEL_MARKED/* scan all records on
+ the given page and count the number of
+ distinct ones, include delete marked
+ records */
};
/* @} */
@@ -1553,7 +1558,7 @@ dict_stats_analyze_index_below_cur(
page = buf_block_get_frame(block);
- if (btr_page_get_level(page, mtr) == 0) {
+ if (page_is_leaf(page)) {
/* leaf level */
break;
}
@@ -1598,7 +1603,7 @@ dict_stats_analyze_index_below_cur(
}
/* make sure we got a leaf page as a result from the above loop */
- ut_ad(btr_page_get_level(page, &mtr) == 0);
+ ut_ad(page_is_leaf(page));
/* scan the leaf page and find the number of distinct keys,
when looking only at the first n_prefix columns; also estimate
@@ -1607,6 +1612,8 @@ dict_stats_analyze_index_below_cur(
offsets_rec = dict_stats_scan_page(
&rec, offsets1, offsets2, index, page, n_prefix,
+ srv_stats_include_delete_marked ?
+ COUNT_ALL_NON_BORING_INCLUDE_DEL_MARKED:
COUNT_ALL_NON_BORING_AND_SKIP_DEL_MARKED, n_diff,
n_external_pages);
@@ -1912,8 +1919,9 @@ dict_stats_index_set_n_diff(
index->stat_n_sample_sizes[n_prefix - 1]
= data->n_leaf_pages_to_analyze;
- DEBUG_PRINTF(" %s(): n_diff=" UINT64PF " for n_prefix=%lu"
- " (%lu"
+ DEBUG_PRINTF(" %s(): n_diff=" UINT64PF
+ " for n_prefix=" ULINTPF
+ " (" ULINTPF
" * " UINT64PF " / " UINT64PF
" * " UINT64PF " / " UINT64PF ")\n",
__func__,
@@ -2068,8 +2076,8 @@ dict_stats_analyze_index(
for (n_prefix = n_uniq; n_prefix >= 1; n_prefix--) {
- DEBUG_PRINTF(" %s(): searching level with >=%llu"
- " distinct records, n_prefix=%lu\n",
+ DEBUG_PRINTF(" %s(): searching level with >=%llu "
+ "distinct records, n_prefix=" ULINTPF "\n",
__func__, N_DIFF_REQUIRED(index), n_prefix);
/* Commit the mtr to release the tree S lock to allow
@@ -2173,8 +2181,9 @@ dict_stats_analyze_index(
}
found_level:
- DEBUG_PRINTF(" %s(): found level %lu that has " UINT64PF
- " distinct records for n_prefix=%lu\n",
+ DEBUG_PRINTF(" %s(): found level " ULINTPF
+ " that has " UINT64PF
+ " distinct records for n_prefix=" ULINTPF "\n",
__func__, level, n_diff_on_level[n_prefix - 1],
n_prefix);
/* here we are either on level 1 or the level that we are on
@@ -2535,20 +2544,19 @@ dict_stats_save(
ut_ad(!dict_index_is_ibuf(index));
- for (ulint i = 0; i < index->n_uniq; i++) {
+ for (unsigned i = 0; i < index->n_uniq; i++) {
char stat_name[16];
char stat_description[1024];
- ulint j;
ut_snprintf(stat_name, sizeof(stat_name),
- "n_diff_pfx%02lu", i + 1);
+ "n_diff_pfx%02u", i + 1);
/* craft a string that contains the column names */
ut_snprintf(stat_description,
sizeof(stat_description),
"%s", index->fields[0].name());
- for (j = 1; j <= i; j++) {
+ for (unsigned j = 1; j <= i; j++) {
size_t len;
len = strlen(stat_description);
diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc
index 4ffee160c9f..876d1bcb342 100644
--- a/storage/innobase/dict/dict0stats_bg.cc
+++ b/storage/innobase/dict/dict0stats_bg.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
-Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -31,6 +31,7 @@ Created Apr 25, 2012 Vasil Dimov
#include "row0mysql.h"
#include "srv0start.h"
#include "ut0new.h"
+#include "fil0fil.h"
#include <vector>
@@ -318,8 +319,9 @@ dict_stats_process_entry_from_recalc_pool()
return;
}
- /* Check whether table is corrupted */
- if (table->corrupted) {
+ ut_ad(!dict_table_is_temporary(table));
+
+ if (!fil_table_accessible(table)) {
dict_table_close(table, TRUE, FALSE);
mutex_exit(&dict_sys->mutex);
return;
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index db7efe89d37..b031a77baa8 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
-Copyright (c) 2014, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2014, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -629,7 +629,7 @@ fil_space_encrypt(
fil_space_crypt_t* crypt_data = space->crypt_data;
const page_size_t page_size(space->flags);
- ut_ad(space->n_pending_ops);
+ ut_ad(space->n_pending_ios > 0);
byte* tmp = fil_encrypt_buf(crypt_data, space->id, offset, lsn,
src_frame, page_size, dst_frame);
@@ -647,7 +647,8 @@ fil_space_encrypt(
comp_mem = (byte *)malloc(UNIV_PAGE_SIZE);
uncomp_mem = (byte *)malloc(UNIV_PAGE_SIZE);
memcpy(comp_mem, src_frame, UNIV_PAGE_SIZE);
- fil_decompress_page(uncomp_mem, comp_mem, page_size.physical(), NULL);
+ fil_decompress_page(uncomp_mem, comp_mem,
+ srv_page_size, NULL);
src = uncomp_mem;
}
@@ -657,7 +658,8 @@ fil_space_encrypt(
/* Need to decompress the page if it was also compressed */
if (page_compressed_encrypted) {
memcpy(comp_mem, tmp_mem, UNIV_PAGE_SIZE);
- fil_decompress_page(tmp_mem, comp_mem, page_size.physical(), NULL);
+ fil_decompress_page(tmp_mem, comp_mem,
+ srv_page_size, NULL);
}
bool corrupted = buf_page_is_corrupted(true, tmp_mem, page_size, space);
@@ -731,7 +733,8 @@ fil_space_decrypt(
<< " carries key_version " << key_version
<< " (should be undefined)");
- mach_write_to_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0);
+ memset(src_frame
+ + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0, 4);
}
return false;
@@ -818,7 +821,7 @@ fil_space_decrypt(
*decrypted = false;
ut_ad(space->crypt_data != NULL && space->crypt_data->is_encrypted());
- ut_ad(space->n_pending_ops > 0);
+ ut_ad(space->n_pending_ios > 0);
bool encrypted = fil_space_decrypt(space->crypt_data, tmp_frame,
page_size, src_frame, &err);
@@ -1305,26 +1308,28 @@ fil_crypt_realloc_iops(
if (10 * state->cnt_waited > state->batch) {
/* if we waited more than 10% re-estimate max_iops */
- uint avg_wait_time_us =
+ ulint avg_wait_time_us =
state->sum_waited_us / state->cnt_waited;
+ if (avg_wait_time_us == 0) {
+ avg_wait_time_us = 1; // prevent division by zero
+ }
+
DBUG_PRINT("ib_crypt",
- ("thr_no: %u - update estimated_max_iops from %u to %u.",
+ ("thr_no: %u - update estimated_max_iops from %u to "
+ ULINTPF ".",
state->thread_no,
state->estimated_max_iops,
1000000 / avg_wait_time_us));
- if (avg_wait_time_us == 0) {
- avg_wait_time_us = 1; // prevent division by zero
- }
-
- state->estimated_max_iops = 1000000 / avg_wait_time_us;
+ state->estimated_max_iops = uint(1000000 / avg_wait_time_us);
state->cnt_waited = 0;
state->sum_waited_us = 0;
} else {
DBUG_PRINT("ib_crypt",
- ("thr_no: %u only waited %lu%% skip re-estimate.",
+ ("thr_no: %u only waited " ULINTPF
+ "%% skip re-estimate.",
state->thread_no,
(100 * state->cnt_waited) / state->batch));
}
@@ -1552,33 +1557,27 @@ fil_crypt_find_page_to_rotate(
fil_space_crypt_t *crypt_data = space->crypt_data;
- /* Space might already be dropped */
- if (crypt_data) {
- mutex_enter(&crypt_data->mutex);
- ut_ad(key_state->key_id == crypt_data->key_id);
+ mutex_enter(&crypt_data->mutex);
+ ut_ad(key_state->key_id == crypt_data->key_id);
- if (crypt_data->rotate_state.next_offset <
- crypt_data->rotate_state.max_offset) {
+ bool found = crypt_data->rotate_state.max_offset >=
+ crypt_data->rotate_state.next_offset;
- state->offset = crypt_data->rotate_state.next_offset;
- ulint remaining = crypt_data->rotate_state.max_offset -
- crypt_data->rotate_state.next_offset;
+ if (found) {
+ state->offset = crypt_data->rotate_state.next_offset;
+ ulint remaining = crypt_data->rotate_state.max_offset -
+ crypt_data->rotate_state.next_offset;
- if (batch <= remaining) {
- state->batch = batch;
- } else {
- state->batch = remaining;
- }
-
- crypt_data->rotate_state.next_offset += batch;
- mutex_exit(&crypt_data->mutex);
- return true;
+ if (batch <= remaining) {
+ state->batch = batch;
+ } else {
+ state->batch = remaining;
}
-
- mutex_exit(&crypt_data->mutex);
}
- return false;
+ crypt_data->rotate_state.next_offset += batch;
+ mutex_exit(&crypt_data->mutex);
+ return found;
}
/***********************************************************************
@@ -2160,7 +2159,7 @@ DECLARE_THREAD(fil_crypt_thread)(
fil_crypt_start_rotate_space(&new_state, &thr);
/* iterate all pages (cooperativly with other threads) */
- while (!thr.should_shutdown() && thr.space &&
+ while (!thr.should_shutdown() &&
fil_crypt_find_page_to_rotate(&new_state, &thr)) {
/* rotate a (set) of pages */
@@ -2169,6 +2168,8 @@ DECLARE_THREAD(fil_crypt_thread)(
/* If space is marked as stopping, release
space and stop rotation. */
if (thr.space->is_stopping()) {
+ fil_crypt_complete_rotate_space(
+ &new_state, &thr);
fil_space_release(thr.space);
thr.space = NULL;
break;
@@ -2491,10 +2492,6 @@ bool
fil_space_verify_crypt_checksum(
byte* page,
const page_size_t& page_size,
-#ifdef UNIV_INNOCHECKSUM
- bool strict_check, /*!< --strict-check */
- FILE* log_file, /*!< --log */
-#endif /* UNIV_INNOCHECKSUM */
ulint space,
ulint offset)
{
@@ -2540,14 +2537,7 @@ fil_space_verify_crypt_checksum(
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, checksum);
bool valid = page_zip_verify_checksum(page,
- page_size.physical()
-#ifdef UNIV_INNOCHECKSUM
- , offset,
- strict_check,
- log_file != NULL,
- log_file
-#endif
- );
+ page_size.physical());
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, old);
@@ -2593,19 +2583,11 @@ fil_space_verify_crypt_checksum(
ulint checksum2 = mach_read_from_4(
page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
-#ifdef UNIV_INNOCHECKSUM
-# define CKARGS page, checksum1, checksum2, \
- offset, log_file != NULL, log_file, algorithm
-#else
-# define CKARGS page, checksum1, checksum2
-#endif
-
bool valid = buf_page_is_checksum_valid_crc32(
- CKARGS, false
+ page, checksum1, checksum2, false
/* FIXME: also try the original crc32 that was
buggy on big-endian architectures? */)
- || buf_page_is_checksum_valid_innodb(CKARGS);
-#undef CKARGS
+ || buf_page_is_checksum_valid_innodb(page, checksum1, checksum2);
if (encrypted && valid) {
/* If page is encrypted and traditional checksums match,
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 06ec31a7ed4..7a169c0bf2c 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -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) 2014, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -30,6 +30,7 @@ Created 10/25/1995 Heikki Tuuri
#include "fil0crypt.h"
#include "btr0btr.h"
+#include "btr0sea.h"
#include "buf0buf.h"
#include "dict0boot.h"
#include "dict0dict.h"
@@ -39,6 +40,7 @@ Created 10/25/1995 Heikki Tuuri
#include "fsp0space.h"
#include "fsp0sysspace.h"
#include "hash0hash.h"
+#include "log0log.h"
#include "log0recv.h"
#include "mach0data.h"
#include "mem0mem.h"
@@ -55,9 +57,6 @@ Created 10/25/1995 Heikki Tuuri
#include "os0event.h"
#include "sync0sync.h"
#include "buf0flu.h"
-#include "srv0start.h"
-#include "trx0purge.h"
-#include "ut0new.h"
#include "os0api.h"
/** Tries to close a file in the LRU list. The caller must hold the fil_sys
@@ -1507,6 +1506,13 @@ fil_space_free_low(
ut_ad(srv_fast_shutdown == 2 || !srv_was_started
|| space->max_lsn == 0);
+ /* Wait for fil_space_release_for_io(); after
+ fil_space_detach(), the tablespace cannot be found, so
+ fil_space_acquire_for_io() would return NULL */
+ while (space->n_pending_ios) {
+ os_thread_sleep(100);
+ }
+
for (fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
node != NULL; ) {
ut_d(space->size -= node->size);
@@ -2268,13 +2274,11 @@ Used by background threads that do not necessarily hold proper locks
for concurrency control.
@param[in] id tablespace ID
@param[in] silent whether to silently ignore missing tablespaces
-@param[in] for_io whether to look up the tablespace while performing I/O
- (possibly executing TRUNCATE)
@return the tablespace
@retval NULL if missing or being deleted or truncated */
inline
fil_space_t*
-fil_space_acquire_low(ulint id, bool silent, bool for_io = false)
+fil_space_acquire_low(ulint id, bool silent)
{
fil_space_t* space;
@@ -2287,7 +2291,7 @@ fil_space_acquire_low(ulint id, bool silent, bool for_io = false)
ib::warn() << "Trying to access missing"
" tablespace " << id;
}
- } else if (!for_io && space->is_stopping()) {
+ } else if (space->is_stopping()) {
space = NULL;
} else {
space->n_pending_ops++;
@@ -2302,14 +2306,12 @@ fil_space_acquire_low(ulint id, bool silent, bool for_io = false)
Used by background threads that do not necessarily hold proper locks
for concurrency control.
@param[in] id tablespace ID
-@param[in] for_io whether to look up the tablespace while performing I/O
- (possibly executing TRUNCATE)
@return the tablespace
@retval NULL if missing or being deleted or truncated */
fil_space_t*
-fil_space_acquire(ulint id, bool for_io)
+fil_space_acquire(ulint id)
{
- return(fil_space_acquire_low(id, false, for_io));
+ return(fil_space_acquire_low(id, false));
}
/** Acquire a tablespace that may not exist.
@@ -2336,6 +2338,39 @@ fil_space_release(fil_space_t* space)
mutex_exit(&fil_system->mutex);
}
+/** Acquire a tablespace for reading or writing a block,
+when it could be dropped concurrently.
+@param[in] id tablespace ID
+@return the tablespace
+@retval NULL if missing */
+fil_space_t*
+fil_space_acquire_for_io(ulint id)
+{
+ mutex_enter(&fil_system->mutex);
+
+ fil_space_t* space = fil_space_get_by_id(id);
+
+ if (space) {
+ space->n_pending_ios++;
+ }
+
+ mutex_exit(&fil_system->mutex);
+
+ return(space);
+}
+
+/** Release a tablespace acquired with fil_space_acquire_for_io().
+@param[in,out] space tablespace to release */
+void
+fil_space_release_for_io(fil_space_t* space)
+{
+ mutex_enter(&fil_system->mutex);
+ ut_ad(space->magic_n == FIL_SPACE_MAGIC_N);
+ ut_ad(space->n_pending_ios > 0);
+ space->n_pending_ios--;
+ mutex_exit(&fil_system->mutex);
+}
+
/********************************************************//**
Creates the database directory for a table if it does not exist yet. */
void
@@ -2837,15 +2872,15 @@ enum fil_operation_t {
@return 0 if no operations else count + 1. */
static
ulint
-fil_check_pending_ops(
- fil_space_t* space,
- ulint count)
+fil_check_pending_ops(const fil_space_t* space, ulint count)
{
ut_ad(mutex_own(&fil_system->mutex));
- const ulint n_pending_ops = space ? space->n_pending_ops : 0;
+ if (space == NULL) {
+ return 0;
+ }
- if (n_pending_ops) {
+ if (ulint n_pending_ops = space->n_pending_ops) {
if (count > 5000) {
ib::warn() << "Trying to close/delete/truncate"
@@ -3057,6 +3092,32 @@ fil_close_tablespace(
return(err);
}
+/** Determine whether a table can be accessed in operations that are
+not (necessarily) protected by meta-data locks.
+(Rollback would generally be protected, but rollback of
+FOREIGN KEY CASCADE/SET NULL is not protected by meta-data locks
+but only by InnoDB table locks, which may be broken by TRUNCATE TABLE.)
+@param[in] table persistent table
+checked @return whether the table is accessible */
+bool
+fil_table_accessible(const dict_table_t* table)
+{
+ if (UNIV_UNLIKELY(table->ibd_file_missing || table->corrupted)) {
+ return(false);
+ }
+
+ if (fil_space_t* space = fil_space_acquire(table->space)) {
+ bool accessible = !space->is_stopping();
+ fil_space_release(space);
+ ut_ad(accessible || dict_table_is_file_per_table(table));
+ return(accessible);
+ } else {
+ /* The tablespace may momentarily be missing during
+ TRUNCATE TABLE. */
+ return(false);
+ }
+}
+
/** Deletes an IBD tablespace, either general or single-table.
The tablespace must be cached in the memory cache. This will delete the
datafile, fil_space_t & fil_node_t entries from the file_system_t cache.
@@ -3266,20 +3327,34 @@ fil_prepare_for_truncate(
return(err);
}
-/**********************************************************************//**
-Reinitialize the original tablespace header with the same space id
-for single tablespace */
+/** Reinitialize the original tablespace header with the same space id
+for single tablespace
+@param[in] id space id of the tablespace
+@param[in] size size in blocks
+@param[in] trx Transaction covering truncate */
void
fil_reinit_space_header(
-/*====================*/
- ulint id, /*!< in: space id */
- ulint size) /*!< in: size in blocks */
+ ulint id,
+ ulint size,
+ trx_t* trx)
{
ut_a(!is_system_tablespace(id));
/* Invalidate in the buffer pool all pages belonging
- to the tablespace */
+ to the tablespace. The buffer pool scan may take long
+ time to complete, therefore we release dict_sys->mutex
+ and the dict operation lock during the scan and aquire
+ it again after the buffer pool scan.*/
+
+ row_mysql_unlock_data_dictionary(trx);
+
+ /* Lock the search latch in shared mode to prevent user
+ from disabling AHI during the scan */
+ btr_search_s_lock_all();
+ DEBUG_SYNC_C("buffer_pool_scan");
buf_LRU_flush_or_remove_pages(id, BUF_REMOVE_ALL_NO_WRITE, 0);
+ btr_search_s_unlock_all();
+ row_mysql_lock_data_dictionary(trx);
/* Remove all insert buffer entries for the tablespace */
ibuf_delete_for_discarded_space(id);
@@ -3859,8 +3934,6 @@ fil_ibd_create(
return(DB_OUT_OF_FILE_SPACE);
}
- /* printf("Creating tablespace %s id %lu\n", path, space_id); */
-
/* We have to write the space id to the file immediately and flush the
file to disk. This is because in crash recovery we must be aware what
tablespaces exist and what are their space id's, so that we can apply
@@ -5489,6 +5562,24 @@ fil_flush(
mutex_exit(&fil_system->mutex);
}
+/** Flush a tablespace.
+@param[in,out] space tablespace to flush */
+void
+fil_flush(fil_space_t* space)
+{
+ ut_ad(space->n_pending_ios > 0);
+ ut_ad(space->purpose == FIL_TYPE_TABLESPACE
+ || space->purpose == FIL_TYPE_IMPORT);
+
+ if (!space->is_stopping()) {
+ mutex_enter(&fil_system->mutex);
+ if (!space->is_stopping()) {
+ fil_flush_low(space);
+ }
+ mutex_exit(&fil_system->mutex);
+ }
+}
+
/** Flush to disk the writes in file spaces of the given type
possibly cached by the OS.
@param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_LOG */
@@ -5894,7 +5985,8 @@ fil_iterate(
/* If the original page is page_compressed, we need
to decompress page before we can update it. */
if (page_compressed) {
- fil_decompress_page(NULL, dst, size, NULL);
+ fil_decompress_page(NULL, dst, ulong(size),
+ NULL);
updated = true;
}
@@ -5956,12 +6048,13 @@ fil_iterate(
if (page_compressed) {
ulint len = 0;
- byte * res = fil_compress_page(space_id,
+ byte * res = fil_compress_page(
+ NULL,
src,
NULL,
size,
dict_table_page_compression_level(iter.table),
- fil_space_get_block_size(space_id, offset, size),
+ 512,/* FIXME: use proper block size */
encrypted,
&len,
NULL);
@@ -5976,6 +6069,8 @@ fil_iterate(
/* If tablespace is encrypted, encrypt page before we
write it back. Note that we should not encrypt the
buffer that is in buffer pool. */
+ /* NOTE: At this stage of IMPORT the
+ buffer pool is not being used at all! */
if (decrypted && encrypted) {
byte *dest = writeptr + (i * size);
ulint space = mach_read_from_4(
@@ -6478,6 +6573,12 @@ fil_names_clear(
bool do_write)
{
mtr_t mtr;
+ ulint mtr_checkpoint_size = LOG_CHECKPOINT_FREE_PER_THREAD;
+
+ DBUG_EXECUTE_IF(
+ "increase_mtr_checkpoint_size",
+ mtr_checkpoint_size = 75 * 1024;
+ );
ut_ad(log_mutex_own());
@@ -6511,11 +6612,24 @@ fil_names_clear(
fil_names_write(space, &mtr);
do_write = true;
+ const mtr_buf_t* mtr_log = mtr_get_log(&mtr);
+
+ /** If the mtr buffer size exceeds the size of
+ LOG_CHECKPOINT_FREE_PER_THREAD then commit the multi record
+ mini-transaction, start the new mini-transaction to
+ avoid the parsing buffer overflow error during recovery. */
+
+ if (mtr_log->size() > mtr_checkpoint_size) {
+ ut_ad(mtr_log->size() < (RECV_PARSING_BUF_SIZE / 2));
+ mtr.commit_checkpoint(lsn, false);
+ mtr.start();
+ }
+
space = next;
}
if (do_write) {
- mtr.commit_checkpoint(lsn);
+ mtr.commit_checkpoint(lsn, true);
} else {
ut_ad(!mtr.has_modifications());
}
@@ -6823,73 +6937,24 @@ fil_space_keyrotate_next(
return(space);
}
-/********************************************************************//**
-Find correct node from file space
-@return node */
-static
-fil_node_t*
-fil_space_get_node(
- fil_space_t* space, /*!< in: file spage */
- ulint space_id, /*!< in: space id */
- os_offset_t* block_offset, /*!< in/out: offset in number of blocks */
- ulint byte_offset, /*!< in: remainder of offset in bytes; in
- aio this must be divisible by the OS block
- size */
- ulint len) /*!< in: how many bytes to read or write; this
- must not cross a file boundary; in aio this
- must be a block size multiple */
-{
- fil_node_t* node;
- ut_ad(mutex_own(&fil_system->mutex));
-
- node = UT_LIST_GET_FIRST(space->chain);
-
- for (;;) {
- if (node == NULL) {
- return(NULL);
- } else if (fil_is_user_tablespace_id(space->id)
- && node->size == 0) {
-
- /* We do not know the size of a single-table tablespace
- before we open the file */
- break;
- } else if (node->size > *block_offset) {
- /* Found! */
- break;
- } else {
- *block_offset -= node->size;
- node = UT_LIST_GET_NEXT(chain, node);
- }
- }
-
- return (node);
-}
-
-/********************************************************************//**
-Return block size of node in file space
-@param[in] space_id space id
-@param[in] block_offset page offset
-@param[in] len page len
-@return file block size */
+/** Determine the block size of the data file.
+@param[in] space tablespace
+@param[in] offset page number
+@return block size */
UNIV_INTERN
ulint
-fil_space_get_block_size(
- ulint space_id,
- os_offset_t block_offset,
- ulint len)
+fil_space_get_block_size(const fil_space_t* space, unsigned offset)
{
ulint block_size = 512;
- ut_ad(!mutex_own(&fil_system->mutex));
-
- mutex_enter(&fil_system->mutex);
- fil_space_t* space = fil_space_get_space(space_id);
-
- if (space) {
- fil_node_t* node = fil_space_get_node(space, space_id, &block_offset, 0, len);
- if (node) {
- block_size = node->block_size;
+ for (fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
+ node != NULL;
+ node = UT_LIST_GET_NEXT(chain, node)) {
+ block_size = node->block_size;
+ if (node->size > offset) {
+ break;
}
+ offset -= node->size;
}
/* Currently supporting block size up to 4K,
@@ -6898,8 +6963,6 @@ fil_space_get_block_size(
block_size = 512;
}
- mutex_exit(&fil_system->mutex);
-
return block_size;
}
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index 39a02aa40df..cb3e50745a7 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -85,8 +85,7 @@ UNIV_INTERN
byte*
fil_compress_page(
/*==============*/
- ulint space_id, /*!< in: tablespace id of the
- table. */
+ fil_space_t* space, /*!< in,out: tablespace (NULL during IMPORT) */
byte* buf, /*!< in: buffer from which to write; in aio
this must be appropriately aligned */
byte* out_buf, /*!< out: compressed buffer */
@@ -104,9 +103,12 @@ fil_compress_page(
ulint write_size=0;
/* Cache to avoid change during function execution */
ulint comp_method = innodb_compression_algorithm;
- ulint orig_page_type;
bool allocated=false;
+ /* page_compression does not apply to tables or tablespaces
+ that use ROW_FORMAT=COMPRESSED */
+ ut_ad(!space || !FSP_FLAGS_GET_ZIP_SSIZE(space->flags));
+
if (encrypted) {
header_len += FIL_PAGE_COMPRESSION_METHOD_SIZE;
}
@@ -127,21 +129,14 @@ fil_compress_page(
ut_ad(len);
ut_ad(out_len);
- /* read original page type */
- orig_page_type = mach_read_from_2(buf + FIL_PAGE_TYPE);
-
- fil_system_enter();
- fil_space_t* space = fil_space_get_by_id(space_id);
- fil_system_exit();
-
/* Let's not compress file space header or
extent descriptor */
- if (orig_page_type == 0 ||
- orig_page_type == FIL_PAGE_TYPE_FSP_HDR ||
- orig_page_type == FIL_PAGE_TYPE_XDES ||
- orig_page_type == FIL_PAGE_PAGE_COMPRESSED) {
+ switch (fil_page_get_type(buf)) {
+ case 0:
+ case FIL_PAGE_TYPE_FSP_HDR:
+ case FIL_PAGE_TYPE_XDES:
+ case FIL_PAGE_PAGE_COMPRESSED:
*out_len = len;
-
goto err_exit;
}
@@ -151,11 +146,9 @@ fil_compress_page(
comp_level = page_zip_level;
}
-#ifdef UNIV_PAGECOMPRESS_DEBUG
- ib_logf(IB_LOG_LEVEL_INFO,
- "Preparing for compress for space %lu name %s len %lu.",
- space_id, fil_space_name(space), len);
-#endif /* UNIV_PAGECOMPRESS_DEBUG */
+ DBUG_LOG("compress", "Preparing for space "
+ << (space ? space->id : 0) << " '"
+ << (space ? space->name : "(import)") << "' len " << len);
write_size = UNIV_PAGE_SIZE - header_len;
@@ -252,7 +245,8 @@ fil_compress_page(
#endif /* HAVE_SNAPPY */
case PAGE_ZLIB_ALGORITHM:
- err = compress2(out_buf+header_len, (ulong*)&write_size, buf, len, comp_level);
+ err = compress2(out_buf+header_len, (ulong*)&write_size, buf,
+ uLong(len), comp_level);
if (err != Z_OK) {
goto err_exit;
@@ -304,13 +298,12 @@ fil_compress_page(
comp_page = static_cast<byte *>(ut_malloc_nokey(UNIV_PAGE_SIZE));
uncomp_page = static_cast<byte *>(ut_malloc_nokey(UNIV_PAGE_SIZE));
memcpy(comp_page, out_buf, UNIV_PAGE_SIZE);
- bool tsfound;
- const page_size_t page_size = fil_space_get_page_size(space_id, &tsfound);
- fil_decompress_page(uncomp_page, comp_page, len, NULL);
+ fil_decompress_page(uncomp_page, comp_page, ulong(len), NULL);
- if (buf_page_is_corrupted(false, uncomp_page, page_size, space)) {
- buf_page_print(uncomp_page, page_size, 0);
+ if (buf_page_is_corrupted(false, uncomp_page, univ_page_size,
+ space)) {
+ buf_page_print(uncomp_page, univ_page_size, 0);
}
ut_free(comp_page);
@@ -329,7 +322,6 @@ fil_compress_page(
/* Actual write needs to be alligned on block size */
if (write_size % block_size) {
size_t tmp = write_size;
-
write_size = (size_t)ut_uint64_align_up((ib_uint64_t)write_size, block_size);
/* Clean up the end of buffer */
memset(out_buf+tmp, 0, write_size - tmp);
@@ -339,11 +331,10 @@ fil_compress_page(
#endif
}
-#ifdef UNIV_PAGECOMPRESS_DEBUG
- ib_logf(IB_LOG_LEVEL_INFO,
- "Compression succeeded for space %lu name %s len %lu out_len %lu.",
- space_id, fil_space_name(space), len, write_size);
-#endif /* UNIV_PAGECOMPRESS_DEBUG */
+ DBUG_LOG("compress", "Succeeded for space "
+ << (space ? space->id : 0) << " '"
+ << (space ? space->name : "(import)")
+ << "' len " << len << " out_len " << write_size);
srv_stats.page_compression_saved.add((len - write_size));
srv_stats.pages_page_compressed.inc();
@@ -369,17 +360,17 @@ err_exit:
/* If error we leave the actual page as it was */
#ifndef UNIV_PAGECOMPRESS_DEBUG
- if (space && space->printed_compression_failure == false) {
+ if (space && !space->printed_compression_failure) {
+ space->printed_compression_failure = true;
#endif
ib::warn() << "Compression failed for space: "
- << space_id << " name: "
- << fil_space_name(space) << " len: "
+ << space->id << " name: "
+ << space->name << " len: "
<< len << " err: " << err << " write_size: "
<< write_size
<< " compression method: "
<< fil_get_compression_alg_name(comp_method)
<< ".";
- space->printed_compression_failure = true;
#ifndef UNIV_PAGECOMPRESS_DEBUG
}
#endif
@@ -640,21 +631,17 @@ err_exit:
/* Note that as we have found the page is corrupted, so
all this could be incorrect. */
ulint space_id = mach_read_from_4(buf+FIL_PAGE_SPACE_ID);
- fil_system_enter();
- fil_space_t* space = fil_space_get_by_id(space_id);
- fil_system_exit();
-
- bool tsfound;
- const page_size_t page_size = fil_space_get_page_size(space_id, &tsfound);
+ fil_space_t* space = fil_space_acquire_for_io(space_id);
ib::error() << "Corruption: Page is marked as compressed"
<< " space: " << space_id << " name: "
- << (space ? fil_space_name(space) : "NULL")
+ << (space ? space->name : "NULL")
<< " but uncompress failed with error: " << err
<< " size: " << actual_size
<< " len: " << len
<< " compression method: "
<< fil_get_compression_alg_name(compression_alg) << ".";
- buf_page_print(buf, page_size, 0);
+ buf_page_print(buf, univ_page_size, 0);
+ fil_space_release_for_io(space);
}
diff --git a/storage/innobase/fts/fts0config.cc b/storage/innobase/fts/fts0config.cc
index cca3d5fcd87..4d41df1abf9 100644
--- a/storage/innobase/fts/fts0config.cc
+++ b/storage/innobase/fts/fts0config.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -349,7 +350,7 @@ fts_config_set_index_ulint(
ut_a(FTS_MAX_INT_LEN < FTS_MAX_CONFIG_VALUE_LEN);
value.f_len = ut_snprintf(
- (char*) value.f_str, FTS_MAX_INT_LEN, "%lu", int_value);
+ (char*) value.f_str, FTS_MAX_INT_LEN, ULINTPF, int_value);
error = fts_config_set_index_value(trx, index, name, &value);
@@ -422,7 +423,7 @@ fts_config_set_ulint(
ut_a(FTS_MAX_INT_LEN < FTS_MAX_CONFIG_VALUE_LEN);
value.f_len = my_snprintf(
- (char*) value.f_str, FTS_MAX_INT_LEN, "%lu", int_value);
+ (char*) value.f_str, FTS_MAX_INT_LEN, ULINTPF, int_value);
error = fts_config_set_value(trx, fts_table, name, &value);
@@ -435,4 +436,3 @@ fts_config_set_ulint(
return(error);
}
-
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index a7d09b5dd47..79020fb4442 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation. All Rights reserved.
+Copyright (c) 2016, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -93,6 +93,7 @@ static const ulint FTS_DEADLOCK_RETRY_WAIT = 100000;
/** variable to record innodb_fts_internal_tbl_name for information
schema table INNODB_FTS_INSERTED etc. */
char* fts_internal_tbl_name = NULL;
+char* fts_internal_tbl_name2 = NULL;
/** InnoDB default stopword list:
There are different versions of stopwords, the stop words listed
@@ -2542,7 +2543,7 @@ fts_get_max_cache_size(
{
dberr_t error;
fts_string_t value;
- ulint cache_size_in_mb;
+ ulong cache_size_in_mb;
/* Set to the default value. */
cache_size_in_mb = FTS_CACHE_SIZE_LOWER_LIMIT_IN_MB;
@@ -6496,6 +6497,36 @@ fts_check_corrupt_index(
return(0);
}
+/* Get parent table name if it's a fts aux table
+@param[in] aux_table_name aux table name
+@param[in] aux_table_len aux table length
+@return parent table name, or NULL */
+char*
+fts_get_parent_table_name(
+ const char* aux_table_name,
+ ulint aux_table_len)
+{
+ fts_aux_table_t aux_table;
+ char* parent_table_name = NULL;
+
+ if (fts_is_aux_table_name(&aux_table, aux_table_name, aux_table_len)) {
+ dict_table_t* parent_table;
+
+ parent_table = dict_table_open_on_id(
+ aux_table.parent_id, TRUE, DICT_TABLE_OP_NORMAL);
+
+ if (parent_table != NULL) {
+ parent_table_name = mem_strdupl(
+ parent_table->name.m_name,
+ strlen(parent_table->name.m_name));
+
+ dict_table_close(parent_table, TRUE, FALSE);
+ }
+ }
+
+ return(parent_table_name);
+}
+
/** Check the validity of the parent table.
@param[in] aux_table auxiliary table
@return true if it is a valid table or false if it is not */
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index f1e717c353a..820e82dc600 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -578,9 +578,6 @@ fts_zip_read_word(
fts_zip_t* zip, /*!< in: Zip state + data */
fts_string_t* word) /*!< out: uncompressed word */
{
-#ifdef UNIV_DEBUG
- ulint i;
-#endif
short len = 0;
void* null = NULL;
byte* ptr = word->f_str;
@@ -656,10 +653,9 @@ fts_zip_read_word(
}
}
-#ifdef UNIV_DEBUG
/* All blocks must be freed at end of inflate. */
if (zip->status != Z_OK) {
- for (i = 0; i < ib_vector_size(zip->blocks); ++i) {
+ for (ulint i = 0; i < ib_vector_size(zip->blocks); ++i) {
if (ib_vector_getp(zip->blocks, i)) {
ut_free(ib_vector_getp(zip->blocks, i));
ib_vector_set(zip->blocks, i, &null);
@@ -670,7 +666,6 @@ fts_zip_read_word(
if (ptr != NULL) {
ut_ad(word->f_len == strlen((char*) ptr));
}
-#endif /* UNIV_DEBUG */
return(zip->status == Z_OK || zip->status == Z_STREAM_END ? ptr : NULL);
}
diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc
index beef71aa178..bc1d173cc29 100644
--- a/storage/innobase/fts/fts0que.cc
+++ b/storage/innobase/fts/fts0que.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -487,7 +488,7 @@ fts_query_lcs(
len = FTS_ELEM(table, c, 0, 0);
fts_print_lcs_table(table, r, c);
- printf("\nLen=%lu\n", len);
+ printf("\nLen=" ULINTPF "\n", len);
ut_free(table);
diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc
index a558ce3f54d..d14bafff72b 100644
--- a/storage/innobase/gis/gis0rtree.cc
+++ b/storage/innobase/gis/gis0rtree.cc
@@ -837,6 +837,9 @@ rtr_split_page_move_rec_list(
ulint max_to_move = 0;
rtr_rec_move_t* rec_move = NULL;
+ ut_ad(!dict_index_is_ibuf(index));
+ ut_ad(dict_index_is_spatial(index));
+
rec_offs_init(offsets_);
page_cur_set_before_first(block, &page_cursor);
@@ -907,8 +910,7 @@ rtr_split_page_move_rec_list(
same temp-table in parallel.
max_trx_id is ignored for temp tables because it not required
for MVCC. */
- if (dict_index_is_sec_or_ibuf(index)
- && page_is_leaf(page)
+ if (page_is_leaf(page)
&& !dict_table_is_temporary(index->table)) {
page_update_max_trx_id(new_block, NULL,
page_get_max_trx_id(page),
diff --git a/storage/innobase/ha/ha0ha.cc b/storage/innobase/ha/ha0ha.cc
index 5822bd6755c..f620db6f62e 100644
--- a/storage/innobase/ha/ha0ha.cc
+++ b/storage/innobase/ha/ha0ha.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -189,6 +190,12 @@ ha_clear(
}
#ifdef BTR_CUR_HASH_ADAPT
+# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
+/** Maximum number of records in a page */
+static const lint MAX_N_POINTERS
+ = UNIV_PAGE_SIZE_MAX / REC_N_NEW_EXTRA_BYTES;
+# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+
/*************************************************************//**
Inserts an entry into a hash table. If an entry with the same fold number
is found, its node is updated to point to the new data, and no new node
@@ -235,9 +242,11 @@ ha_insert_for_fold_func(
buf_block_t* prev_block = prev_node->block;
ut_a(prev_block->frame
== page_align(prev_node->data));
- ut_a(prev_block->n_pointers > 0);
- prev_block->n_pointers--;
- block->n_pointers++;
+ ut_a(my_atomic_addlint(
+ &prev_block->n_pointers, -1)
+ < MAX_N_POINTERS);
+ ut_a(my_atomic_addlint(&block->n_pointers, 1)
+ < MAX_N_POINTERS);
}
prev_node->block = block;
@@ -268,7 +277,8 @@ ha_insert_for_fold_func(
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
if (table->adaptive) {
- block->n_pointers++;
+ ut_a(my_atomic_addlint(&block->n_pointers, 1)
+ < MAX_N_POINTERS);
}
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -329,8 +339,8 @@ ha_delete_hash_node(
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
if (table->adaptive) {
ut_a(del_node->block->frame = page_align(del_node->data));
- ut_a(del_node->block->n_pointers > 0);
- del_node->block->n_pointers--;
+ ut_a(my_atomic_addlint(&del_node->block->n_pointers, -1)
+ < MAX_N_POINTERS);
}
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
@@ -372,9 +382,10 @@ ha_search_and_update_if_found_func(
if (node) {
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
if (table->adaptive) {
- ut_a(node->block->n_pointers > 0);
- node->block->n_pointers--;
- new_block->n_pointers++;
+ ut_a(my_atomic_addlint(&node->block->n_pointers, -1)
+ < MAX_N_POINTERS);
+ ut_a(my_atomic_addlint(&new_block->n_pointers, 1)
+ < MAX_N_POINTERS);
}
node->block = new_block;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2022ae4a4c1..37c4c09e553 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -215,46 +215,46 @@ static uint innobase_old_blocks_pct;
/* The default values for the following char* start-up parameters
are determined in innobase_init below: */
-static char* innobase_data_home_dir = NULL;
-static char* innobase_data_file_path = NULL;
-static char* innobase_temp_data_file_path = NULL;
-static char* innobase_file_format_name = NULL;
-static char* innobase_change_buffering = NULL;
-static char* innobase_enable_monitor_counter = NULL;
-static char* innobase_disable_monitor_counter = NULL;
-static char* innobase_reset_monitor_counter = NULL;
-static char* innobase_reset_all_monitor_counter = NULL;
+static char* innobase_data_home_dir;
+static char* innobase_data_file_path;
+static char* innobase_temp_data_file_path;
+static char* innobase_file_format_name;
+static char* innobase_change_buffering;
+static char* innobase_enable_monitor_counter;
+static char* innobase_disable_monitor_counter;
+static char* innobase_reset_monitor_counter;
+static char* innobase_reset_all_monitor_counter;
/* The highest file format being used in the database. The value can be
set by user, however, it will be adjusted to the newer file format if
a table of such format is created/opened. */
-char* innobase_file_format_max = NULL;
+char* innobase_file_format_max;
/** Default value of innodb_file_format */
static const char* innodb_file_format_default = "Barracuda";
/** Default value of innodb_file_format_max */
static const char* innodb_file_format_max_default = "Antelope";
-static char* innobase_file_flush_method = NULL;
+static char* innobase_file_flush_method;
/* This variable can be set in the server configure file, specifying
stopword table to be used */
-static char* innobase_server_stopword_table = NULL;
+static char* innobase_server_stopword_table;
/* Below we have boolean-valued start-up parameters, and their default
values */
-static my_bool innobase_file_format_check = TRUE;
-static my_bool innobase_use_atomic_writes = TRUE;
+static my_bool innobase_file_format_check;
+static my_bool innobase_use_atomic_writes;
static my_bool innobase_use_fallocate;
-static my_bool innobase_use_doublewrite = TRUE;
-static my_bool innobase_use_checksums = TRUE;
-static my_bool innobase_locks_unsafe_for_binlog = FALSE;
-static my_bool innobase_rollback_on_timeout = FALSE;
-static my_bool innobase_create_status_file = FALSE;
-my_bool innobase_stats_on_metadata = TRUE;
-static my_bool innobase_large_prefix = FALSE;
-static my_bool innodb_optimize_fulltext_only = FALSE;
+static my_bool innobase_use_doublewrite;
+static my_bool innobase_use_checksums;
+static my_bool innobase_locks_unsafe_for_binlog;
+static my_bool innobase_rollback_on_timeout;
+static my_bool innobase_create_status_file;
+my_bool innobase_stats_on_metadata;
+static my_bool innobase_large_prefix;
+static my_bool innodb_optimize_fulltext_only;
static char* innodb_version_str = (char*) INNODB_VERSION_STR;
@@ -1359,15 +1359,11 @@ void
innobase_commit_concurrency_init_default();
/*=======================================*/
-/** @brief Initialize the default and max value of innodb_undo_logs.
-
-Once InnoDB is running, the default value and the max value of
-innodb_undo_logs must be equal to the available undo logs,
-given by srv_available_undo_logs. */
+/** @brief Adjust some InnoDB startup parameters based on file contents
+or innodb_page_size. */
static
void
-innobase_undo_logs_init_default_max();
-/*==================================*/
+innodb_params_adjust();
/************************************************************//**
Validate the file format name and return its corresponding id.
@@ -2334,7 +2330,8 @@ innobase_get_cset_width(
if (cset != 0) {
sql_print_warning(
- "Unknown collation #%lu.", cset);
+ "Unknown collation #" ULINTPF ".",
+ cset);
}
} else {
@@ -4270,9 +4267,8 @@ innobase_change_buffering_inited_ok:
} else if (srv_max_io_capacity < srv_io_capacity) {
sql_print_warning("InnoDB: innodb_io_capacity"
" cannot be set higher than"
- " innodb_io_capacity_max.\n"
- "InnoDB: Setting"
- " innodb_io_capacity to %lu\n",
+ " innodb_io_capacity_max."
+ "Setting innodb_io_capacity=%lu",
srv_max_io_capacity);
srv_io_capacity = srv_max_io_capacity;
@@ -4293,6 +4289,11 @@ innobase_change_buffering_inited_ok:
if (UNIV_PAGE_SIZE_DEF != srv_page_size) {
ib::info() << "innodb_page_size=" << srv_page_size;
+
+ srv_max_undo_log_size = std::max(
+ srv_max_undo_log_size,
+ ulonglong(SRV_UNDO_TABLESPACE_SIZE_IN_PAGES)
+ * srv_page_size);
}
if (srv_log_write_ahead_size > srv_page_size) {
@@ -4459,12 +4460,6 @@ innobase_change_buffering_inited_ok:
}
*/
- /* Since we in this module access directly the fields of a trx
- struct, and due to different headers and flags it might happen that
- ib_mutex_t has a different size in this module and in InnoDB
- modules, we check at run time that the size is the same in
- these compilation modules. */
-
err = innobase_start_or_create_for_mysql();
if (srv_buf_pool_size_org != 0) {
@@ -4489,9 +4484,8 @@ innobase_change_buffering_inited_ok:
os_thread_sleep(20);
}
- srv_was_started = TRUE;
- /* Adjust the innodb_undo_logs config object */
- innobase_undo_logs_init_default_max();
+ srv_was_started = true;
+ innodb_params_adjust();
innobase_old_blocks_pct = static_cast<uint>(
buf_LRU_old_ratio_update(innobase_old_blocks_pct, TRUE));
@@ -6337,9 +6331,10 @@ innobase_build_index_translation(
if (index_mapping == NULL) {
/* Report an error if index_mapping continues to be
NULL and mysql_num_index is a non-zero value */
- sql_print_error("InnoDB: fail to allocate memory for"
- " index translation table. Number of"
- " Index:%lu, array size:%lu",
+ sql_print_error("InnoDB: fail to allocate memory for "
+ "index translation table. Number of "
+ "Index: " ULINTPF
+ ", array size:" ULINTPF,
mysql_num_index,
share->idx_trans_tbl.array_size);
ret = false;
@@ -6848,9 +6843,9 @@ ha_innobase::open(
if (key_used_on_scan != MAX_KEY) {
sql_print_warning(
- "Table %s key_used_on_scan is %lu even"
- " though there is no primary key inside"
- " InnoDB.", name, (ulong) key_used_on_scan);
+ "Table %s key_used_on_scan is %u even "
+ "though there is no primary key inside "
+ "InnoDB.", name, key_used_on_scan);
}
}
@@ -10478,13 +10473,7 @@ ha_innobase::rnd_init(
bool scan) /*!< in: true if table/index scan FALSE otherwise */
{
TrxInInnoDB trx_in_innodb(m_prebuilt->trx);
-
- if (trx_in_innodb.is_aborted()) {
-
- return(innobase_rollback(ht, m_user_thd, false));
- }
-
- int err;
+ int err;
/* Store the active index value so that we can restore the original
value after a scan */
@@ -11094,7 +11083,8 @@ wsrep_append_foreign_key(
if (rcode != DB_SUCCESS) {
WSREP_ERROR(
- "FK key set failed: %lu (%lu %lu), index: %s %s, %s",
+ "FK key set failed: " ULINTPF
+ " (" ULINTPF " " ULINTPF "), index: %s %s, %s",
rcode, referenced, shared,
(index) ? index->name() : "void index",
(index && index->table) ? index->table->name.m_name :
@@ -11156,8 +11146,9 @@ wsrep_append_foreign_key(
copy);
if (rcode) {
- DBUG_PRINT("wsrep", ("row key failed: %lu", rcode));
- WSREP_ERROR("Appending cascaded fk row key failed: %s, %lu",
+ DBUG_PRINT("wsrep", ("row key failed: " ULINTPF, rcode));
+ WSREP_ERROR("Appending cascaded fk row key failed: %s, "
+ ULINTPF,
(wsrep_thd_query(thd)) ?
wsrep_thd_query(thd) : "void", rcode);
return DB_ERROR;
@@ -11436,13 +11427,7 @@ ha_innobase::position(
len = key_info->key_length;
}
- /* We assume that the 'ref' value len is always fixed for the same
- table. */
-
- if (len != ref_length) {
- sql_print_error("Stored ref len is %lu, but table ref len is"
- " %lu", (ulong) len, (ulong) ref_length);
- }
+ ut_ad(len == ref_length);
}
/*****************************************************************//**
@@ -11778,8 +11763,8 @@ create_table_info_t::create_table_def()
ER_CANT_CREATE_TABLE,
"In InnoDB, charset-collation codes"
" must be below 256."
- " Unsupported code %lu.",
- (ulong) charset_no);
+ " Unsupported code " ULINTPF ".",
+ charset_no);
mem_heap_free(heap);
dict_mem_table_free(table);
@@ -12300,7 +12285,7 @@ create_table_info_t::create_options_are_invalid()
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: invalid KEY_BLOCK_SIZE = %lu."
+ "InnoDB: invalid KEY_BLOCK_SIZE = %u."
" Valid values are [1, 2, 4, 8, 16]",
m_create_info->key_block_size);
ret = "KEY_BLOCK_SIZE";
@@ -12791,7 +12776,7 @@ index_bad:
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ignoring KEY_BLOCK_SIZE=%lu.",
+ "InnoDB: ignoring KEY_BLOCK_SIZE=%u.",
m_create_info->key_block_size);
}
}
@@ -12813,7 +12798,7 @@ index_bad:
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION,
- "InnoDB: ignoring KEY_BLOCK_SIZE=%lu"
+ "InnoDB: ignoring KEY_BLOCK_SIZE=%u"
" unless ROW_FORMAT=COMPRESSED.",
m_create_info->key_block_size);
zip_allowed = false;
@@ -13822,7 +13807,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);
}
@@ -14255,116 +14241,6 @@ ha_innobase::rename_table(
}
/*********************************************************************//**
-Returns the exact number of records that this client can see using this
-handler object.
-@return Error code in case something goes wrong.
-These errors will abort the current query:
- case HA_ERR_LOCK_DEADLOCK:
- case HA_ERR_LOCK_TABLE_FULL:
- case HA_ERR_LOCK_WAIT_TIMEOUT:
- case HA_ERR_QUERY_INTERRUPTED:
-For other error codes, the server will fall back to counting records. */
-
-#ifdef MYSQL_57_SELECT_COUNT_OPTIMIZATION
-int
-ha_innobase::records(
-/*==================*/
- ha_rows* num_rows) /*!< out: number of rows */
-{
- DBUG_ENTER("ha_innobase::records()");
-
- dberr_t ret;
- ulint n_rows = 0; /* Record count in this view */
-
- update_thd();
-
- if (dict_table_is_discarded(m_prebuilt->table)) {
- ib_senderrf(
- m_user_thd,
- IB_LOG_LEVEL_ERROR,
- ER_TABLESPACE_DISCARDED,
- table->s->table_name.str);
-
- *num_rows = HA_POS_ERROR;
- DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
-
- } else if (m_prebuilt->table->ibd_file_missing) {
- ib_senderrf(
- m_user_thd, IB_LOG_LEVEL_ERROR,
- ER_TABLESPACE_MISSING,
- table->s->table_name.str);
-
- *num_rows = HA_POS_ERROR;
- DBUG_RETURN(HA_ERR_TABLESPACE_MISSING);
-
- } else if (m_prebuilt->table->corrupted) {
- ib_errf(m_user_thd, IB_LOG_LEVEL_WARN,
- ER_INNODB_INDEX_CORRUPT,
- "Table '%s' is corrupt.",
- table->s->table_name.str);
-
- *num_rows = HA_POS_ERROR;
- DBUG_RETURN(HA_ERR_INDEX_CORRUPT);
- }
-
- TrxInInnoDB trx_in_innodb(m_prebuilt->trx);
-
- m_prebuilt->trx->op_info = "counting records";
-
- dict_index_t* index = dict_table_get_first_index(m_prebuilt->table);
-
- ut_ad(dict_index_is_clust(index));
-
- m_prebuilt->index_usable = row_merge_is_index_usable(
- m_prebuilt->trx, index);
-
- if (!m_prebuilt->index_usable) {
- *num_rows = HA_POS_ERROR;
- DBUG_RETURN(HA_ERR_TABLE_DEF_CHANGED);
- }
-
- /* (Re)Build the m_prebuilt->mysql_template if it is null to use
- the clustered index and just the key, no off-record data. */
- m_prebuilt->index = index;
- dtuple_set_n_fields(m_prebuilt->search_tuple, 0);
- m_prebuilt->read_just_key = 1;
- build_template(false);
-
- /* Count the records in the clustered index */
- ret = row_scan_index_for_mysql(m_prebuilt, index, false, &n_rows);
- reset_template();
- switch (ret) {
- case DB_SUCCESS:
- break;
- case DB_DEADLOCK:
- case DB_LOCK_TABLE_FULL:
- case DB_LOCK_WAIT_TIMEOUT:
- *num_rows = HA_POS_ERROR;
- DBUG_RETURN(convert_error_code_to_mysql(ret, 0, m_user_thd));
- case DB_INTERRUPTED:
- *num_rows = HA_POS_ERROR;
- DBUG_RETURN(HA_ERR_QUERY_INTERRUPTED);
- default:
- /* No other error besides the three below is returned from
- row_scan_index_for_mysql(). Make a debug catch. */
- *num_rows = HA_POS_ERROR;
- ut_ad(0);
- DBUG_RETURN(-1);
- }
-
- m_prebuilt->trx->op_info = "";
-
- if (thd_killed(m_user_thd)) {
- *num_rows = HA_POS_ERROR;
- DBUG_RETURN(HA_ERR_QUERY_INTERRUPTED);
- }
-
- *num_rows= n_rows;
- DBUG_RETURN(0);
-}
-#endif /* MYSQL_57_SELECT_COUNT_OPTIMIZATION */
-
-/*********************************************************************//**
Estimates the number of index records in a range.
@return estimated number of rows */
@@ -15108,15 +14984,14 @@ ha_innobase::info_low(
if (j + 1 > index->n_uniq) {
sql_print_error(
- "Index %s of %s has %lu columns"
- " unique inside InnoDB, but"
- " MariaDB is asking statistics for"
- " %lu columns. Have you mixed"
- " up .frm files from different"
+ "Index %s of %s has %u columns"
+ " unique inside InnoDB, but "
+ "MySQL is asking statistics for"
+ " %lu columns. Have you mixed "
+ "up .frm files from different "
" installations? %s",
index->name(),
ib_table->name.m_name,
- (unsigned long)
index->n_uniq, j + 1,
TROUBLESHOOTING_MSG);
break;
@@ -15611,7 +15486,7 @@ ha_innobase::check(
ret = row_count_rtree_recs(m_prebuilt, &n_rows);
} else {
ret = row_scan_index_for_mysql(
- m_prebuilt, index, true, &n_rows);
+ m_prebuilt, index, &n_rows);
}
DBUG_EXECUTE_IF(
@@ -15646,11 +15521,9 @@ ha_innobase::check(
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
ER_NOT_KEYFILE,
- "InnoDB: Index '%-.200s' contains %lu"
- " entries, should be %lu.",
- index->name(),
- (ulong) n_rows,
- (ulong) n_rows_in_table);
+ "InnoDB: Index '%-.200s' contains " ULINTPF
+ " entries, should be " ULINTPF ".",
+ index->name(), n_rows, n_rows_in_table);
is_ok = false;
dict_set_corrupted(
index, m_prebuilt->trx,
@@ -15891,6 +15764,28 @@ get_foreign_key_info(
f_key_info.update_method = FK_OPTION_RESTRICT;
}
+ /* Load referenced table to update FK referenced key name. */
+ if (foreign->referenced_table == NULL) {
+
+ dict_table_t* ref_table;
+
+ ut_ad(mutex_own(&dict_sys->mutex));
+ ref_table = dict_table_open_on_name(
+ foreign->referenced_table_name_lookup,
+ TRUE, FALSE, DICT_ERR_IGNORE_NONE);
+
+ if (ref_table == NULL) {
+
+ ib::info() << "Foreign Key referenced table "
+ << foreign->referenced_table_name
+ << " not found for foreign table "
+ << foreign->foreign_table_name;
+ } else {
+
+ dict_table_close(ref_table, TRUE, FALSE);
+ }
+ }
+
if (foreign->referenced_index
&& foreign->referenced_index->name != NULL) {
referenced_key_name = thd_make_lex_string(
@@ -17095,16 +16990,16 @@ innodb_show_rwlock_status(
}
buf1len = ut_snprintf(
- buf1, sizeof buf1, "rwlock: %s:%lu",
+ buf1, sizeof buf1, "rwlock: %s:%u",
innobase_basename(rw_lock->cfile_name),
- static_cast<ulong>(rw_lock->cline));
+ rw_lock->cline);
int buf2len;
char buf2[IO_SIZE];
buf2len = ut_snprintf(
- buf2, sizeof buf2, "waits=%lu",
- static_cast<ulong>(rw_lock->count_os_wait));
+ buf2, sizeof buf2, "waits=%u",
+ rw_lock->count_os_wait);
if (stat_print(thd, innobase_hton_name,
hton_name_len,
@@ -17123,16 +17018,16 @@ innodb_show_rwlock_status(
char buf1[IO_SIZE];
buf1len = ut_snprintf(
- buf1, sizeof buf1, "sum rwlock: %s:%lu",
+ buf1, sizeof buf1, "sum rwlock: %s:%u",
innobase_basename(block_rwlock->cfile_name),
- static_cast<ulong>(block_rwlock->cline));
+ block_rwlock->cline);
int buf2len;
char buf2[IO_SIZE];
buf2len = ut_snprintf(
- buf2, sizeof buf2, "waits=%lu",
- static_cast<ulong>(block_rwlock_oswait_count));
+ buf2, sizeof buf2, "waits=" ULINTPF,
+ block_rwlock_oswait_count);
if (stat_print(thd, innobase_hton_name,
hton_name_len,
@@ -17687,6 +17582,37 @@ ha_innobase::get_auto_increment(
whether we update the table autoinc counter or not. */
ulonglong col_max_value = innobase_get_int_col_max_value(table->next_number_field);
+ /** The following logic is needed to avoid duplicate key error
+ for autoincrement column.
+
+ (1) InnoDB gives the current autoincrement value with respect
+ to increment and offset value.
+
+ (2) Basically it does compute_next_insert_id() logic inside InnoDB
+ to avoid the current auto increment value changed by handler layer.
+
+ (3) It is restricted only for insert operations. */
+
+ if (increment > 1 && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE
+ && autoinc < col_max_value) {
+
+ ulonglong prev_auto_inc = autoinc;
+
+ autoinc = ((autoinc - 1) + increment - offset)/ increment;
+
+ autoinc = autoinc * increment + offset;
+
+ /* If autoinc exceeds the col_max_value then reset
+ to old autoinc value. Because in case of non-strict
+ sql mode, boundary value is not considered as error. */
+
+ if (autoinc >= col_max_value) {
+ autoinc = prev_auto_inc;
+ }
+
+ ut_ad(autoinc > 0);
+ }
+
/* Called for the first time ? */
if (trx->n_autoinc_rows == 0) {
@@ -18792,6 +18718,41 @@ innodb_internal_table_validate(
return(ret);
}
+/****************************************************************//**
+Update global variable "fts_internal_tbl_name" with the "saved"
+stopword table name value. This function is registered as a callback
+with MySQL. */
+static
+void
+innodb_internal_table_update(
+/*=========================*/
+ THD* thd, /*!< in: thread handle */
+ struct st_mysql_sys_var* var, /*!< in: pointer to
+ system variable */
+ void* var_ptr,/*!< out: where the
+ formal string goes */
+ const void* save) /*!< in: immediate result
+ from check function */
+{
+ const char* table_name;
+ char* old;
+
+ ut_a(save != NULL);
+ ut_a(var_ptr != NULL);
+
+ table_name = *static_cast<const char*const*>(save);
+ old = *(char**) var_ptr;
+ *(char**) var_ptr = table_name ? my_strdup(table_name, MYF(0)) : NULL;
+ my_free(old);
+
+ fts_internal_tbl_name2 = *(char**) var_ptr;
+ if (fts_internal_tbl_name2 == NULL) {
+ fts_internal_tbl_name = const_cast<char*>("default");
+ } else {
+ fts_internal_tbl_name = fts_internal_tbl_name2;
+ }
+}
+
#ifdef BTR_CUR_HASH_ADAPT
/****************************************************************//**
Update the system variable innodb_adaptive_hash_index using the "saved"
@@ -20346,9 +20307,9 @@ wsrep_innobase_kill_one_trx(
WSREP_LOG_CONFLICT(bf_thd, thd, TRUE);
- WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: "
- TRX_ID_FMT,
- signal, (long long)bf_seqno,
+ WSREP_DEBUG("BF kill (" ULINTPF ", seqno: " INT64PF
+ "), victim: (%lu) trx: " TRX_ID_FMT,
+ signal, bf_seqno,
thd_get_thread_id(thd),
victim_trx->id);
@@ -20723,6 +20684,12 @@ static MYSQL_SYSVAR_BOOL(use_fallocate, innobase_use_fallocate,
"Use posix_fallocate() to allocate files. DEPRECATED, has no effect.",
NULL, NULL, FALSE);
+static MYSQL_SYSVAR_BOOL(stats_include_delete_marked,
+ srv_stats_include_delete_marked,
+ PLUGIN_VAR_OPCMDARG,
+ "Include delete marked records when calculating persistent statistics",
+ NULL, NULL, FALSE);
+
static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity,
PLUGIN_VAR_RQCMDARG,
"Number of IOPs the server can do. Tunes the background IO rate",
@@ -21231,6 +21198,13 @@ static MYSQL_SYSVAR_ULONG(concurrency_tickets, srv_n_free_tickets_to_enter,
"Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket",
NULL, NULL, 5000L, 1L, ~0UL, 0);
+static MYSQL_SYSVAR_BOOL(deadlock_detect, innobase_deadlock_detect,
+ PLUGIN_VAR_NOCMDARG,
+ "Enable/disable InnoDB deadlock detector (default ON)."
+ " if set to OFF, deadlock detection is skipped,"
+ " and we rely on innodb_lock_wait_timeout in case of deadlock.",
+ NULL, NULL, TRUE);
+
static MYSQL_SYSVAR_LONG(fill_factor, innobase_fill_factor,
PLUGIN_VAR_RQCMDARG,
"Percentage of B-tree page filled during bulk insert",
@@ -21246,11 +21220,11 @@ static MYSQL_SYSVAR_BOOL(disable_sort_file_cache, srv_disable_sort_file_cache,
"Whether to disable OS system file cache for sort I/O",
NULL, NULL, FALSE);
-static MYSQL_SYSVAR_STR(ft_aux_table, fts_internal_tbl_name,
- PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
+static MYSQL_SYSVAR_STR(ft_aux_table, fts_internal_tbl_name2,
+ PLUGIN_VAR_RQCMDARG,
"FTS internal auxiliary table to be checked",
innodb_internal_table_validate,
- NULL, NULL);
+ innodb_internal_table_update, NULL);
static MYSQL_SYSVAR_ULONG(ft_cache_size, fts_max_cache_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
@@ -21418,11 +21392,11 @@ static MYSQL_SYSVAR_STR(undo_directory, srv_undo_dir,
static MYSQL_SYSVAR_ULONG(undo_tablespaces, srv_undo_tablespaces,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "Number of undo tablespaces to use. ",
+ "Number of undo tablespaces to use.",
NULL, NULL,
0L, /* Default seting */
0L, /* Minimum value */
- 95L, 0); /* Maximum value */
+ TRX_SYS_MAX_UNDO_SPACES, 0); /* Maximum value */
static MYSQL_SYSVAR_ULONG(undo_logs, srv_undo_logs,
PLUGIN_VAR_OPCMDARG,
@@ -21434,12 +21408,10 @@ static MYSQL_SYSVAR_ULONG(undo_logs, srv_undo_logs,
static MYSQL_SYSVAR_ULONGLONG(max_undo_log_size, srv_max_undo_log_size,
PLUGIN_VAR_OPCMDARG,
- "Maximum size of UNDO tablespace in MB (If UNDO tablespace grows"
- " beyond this size it will be truncated in due course). ",
+ "Desired maximum UNDO tablespace size in bytes",
NULL, NULL,
- 1024 * 1024 * 1024L,
- 10 * 1024 * 1024L,
- ~0ULL, 0);
+ 10 << 20, 10 << 20,
+ 1ULL << (32 + UNIV_PAGE_SIZE_SHIFT_MAX), 0);
static MYSQL_SYSVAR_ULONG(purge_rseg_truncate_frequency,
srv_purge_rseg_truncate_frequency,
@@ -21912,6 +21884,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(temp_data_file_path),
MYSQL_SYSVAR(data_home_dir),
MYSQL_SYSVAR(doublewrite),
+ MYSQL_SYSVAR(stats_include_delete_marked),
MYSQL_SYSVAR(use_atomic_writes),
MYSQL_SYSVAR(use_fallocate),
MYSQL_SYSVAR(fast_shutdown),
@@ -21939,6 +21912,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(lock_schedule_algorithm),
MYSQL_SYSVAR(locks_unsafe_for_binlog),
MYSQL_SYSVAR(lock_wait_timeout),
+ MYSQL_SYSVAR(deadlock_detect),
MYSQL_SYSVAR(page_size),
MYSQL_SYSVAR(log_buffer_size),
MYSQL_SYSVAR(log_file_size),
@@ -22161,19 +22135,25 @@ innobase_commit_concurrency_init_default()
= innobase_commit_concurrency;
}
-/** @brief Initialize the default and max value of innodb_undo_logs.
-
-Once InnoDB is running, the default value and the max value of
-innodb_undo_logs must be equal to the available undo logs,
-given by srv_available_undo_logs. */
+/** @brief Adjust some InnoDB startup parameters based on file contents
+or innodb_page_size. */
static
void
-innobase_undo_logs_init_default_max()
-/*=================================*/
+innodb_params_adjust()
{
+ /* The default value and the max value of
+ innodb_undo_logs must be equal to the available undo logs. */
MYSQL_SYSVAR_NAME(undo_logs).max_val
= MYSQL_SYSVAR_NAME(undo_logs).def_val
= srv_available_undo_logs;
+ MYSQL_SYSVAR_NAME(max_undo_log_size).max_val
+ = 1ULL << (32 + UNIV_PAGE_SIZE_SHIFT);
+ MYSQL_SYSVAR_NAME(max_undo_log_size).min_val
+ = MYSQL_SYSVAR_NAME(max_undo_log_size).def_val
+ = ulonglong(SRV_UNDO_TABLESPACE_SIZE_IN_PAGES)
+ * srv_page_size;
+ MYSQL_SYSVAR_NAME(max_undo_log_size).max_val
+ = 1ULL << (32 + UNIV_PAGE_SIZE_SHIFT);
}
/****************************************************************************
@@ -22846,7 +22826,8 @@ ib_warn_row_too_big(const dict_table_t* table)
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_TO_BIG_ROW,
- "Row size too large (> %lu). Changing some columns to TEXT"
+ "Row size too large (> " ULINTPF ")."
+ " Changing some columns to TEXT"
" or BLOB %smay help. In current row format, BLOB prefix of"
" %d bytes is stored inline.", free_space
, prefix ? "or using ROW_FORMAT=DYNAMIC or"
@@ -23191,7 +23172,7 @@ ib_push_frm_error(
break;
case DICT_FRM_INCONSISTENT_KEYS:
- sql_print_error("InnoDB: Table %s contains %lu "
+ sql_print_error("InnoDB: Table %s contains " ULINTPF " "
"indexes inside InnoDB, which "
"is different from the number of "
"indexes %u defined in the MariaDB "
@@ -23206,7 +23187,7 @@ ib_push_frm_error(
if (push_warning) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_NO_SUCH_INDEX,
- "InnoDB: Table %s contains %lu "
+ "InnoDB: Table %s contains " ULINTPF " "
"indexes inside InnoDB, which "
"is different from the number of "
"indexes %u defined in the MariaDB ",
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 297b73ed02f..64147291338 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -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) 2013, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -219,9 +219,6 @@ public:
ha_rows estimate_rows_upper_bound();
- // JAN: TODO: MySQL 5.7
- // int records(ha_rows* num_rows);
-
void update_create_info(HA_CREATE_INFO* create_info);
int create(
diff --git a/storage/innobase/handler/ha_innopart.cc b/storage/innobase/handler/ha_innopart.cc
index 7abc1f29b60..1041871805e 100644
--- a/storage/innobase/handler/ha_innopart.cc
+++ b/storage/innobase/handler/ha_innopart.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2016, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -3004,41 +3004,6 @@ ha_innopart::truncate()
DBUG_RETURN(error);
}
-/** Total number of rows in all used partitions.
-Returns the exact number of records that this client can see using this
-handler object.
-@param[out] num_rows Number of rows.
-@return 0 or error number. */
-int
-ha_innopart::records(
- ha_rows* num_rows)
-{
- ha_rows n_rows;
- int err;
- DBUG_ENTER("ha_innopart::records()");
-
- *num_rows = 0;
-
- /* The index scan is probably so expensive, so the overhead
- of the rest of the function is neglectable for each partition.
- So no current reason for optimizing this further. */
-
- for (uint i = m_part_info->get_first_used_partition();
- i < m_tot_parts;
- i = m_part_info->get_next_used_partition(i)) {
-
- set_partition(i);
- err = ha_innobase::records(&n_rows);
- update_partition(i);
- if (err != 0) {
- *num_rows = HA_POS_ERROR;
- DBUG_RETURN(err);
- }
- *num_rows += n_rows;
- }
- DBUG_RETURN(0);
-}
-
/** Estimates the number of index records in a range.
@param[in] keynr Index number.
@param[in] min_key Start key value (or NULL).
diff --git a/storage/innobase/handler/ha_innopart.h b/storage/innobase/handler/ha_innopart.h
index 5f3f8eaa318..67db9e07150 100644
--- a/storage/innobase/handler/ha_innopart.h
+++ b/storage/innobase/handler/ha_innopart.h
@@ -1222,10 +1222,6 @@ protected:
uchar* pos);
int
- records(
- ha_rows* num_rows);
-
- int
index_next(
uchar* record)
{
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index f9791f5fa97..153484c9941 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -400,7 +400,10 @@ innobase_need_rebuild(
const Alter_inplace_info* ha_alter_info,
const TABLE* altered_table)
{
- if (ha_alter_info->handler_flags
+ Alter_inplace_info::HA_ALTER_FLAGS alter_inplace_flags =
+ ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE);
+
+ if (alter_inplace_flags
== Alter_inplace_info::CHANGE_CREATE_OPTION
&& !(ha_alter_info->create_info->used_fields
& (HA_CREATE_USED_ROW_FORMAT
@@ -1293,7 +1296,6 @@ innobase_find_fk_index(
while (index != NULL) {
if (!(index->type & DICT_FTS)
- && !dict_index_has_virtual(index)
&& dict_foreign_qualify_index(
table, col_names, columns, n_cols,
index, NULL, true, 0,
@@ -2466,6 +2468,7 @@ innobase_fts_check_doc_id_index_in_def(
return(FTS_NOT_EXIST_DOC_ID_INDEX);
}
+
/*******************************************************************//**
Create an index table where indexes are ordered as follows:
@@ -2534,35 +2537,16 @@ innobase_create_key_defs(
(only prefix/part of the column is indexed), MySQL will treat the
index as a PRIMARY KEY unless the table already has one. */
- if (n_add > 0 && !new_primary && got_default_clust
- && (key_info[*add].flags & HA_NOSAME)
- && !(key_info[*add].flags & HA_KEY_HAS_PART_KEY_SEG)) {
- uint key_part = key_info[*add].user_defined_key_parts;
-
- new_primary = true;
-
- while (key_part--) {
- const uint maybe_null
- = key_info[*add].key_part[key_part].key_type
- & FIELDFLAG_MAYBE_NULL;
- bool is_v
- = innobase_is_v_fld(
- key_info[*add].key_part[key_part].field);
- DBUG_ASSERT(!maybe_null
- == !key_info[*add].key_part[key_part].
- field->real_maybe_null());
-
- if (maybe_null || is_v) {
- new_primary = false;
- break;
- }
- }
+ ut_ad(altered_table->s->primary_key == 0
+ || altered_table->s->primary_key == MAX_KEY);
+
+ if (got_default_clust && !new_primary) {
+ new_primary = (altered_table->s->primary_key != MAX_KEY);
}
const bool rebuild = new_primary || add_fts_doc_id
|| innobase_need_rebuild(ha_alter_info, table);
-
/* Reserve one more space if new_primary is true, and we might
need to add the FTS_DOC_ID_INDEX */
indexdef = indexdefs = static_cast<index_def_t*>(
@@ -2576,8 +2560,14 @@ innobase_create_key_defs(
ulint primary_key_number;
if (new_primary) {
- DBUG_ASSERT(n_add > 0);
- primary_key_number = *add;
+ if (n_add == 0) {
+ DBUG_ASSERT(got_default_clust);
+ DBUG_ASSERT(altered_table->s->primary_key
+ == 0);
+ primary_key_number = 0;
+ } else {
+ primary_key_number = *add;
+ }
} else if (got_default_clust) {
/* Create the GEN_CLUST_INDEX */
index_def_t* index = indexdef++;
@@ -4782,6 +4772,8 @@ new_clustered_failed:
ctx->add_cols = add_cols;
} else {
DBUG_ASSERT(!innobase_need_rebuild(ha_alter_info, old_table));
+ DBUG_ASSERT(old_table->s->primary_key
+ == altered_table->s->primary_key);
for (dict_index_t* index
= dict_table_get_first_index(user_table);
@@ -6082,7 +6074,7 @@ err_exit:
}
if (!(ha_alter_info->handler_flags & INNOBASE_ALTER_DATA)
- || (ha_alter_info->handler_flags
+ || ((ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)
== Alter_inplace_info::CHANGE_CREATE_OPTION
&& !innobase_need_rebuild(ha_alter_info, table))) {
@@ -6306,6 +6298,26 @@ alter_templ_needs_rebuild(
return(false);
}
+/** Get the name of an erroneous key.
+@param[in] error_key_num InnoDB number of the erroneus key
+@param[in] ha_alter_info changes that were being performed
+@param[in] table InnoDB table
+@return the name of the erroneous key */
+static
+const char*
+get_error_key_name(
+ ulint error_key_num,
+ const Alter_inplace_info* ha_alter_info,
+ const dict_table_t* table)
+{
+ if (error_key_num == ULINT_UNDEFINED) {
+ return(FTS_DOC_ID_INDEX_NAME);
+ } else if (ha_alter_info->key_count == 0) {
+ return(dict_table_get_first_index(table)->name);
+ } else {
+ return(ha_alter_info->key_info_buffer[error_key_num].name);
+ }
+}
/** Alter the table structure in-place with operations
specified using Alter_inplace_info.
@@ -6346,7 +6358,7 @@ ok_exit:
DBUG_RETURN(false);
}
- if (ha_alter_info->handler_flags
+ if ((ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)
== Alter_inplace_info::CHANGE_CREATE_OPTION
&& !innobase_need_rebuild(ha_alter_info, table)) {
goto ok_exit;
@@ -6443,15 +6455,6 @@ ok_exit:
ctx->add_autoinc, ctx->sequence, ctx->skip_pk_sort,
ctx->m_stage, add_v, eval_table);
- if (s_templ) {
- ut_ad(ctx->need_rebuild() || ctx->num_to_add_vcol > 0
- || rebuild_templ);
- dict_free_vc_templ(s_templ);
- UT_DELETE(s_templ);
-
- ctx->new_table->vc_templ = old_templ;
- }
-
#ifndef DBUG_OFF
oom:
#endif /* !DBUG_OFF */
@@ -6467,6 +6470,15 @@ oom:
onlineddl_rowlog_pct_used = 0;
onlineddl_pct_progress = 0;
+ if (s_templ) {
+ ut_ad(ctx->need_rebuild() || ctx->num_to_add_vcol > 0
+ || rebuild_templ);
+ dict_free_vc_templ(s_templ);
+ UT_DELETE(s_templ);
+
+ ctx->new_table->vc_templ = old_templ;
+ }
+
DEBUG_SYNC_C("inplace_after_index_build");
DBUG_EXECUTE_IF("create_index_fail",
@@ -6506,17 +6518,13 @@ oom:
case DB_ONLINE_LOG_TOO_BIG:
DBUG_ASSERT(ctx->online);
my_error(ER_INNODB_ONLINE_LOG_TOO_BIG, MYF(0),
- (m_prebuilt->trx->error_key_num == ULINT_UNDEFINED)
- ? FTS_DOC_ID_INDEX_NAME
- : ha_alter_info->key_info_buffer[
- m_prebuilt->trx->error_key_num].name);
+ get_error_key_name(m_prebuilt->trx->error_key_num,
+ ha_alter_info, m_prebuilt->table));
break;
case DB_INDEX_CORRUPT:
my_error(ER_INDEX_CORRUPT, MYF(0),
- (m_prebuilt->trx->error_key_num == ULINT_UNDEFINED)
- ? FTS_DOC_ID_INDEX_NAME
- : ha_alter_info->key_info_buffer[
- m_prebuilt->trx->error_key_num].name);
+ get_error_key_name(m_prebuilt->trx->error_key_num,
+ ha_alter_info, m_prebuilt->table));
break;
case DB_DECRYPTION_FAILED: {
String str;
@@ -7724,11 +7732,31 @@ commit_try_rebuild(
if (ctx->online) {
DEBUG_SYNC_C("row_log_table_apply2_before");
+ dict_vcol_templ_t* s_templ = NULL;
+
+ if (ctx->new_table->n_v_cols > 0) {
+ s_templ = UT_NEW_NOKEY(
+ dict_vcol_templ_t());
+ s_templ->vtempl = NULL;
+
+ innobase_build_v_templ(
+ altered_table, ctx->new_table, s_templ,
+ NULL, true);
+ ctx->new_table->vc_templ = s_templ;
+ }
+
error = row_log_table_apply(
ctx->thr, user_table, altered_table,
static_cast<ha_innobase_inplace_ctx*>(
ha_alter_info->handler_ctx)->m_stage);
+ if (s_templ) {
+ ut_ad(ctx->need_rebuild());
+ dict_free_vc_templ(s_templ);
+ UT_DELETE(s_templ);
+ ctx->new_table->vc_templ = NULL;
+ }
+
ulint err_key = thr_get_trx(ctx->thr)->error_key_num;
switch (error) {
@@ -7750,14 +7778,13 @@ commit_try_rebuild(
DBUG_RETURN(true);
case DB_ONLINE_LOG_TOO_BIG:
my_error(ER_INNODB_ONLINE_LOG_TOO_BIG, MYF(0),
- ha_alter_info->key_info_buffer[0].name);
+ get_error_key_name(err_key, ha_alter_info,
+ rebuilt_table));
DBUG_RETURN(true);
case DB_INDEX_CORRUPT:
my_error(ER_INDEX_CORRUPT, MYF(0),
- (err_key == ULINT_UNDEFINED)
- ? FTS_DOC_ID_INDEX_NAME
- : ha_alter_info->key_info_buffer[err_key]
- .name);
+ get_error_key_name(err_key, ha_alter_info,
+ rebuilt_table));
DBUG_RETURN(true);
default:
my_error_innodb(error, table_name, user_table->flags);
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 6bf16573efd..3d764ef6e7a 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -3955,6 +3955,8 @@ i_s_fts_config_fill(
DBUG_RETURN(0);
}
+ DEBUG_SYNC_C("i_s_fts_config_fille_check");
+
fields = table->field;
/* Prevent DDL to drop fts aux tables. */
@@ -5147,6 +5149,10 @@ i_s_innodb_buffer_page_get_info(
block = reinterpret_cast<const buf_block_t*>(bpage);
frame = block->frame;
#ifdef BTR_CUR_HASH_ADAPT
+ /* Note: this may be a false positive, that
+ is, block->index will not always be set to
+ NULL when the last adaptive hash index
+ reference is dropped. */
page_info->hashed = (block->index != NULL);
#endif /* BTR_CUR_HASH_ADAPT */
} else {
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 2fde0cb23b9..c7ffecd00c1 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -1472,8 +1472,8 @@ ibuf_print_ops(
ut_a(UT_ARR_SIZE(op_names) == IBUF_OP_COUNT);
for (i = 0; i < IBUF_OP_COUNT; i++) {
- fprintf(file, "%s %lu%s", op_names[i],
- (ulong) ops[i], (i < (IBUF_OP_COUNT - 1)) ? ", " : "");
+ fprintf(file, "%s " ULINTPF "%s", op_names[i],
+ ops[i], (i < (IBUF_OP_COUNT - 1)) ? ", " : "");
}
putc('\n', file);
@@ -3953,7 +3953,11 @@ ibuf_insert_to_index_page(
ut_ad(ibuf_inside(mtr));
ut_ad(dtuple_check_typed(entry));
#ifdef BTR_CUR_HASH_ADAPT
+ /* A change buffer merge must occur before users are granted
+ any access to the page. No adaptive hash index entries may
+ point to a freshly read page. */
ut_ad(!block->index);
+ assert_block_ahi_empty(block);
#endif /* BTR_CUR_HASH_ADAPT */
ut_ad(mtr->is_named_space(block->page.id.space()));
@@ -4928,12 +4932,12 @@ ibuf_print(
mutex_enter(&ibuf_mutex);
fprintf(file,
- "Ibuf: size %lu, free list len %lu,"
- " seg size %lu, %lu merges\n",
- (ulong) ibuf->size,
- (ulong) ibuf->free_list_len,
- (ulong) ibuf->seg_size,
- (ulong) ibuf->n_merges);
+ "Ibuf: size " ULINTPF ", free list len " ULINTPF ","
+ " seg size " ULINTPF ", " ULINTPF " merges\n",
+ ibuf->size,
+ ibuf->free_list_len,
+ ibuf->seg_size,
+ ibuf->n_merges);
fputs("merged operations:\n ", file);
ibuf_print_ops(ibuf->n_merged_ops, file);
@@ -4948,9 +4952,10 @@ ibuf_print(
if (count > 0) {
fprintf(stderr,
- "Ibuf count for space/page %lu/%lu"
- " is %lu\n",
- (ulong) i, (ulong) j, (ulong) count);
+ "Ibuf count for page "
+ ULINTPF ":" ULINTPF ""
+ " is " ULINTPF "\n",
+ i, j, count);
}
}
}
diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h
index 8887a3f81ad..fad0dac93c4 100644
--- a/storage/innobase/include/btr0sea.h
+++ b/storage/innobase/include/btr0sea.h
@@ -247,6 +247,8 @@ btr_get_search_table(const dict_index_t* index);
# define btr_search_drop_page_hash_index(block)
# define btr_search_s_lock(index)
# define btr_search_s_unlock(index)
+# define btr_search_s_lock_all(index)
+# define btr_search_s_unlock_all(index)
# define btr_search_x_lock(index)
# define btr_search_x_unlock(index)
# define btr_search_info_update(index, cursor)
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 3aab242606d..7dee52d8f74 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -769,10 +769,6 @@ buf_block_unfix(
@param[in] read_buf database page
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
-@param[in] page_no page number of given read_buf
-@param[in] is_log_enabled true if log option is enabled
-@param[in] log_file file pointer to log_file
-@param[in] curr_algo current checksum algorithm
@param[in] use_legacy_big_endian use legacy big endian algorithm
@return true if the page is in crc32 checksum format. */
bool
@@ -780,12 +776,6 @@ buf_page_is_checksum_valid_crc32(
const byte* read_buf,
ulint checksum_field1,
ulint checksum_field2,
-#ifdef UNIV_INNOCHECKSUM
- uintmax_t page_no,
- bool is_log_enabled,
- FILE* log_file,
- const srv_checksum_algorithm_t curr_algo,
-#endif /* UNIV_INNOCHECKSUM */
bool use_legacy_big_endian)
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
@@ -793,59 +783,26 @@ buf_page_is_checksum_valid_crc32(
@param[in] read_buf database page
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
-@param[in] page_no page number of given read_buf
-@param[in] is_log_enabled true if log option is enabled
-@param[in] log_file file pointer to log_file
-@param[in] curr_algo current checksum algorithm
@return true if the page is in innodb checksum format. */
bool
buf_page_is_checksum_valid_innodb(
const byte* read_buf,
ulint checksum_field1,
- ulint checksum_field2
-#ifdef UNIV_INNOCHECKSUM
- ,uintmax_t page_no,
- bool is_log_enabled,
- FILE* log_file,
- const srv_checksum_algorithm_t curr_algo
-#endif /* UNIV_INNOCHECKSUM */
- )
+ ulint checksum_field2)
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
/** Checks if the page is in none checksum format.
@param[in] read_buf database page
@param[in] checksum_field1 new checksum field
@param[in] checksum_field2 old checksum field
-@param[in] page_no page number of given read_buf
-@param[in] is_log_enabled true if log option is enabled
-@param[in] log_file file pointer to log_file
-@param[in] curr_algo current checksum algorithm
@return true if the page is in none checksum format. */
bool
buf_page_is_checksum_valid_none(
const byte* read_buf,
ulint checksum_field1,
- ulint checksum_field2
-#ifdef UNIV_INNOCHECKSUM
- ,uintmax_t page_no,
- bool is_log_enabled,
- FILE* log_file,
- const srv_checksum_algorithm_t curr_algo
-#endif /* UNIV_INNOCHECKSUM */
- )
+ ulint checksum_field2)
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
-/********************************************************************//**
-Check if page is maybe compressed, encrypted or both when we encounter
-corrupted page. Note that we can't be 100% sure if page is corrupted
-or decrypt/decompress just failed.
-@param[in] bpage Page
-@return true if page corrupted, false if not */
-bool
-buf_page_check_corrupt(
- buf_page_t* bpage) /*!< in/out: buffer page read from disk */
- MY_ATTRIBUTE((nonnull, warn_unused_result));
-
/** Checks if a page contains only zeroes.
@param[in] read_buf database page
@param[in] page_size page size
@@ -861,10 +818,6 @@ the LSN
@param[in] read_buf database page
@param[in] page_size page size
@param[in] space tablespace
-@param[in] page_no page number of given read_buf
-@param[in] strict_check true if strict-check option is enabled
-@param[in] is_log_enabled true if log option is enabled
-@param[in] log_file file pointer to log_file
@return whether the page is corrupted */
bool
buf_page_is_corrupted(
@@ -872,12 +825,6 @@ buf_page_is_corrupted(
const byte* read_buf,
const page_size_t& page_size,
const fil_space_t* space = NULL
-#ifdef UNIV_INNOCHECKSUM
- ,uintmax_t page_no = 0,
- bool strict_check = false,
- bool is_log_enabled = false,
- FILE* log_file = NULL
-#endif /* UNIV_INNOCHECKSUM */
) MY_ATTRIBUTE((warn_unused_result));
#ifndef UNIV_INNOCHECKSUM
/**********************************************************************//**
@@ -1544,17 +1491,19 @@ buf_flush_update_zip_checksum(
ulint size,
lsn_t lsn);
-/********************************************************************//**
-The hook that is called just before a page is written to disk.
-The function encrypts the content of the page and returns a pointer
-to a frame that will be written instead of the real frame. */
+/** Encryption and page_compression hook that is called just before
+a page is written to disk.
+@param[in,out] space tablespace
+@param[in,out] bpage buffer page
+@param[in] src_frame physical page frame that is being encrypted
+@return page frame to be written to file
+(may be src_frame or an encrypted/compressed copy of it) */
UNIV_INTERN
byte*
buf_page_encrypt_before_write(
-/*==========================*/
- buf_page_t* page, /*!< in/out: buffer page to be flushed */
- byte* frame, /*!< in: src frame */
- ulint space_id); /*!< in: space id */
+ fil_space_t* space,
+ buf_page_t* bpage,
+ byte* src_frame);
/** @brief The temporary memory structure.
@@ -1834,23 +1783,58 @@ struct buf_block_t{
/* @} */
/** @name Hash search fields
- These 5 fields may only be modified when we have
- an x-latch on search system AND
- - we are holding an s-latch or x-latch on buf_block_t::lock or
- - we know that buf_block_t::buf_fix_count == 0.
+ These 5 fields may only be modified when:
+ we are holding the appropriate x-latch in btr_search_latches[], and
+ one of the following holds:
+ (1) the block state is BUF_BLOCK_FILE_PAGE, and
+ we are holding an s-latch or x-latch on buf_block_t::lock, or
+ (2) buf_block_t::buf_fix_count == 0, or
+ (3) the block state is BUF_BLOCK_REMOVE_HASH.
An exception to this is when we init or create a page
in the buffer pool in buf0buf.cc.
- Another exception is that assigning block->index = NULL
- is allowed whenever holding an x-latch on search system. */
+ Another exception for buf_pool_clear_hash_index() is that
+ assigning block->index = NULL (and block->n_pointers = 0)
+ is allowed whenever btr_search_own_all(RW_LOCK_X).
+
+ Another exception is that ha_insert_for_fold_func() may
+ decrement n_pointers without holding the appropriate latch
+ in btr_search_latches[]. Thus, n_pointers must be
+ protected by atomic memory access.
+
+ This implies that the fields may be read without race
+ condition whenever any of the following hold:
+ - the btr_search_latches[] s-latch or x-latch is being held, or
+ - the block state is not BUF_BLOCK_FILE_PAGE or BUF_BLOCK_REMOVE_HASH,
+ and holding some latch prevents the state from changing to that.
+
+ Some use of assert_block_ahi_empty() or assert_block_ahi_valid()
+ is prone to race conditions while buf_pool_clear_hash_index() is
+ executing (the adaptive hash index is being disabled). Such use
+ is explicitly commented. */
/* @{ */
# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
ulint n_pointers; /*!< used in debugging: the number of
pointers in the adaptive hash index
- pointing to this frame */
+ pointing to this frame;
+ protected by atomic memory access
+ or btr_search_own_all(). */
+# define assert_block_ahi_empty(block) \
+ ut_a(my_atomic_addlint(&(block)->n_pointers, 0) == 0)
+# define assert_block_ahi_empty_on_init(block) do { \
+ UNIV_MEM_VALID(&(block)->n_pointers, sizeof (block)->n_pointers); \
+ assert_block_ahi_empty(block); \
+} while (0)
+# define assert_block_ahi_valid(block) \
+ ut_a((block)->index \
+ || my_atomic_addlint(&(block)->n_pointers, 0) == 0)
+# else /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+# define assert_block_ahi_empty(block) /* nothing */
+# define assert_block_ahi_empty_on_init(block) /* nothing */
+# define assert_block_ahi_valid(block) /* nothing */
# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
unsigned curr_n_fields:10;/*!< prefix length for hash indexing:
number of full fields */
@@ -1866,11 +1850,15 @@ struct buf_block_t{
complete, though: there may
have been hash collisions,
record deletions, etc. */
+ /* @} */
+#else /* BTR_CUR_HASH_ADAPT */
+# define assert_block_ahi_empty(block) /* nothing */
+# define assert_block_ahi_empty_on_init(block) /* nothing */
+# define assert_block_ahi_valid(block) /* nothing */
#endif /* BTR_CUR_HASH_ADAPT */
bool skip_flush_check;
/*!< Skip check in buf_dblwr_check_block
during bulk load, protected by lock.*/
- /* @} */
# ifdef UNIV_DEBUG
/** @name Debug fields */
/* @{ */
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 429c7fd3ba6..f22dcc48a01 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -920,6 +920,7 @@ buf_block_modify_clock_inc(
RW_LOCK_FLAG_X | RW_LOCK_FLAG_SX));
}
#endif /* UNIV_DEBUG */
+ assert_block_ahi_valid(block);
block->modify_clock++;
}
diff --git a/storage/innobase/include/buf0dblwr.h b/storage/innobase/include/buf0dblwr.h
index bf2bf6ab32b..e1ecb6baf56 100644
--- a/storage/innobase/include/buf0dblwr.h
+++ b/storage/innobase/include/buf0dblwr.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -44,8 +44,7 @@ doublewrite buffer is placed on the trx system header page.
@return true if successful, false if not. */
MY_ATTRIBUTE((warn_unused_result))
bool
-buf_dblwr_create(void);
-/*==================*/
+buf_dblwr_create();
/****************************************************************//**
At a database startup initializes the doublewrite buffer memory structure if
@@ -61,13 +60,13 @@ buf_dblwr_init_or_load_pages(
/** Process and remove the double write buffer pages for all tablespaces. */
void
-buf_dblwr_process(void);
+buf_dblwr_process();
/****************************************************************//**
frees doublewrite buffer. */
void
-buf_dblwr_free(void);
-/*================*/
+buf_dblwr_free();
+
/********************************************************************//**
Updates the doublewrite buffer when an IO request is completed. */
void
@@ -105,8 +104,8 @@ important to call this function after a batch of writes has been posted,
and also when we may have to wait for a page latch! Otherwise a deadlock
of threads can occur. */
void
-buf_dblwr_flush_buffered_writes(void);
-/*=================================*/
+buf_dblwr_flush_buffered_writes();
+
/********************************************************************//**
Writes a page to the doublewrite buffer on disk, sync it, then write
the page to the datafile and sync the datafile. This function is used
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index 580118f2fdd..8849be1206d 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -393,13 +393,9 @@ dict_index_is_sec_or_ibuf(
/*======================*/
const dict_index_t* index) /*!< in: index */
{
- ulint type;
-
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
- type = index->type;
-
- return(!(type & DICT_CLUSTERED) || (type & DICT_IBUF));
+ return((index->type & (DICT_CLUSTERED | DICT_IBUF)) != DICT_CLUSTERED);
}
/********************************************************************//**
@@ -797,7 +793,8 @@ dict_sys_tables_type_validate(
} else if (zip_ssize) {
/* Antelope does not support COMPRESSED format. */
ib::error()
- << "SYS_TABLES::TYPE=" << type << "zip_ssize:" << zip_ssize;
+ << "SYS_TABLES::TYPE=" << type
+ << ", zip_ssize:" << zip_ssize;
return(ULINT_UNDEFINED);
}
@@ -809,16 +806,16 @@ dict_sys_tables_type_validate(
low_order_bit and DICT_N_COLS_COMPACT flags. */
if (!atomic_blobs) {
ib::error() << "SYS_TABLES::TYPE=" << type
- << " zip_ssize:" << zip_ssize
- << " atomic_blobs:" << atomic_blobs;
+ << ", zip_ssize:" << zip_ssize
+ << ", atomic_blobs:" << atomic_blobs;
return(ULINT_UNDEFINED);
}
/* Validate that the number is within allowed range. */
if (zip_ssize > PAGE_ZIP_SSIZE_MAX) {
ib::error() << "SYS_TABLES::TYPE=" << type
- << " zip_ssize:" << zip_ssize
- << " max:" << PAGE_ZIP_SSIZE_MAX;
+ << ", zip_ssize:" << zip_ssize
+ << " > " << PAGE_ZIP_SSIZE_MAX;
return(ULINT_UNDEFINED);
}
}
diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h
index 831d61445d8..ca65df21402 100644
--- a/storage/innobase/include/fil0crypt.h
+++ b/storage/innobase/include/fil0crypt.h
@@ -116,10 +116,10 @@ struct fil_space_crypt_t : st_encryption_scheme
min_key_version(new_min_key_version),
page0_offset(0),
encryption(new_encryption),
- key_found(),
+ mutex(),
+ key_found(new_min_key_version),
rotate_state()
{
- key_found = new_min_key_version;
key_id = new_key_id;
my_random_bytes(iv, sizeof(iv));
mutex_create(LATCH_ID_FIL_CRYPT_DATA_MUTEX, &mutex);
@@ -492,10 +492,6 @@ bool
fil_space_verify_crypt_checksum(
byte* page,
const page_size_t& page_size,
-#ifdef UNIV_INNOCHECKSUM
- bool strict_check, /*!< --strict-check */
- FILE* log_file, /*!< --log */
-#endif /* UNIV_INNOCHECKSUM */
ulint space,
ulint offset)
MY_ATTRIBUTE((warn_unused_result));
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index e63550f26ff..cef5b578a4a 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -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) 2013, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -142,14 +142,21 @@ struct fil_space_t {
ulint n_pending_flushes; /*!< this is positive when flushing
the tablespace to disk; dropping of the
tablespace is forbidden if this is positive */
- ulint n_pending_ops;/*!< this is positive when we
- have pending operations against this
- tablespace. The pending operations can
- be ibuf merges or lock validation code
- trying to read a block.
- Dropping of the tablespace is forbidden
- if this is positive.
- Protected by fil_system->mutex. */
+ /** Number of pending buffer pool operations accessing the tablespace
+ without holding a table lock or dict_operation_lock S-latch
+ that would prevent the table (and tablespace) from being
+ dropped. An example is change buffer merge.
+ The tablespace cannot be dropped while this is nonzero,
+ or while fil_node_t::n_pending is nonzero.
+ Protected by fil_system->mutex. */
+ ulint n_pending_ops;
+ /** Number of pending block read or write operations
+ (when a write is imminent or a read has recently completed).
+ The tablespace object cannot be freed while this is nonzero,
+ but it can be detached from fil_system.
+ Note that fil_node_t::n_pending tracks actual pending I/O requests.
+ Protected by fil_system->mutex. */
+ ulint n_pending_ios;
hash_node_t hash; /*!< hash chain node */
hash_node_t name_hash;/*!< hash chain the name_hash table */
rw_lock_t latch; /*!< latch protecting the file space storage
@@ -552,15 +559,6 @@ void
fil_space_set_imported(
ulint id);
-#ifdef UNIV_DEBUG
-/** Determine if a tablespace is temporary.
-@param[in] id tablespace identifier
-@return whether it is a temporary tablespace */
-bool
-fsp_is_temporary(ulint id)
-MY_ATTRIBUTE((warn_unused_result, pure));
-#endif /* UNIV_DEBUG */
-
/** Append a file to the chain of files of a space.
@param[in] name file name of a file that is not open
@param[in] size file size in entire database blocks
@@ -735,12 +733,10 @@ MY_ATTRIBUTE((warn_unused_result));
Used by background threads that do not necessarily hold proper locks
for concurrency control.
@param[in] id tablespace ID
-@param[in] for_io whether to look up the tablespace while performing I/O
- (possibly executing TRUNCATE)
@return the tablespace
@retval NULL if missing or being deleted or truncated */
fil_space_t*
-fil_space_acquire(ulint id, bool for_io = false)
+fil_space_acquire(ulint id)
MY_ATTRIBUTE((warn_unused_result));
/** Acquire a tablespace that may not exist.
@@ -758,6 +754,19 @@ fil_space_acquire_silent(ulint id)
void
fil_space_release(fil_space_t* space);
+/** Acquire a tablespace for reading or writing a block,
+when it could be dropped concurrently.
+@param[in] id tablespace ID
+@return the tablespace
+@retval NULL if missing */
+fil_space_t*
+fil_space_acquire_for_io(ulint id);
+
+/** Release a tablespace acquired with fil_space_acquire_for_io().
+@param[in,out] space tablespace to release */
+void
+fil_space_release_for_io(fil_space_t* space);
+
/** Return the next fil_space_t.
Once started, the caller must keep calling this until it returns NULL.
fil_space_acquire() and fil_space_release() are invoked here which
@@ -794,12 +803,9 @@ public:
/** Constructor: Look up the tablespace and increment the
reference count if found.
- @param[in] space_id tablespace ID
- @param[in] for_io whether to look up the tablespace
- while performing I/O
- (possibly executing TRUNCATE) */
- explicit FilSpace(ulint space_id, bool for_io = false)
- : m_space(fil_space_acquire(space_id, for_io)) {}
+ @param[in] space_id tablespace ID */
+ explicit FilSpace(ulint space_id)
+ : m_space(fil_space_acquire(space_id)) {}
/** Assignment operator: This assumes that fil_space_acquire()
has already been done for the fil_space_t. The caller must
@@ -892,6 +898,17 @@ fil_op_replay_rename(
const char* new_name)
MY_ATTRIBUTE((warn_unused_result));
+/** Determine whether a table can be accessed in operations that are
+not (necessarily) protected by meta-data locks.
+(Rollback would generally be protected, but rollback of
+FOREIGN KEY CASCADE/SET NULL is not protected by meta-data locks
+but only by InnoDB table locks, which may be broken by TRUNCATE TABLE.)
+@param[in] table persistent table
+checked @return whether the table is accessible */
+bool
+fil_table_accessible(const dict_table_t* table)
+ MY_ATTRIBUTE((warn_unused_result, nonnull));
+
/** Deletes an IBD tablespace, either general or single-table.
The tablespace must be cached in the memory cache. This will delete the
datafile, fil_space_t & fil_node_t entries from the file_system_t cache.
@@ -923,14 +940,18 @@ dberr_t
fil_prepare_for_truncate(
/*=====================*/
ulint id); /*!< in: space id */
-/**********************************************************************//**
-Reinitialize the original tablespace header with the same space id
-for single tablespace */
+
+/** Reinitialize the original tablespace header with the same space id
+for single tablespace
+@param[in] id space id of the tablespace
+@param[in] size size in blocks
+@param[in] trx Transaction covering truncate */
void
fil_reinit_space_header(
-/*====================*/
- ulint id, /*!< in: space id */
- ulint size); /*!< in: size in blocks */
+ ulint id,
+ ulint size,
+ trx_t* trx);
+
/*******************************************************************//**
Closes a single-table tablespace. The tablespace must be cached in the
memory cache. Free all pages used by the tablespace.
@@ -1216,6 +1237,11 @@ fil_flush(
/*======*/
ulint space_id); /*!< in: file space id (this can be a group of
log files or a tablespace of the database) */
+/** Flush a tablespace.
+@param[in,out] space tablespace to flush */
+void
+fil_flush(fil_space_t* space);
+
/** Flush to disk the writes in file spaces of the given type
possibly cached by the OS.
@param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_LOG */
@@ -1474,7 +1500,7 @@ fil_mtr_rename_log(
const dict_table_t* new_table,
const char* tmp_name,
mtr_t* mtr)
- MY_ATTRIBUTE((warn_unused_result));
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/** Acquire the fil_system mutex. */
#define fil_system_enter() mutex_enter(&fil_system->mutex)
@@ -1581,35 +1607,13 @@ fil_names_clear(
void test_make_filepath();
#endif /* UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH */
-
-/*******************************************************************//**
-Returns the block size of the file space
-@param[in] space_id space id
-@param[in] offset page offset
-@param[in] len page len
+/** Determine the block size of the data file.
+@param[in] space tablespace
+@param[in] offset page number
@return block size */
UNIV_INTERN
ulint
-fil_space_get_block_size(
- ulint id,
- os_offset_t offset,
- ulint len);
-/*******************************************************************//**
-Increments the count of pending operation, if space is not being deleted.
-@return TRUE if being deleted, and operation should be skipped */
-UNIV_INTERN
-ibool
-fil_inc_pending_ops(
-/*================*/
- ulint id, /*!< in: space id */
- ibool print_err); /*!< in: need to print error or not */
-/*******************************************************************//**
-Decrements the count of pending operations. */
-UNIV_INTERN
-void
-fil_decr_pending_ops(
-/*=================*/
- ulint id); /*!< in: space id */
+fil_space_get_block_size(const fil_space_t* space, unsigned offset);
#include "fil0fil.ic"
#endif /* UNIV_INNOCHECKSUM */
diff --git a/storage/innobase/include/fil0fil.ic b/storage/innobase/include/fil0fil.ic
index 01fa1093e5e..e3d4fd4d88b 100644
--- a/storage/innobase/include/fil0fil.ic
+++ b/storage/innobase/include/fil0fil.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2015, 2017 MariaDB Corporation.
+Copyright (c) 2015, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -27,28 +27,6 @@ Created 31/03/2015 Jan Lindström
#define fil0fil_ic
/*******************************************************************//**
-Return space name */
-UNIV_INLINE
-char*
-fil_space_name(
-/*===========*/
- fil_space_t* space) /*!< in: space */
-{
- return (space->name);
-}
-
-/*******************************************************************//**
-Return space flags */
-UNIV_INLINE
-ulint
-fil_space_flags(
-/*===========*/
- fil_space_t* space) /*!< in: space */
-{
- return (space->flags);
-}
-
-/*******************************************************************//**
Return page type name */
UNIV_INLINE
const char*
diff --git a/storage/innobase/include/fil0pagecompress.h b/storage/innobase/include/fil0pagecompress.h
index 0bf6aa75f19..cd754151d80 100644
--- a/storage/innobase/include/fil0pagecompress.h
+++ b/storage/innobase/include/fil0pagecompress.h
@@ -30,34 +30,6 @@ atomic writes information to table space.
Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com
***********************************************************************/
-/*******************************************************************//**
-Returns the page compression level flag of the space, or 0 if the space
-is not compressed. The tablespace must be cached in the memory cache.
-@return page compression level if page compressed, ULINT_UNDEFINED if space not found */
-UNIV_INLINE
-ulint
-fil_space_get_page_compression_level(
-/*=================================*/
- ulint id); /*!< in: space id */
-/*******************************************************************//**
-Returns the page compression flag of the space, or false if the space
-is not compressed. The tablespace must be cached in the memory cache.
-@return true if page compressed, false if not or space not found */
-UNIV_INLINE
-bool
-fil_space_is_page_compressed(
-/*=========================*/
- ulint id); /*!< in: space id */
-/*******************************************************************//**
-Returns the atomic writes flag of the space, or false if the space
-is not using atomic writes. The tablespace must be cached in the memory cache.
-@return atomic write table option value */
-UNIV_INLINE
-bool
-fil_space_get_atomic_writes(
-/*=========================*/
- ulint id); /*!< in: space id */
-
/****************************************************************//**
For page compressed pages compress the page before actual write
operation.
@@ -66,8 +38,7 @@ UNIV_INTERN
byte*
fil_compress_page(
/*==============*/
- ulint space_id, /*!< in: tablespace id of the
- table. */
+ fil_space_t* space, /*!< in,out: tablespace (NULL during IMPORT) */
byte* buf, /*!< in: buffer from which to write; in aio
this must be appropriately aligned */
byte* out_buf, /*!< out: compressed buffer */
diff --git a/storage/innobase/include/fsp0pagecompress.ic b/storage/innobase/include/fsp0pagecompress.ic
index bb11371d712..f4b95162b2a 100644
--- a/storage/innobase/include/fsp0pagecompress.ic
+++ b/storage/innobase/include/fsp0pagecompress.ic
@@ -74,47 +74,6 @@ fil_page_is_compressed_encrypted(
return(mach_read_from_2(buf+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
}
-#ifndef UNIV_INNOCHECKSUM
-/*******************************************************************//**
-Returns the page compression level of the space, or 0 if the space
-is not compressed. The tablespace must be cached in the memory cache.
-@return page compression level, 0 if space not found */
-UNIV_INLINE
-ulint
-fil_space_get_page_compression_level(
-/*=================================*/
- ulint id) /*!< in: space id */
-{
- ulint flags;
-
- flags = fil_space_get_flags(id);
-
- if (flags && flags != ULINT_UNDEFINED) {
-
- return(fsp_flags_get_page_compression_level(flags));
- }
-
- return(0);
-}
-
-/*******************************************************************//**
-Extract the page compression from space.
-@return true if space is page compressed, false if space is not found
-or space is not page compressed. */
-UNIV_INLINE
-bool
-fil_space_is_page_compressed(
-/*=========================*/
- ulint id) /*!< in: space id */
-{
- ulint flags = fil_space_get_flags(id);
-
- return(flags != ULINT_UNDEFINED
- && FSP_FLAGS_HAS_PAGE_COMPRESSION(flags));
-}
-
-#endif /* UNIV_INNOCHECKSUM */
-
/****************************************************************//**
Get the name of the compression algorithm used for page
compression.
@@ -155,31 +114,6 @@ fil_get_compression_alg_name(
#ifndef UNIV_INNOCHECKSUM
/*******************************************************************//**
-Returns the atomic writes flag of the space, or false if the space
-is not using atomic writes. The tablespace must be cached in the memory cache.
-@return 1 if atomic writes can be used for the file */
-UNIV_INLINE
-bool
-fil_space_get_atomic_writes(
-/*========================*/
- ulint id) /*!< in: space id */
-{
- struct fil_space_t* space;
- bool ret= 0;
-
- ut_ad(fil_system);
-
- mutex_enter(&fil_system->mutex);
-
- if ((space = fil_space_get_by_id(id)))
- ret= space->atomic_write_supported;
-
- mutex_exit(&fil_system->mutex);
- return(ret);
-}
-
-
-/*******************************************************************//**
Find out wheather the page is page compressed with lzo method
@return true if page is page compressed with lzo method, false if not */
UNIV_INLINE
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index 21354b1b605..f1d53165cdd 100644
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@ -409,6 +409,7 @@ extern bool fts_need_sync;
/** Variable specifying the table that has Fulltext index to display its
content through information schema table */
extern char* fts_internal_tbl_name;
+extern char* fts_internal_tbl_name2;
#define fts_que_graph_free(graph) \
do { \
@@ -842,6 +843,15 @@ fts_init_doc_id(
/*============*/
const dict_table_t* table); /*!< in: table */
+/* Get parent table name if it's a fts aux table
+@param[in] aux_table_name aux table name
+@param[in] aux_table_len aux table length
+@return parent table name, or NULL */
+char*
+fts_get_parent_table_name(
+ const char* aux_table_name,
+ ulint aux_table_len);
+
/******************************************************************//**
compare two character string according to their charset. */
extern
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index 6992f4a6689..7b3726b1fef 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -38,7 +38,6 @@ simple headers.
class THD;
// JAN: TODO missing features:
-#undef MYSQL_57_SELECT_COUNT_OPTIMIZATION
#undef MYSQL_FT_INIT_EXT
#undef MYSQL_INNODB_PARTITIONING
#undef MYSQL_PFS
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index ca6a5286cde..e718189062d 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -55,6 +55,9 @@ extern ulong innodb_lock_schedule_algorithm;
// Forward declaration
class ReadView;
+/** The value of innodb_deadlock_detect */
+extern my_bool innobase_deadlock_detect;
+
/*********************************************************************//**
Gets the size of a lock struct.
@return size in bytes */
diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h
index 35a94513632..d1aae64227e 100644
--- a/storage/innobase/include/log0log.h
+++ b/storage/innobase/include/log0log.h
@@ -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.
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
@@ -46,6 +46,12 @@ struct log_group_t;
/** Magic value to use instead of log checksums when they are disabled */
#define LOG_NO_CHECKSUM_MAGIC 0xDEADBEEFUL
+/* Margin for the free space in the smallest log group, before a new query
+step which modifies the database, is started */
+
+#define LOG_CHECKPOINT_FREE_PER_THREAD (4 * UNIV_PAGE_SIZE)
+#define LOG_CHECKPOINT_EXTRA_FREE (8 * UNIV_PAGE_SIZE)
+
typedef ulint (*log_checksum_func_t)(const byte* log_block);
/** Pointer to the log checksum calculation function. Protected with
diff --git a/storage/innobase/include/mtr0log.ic b/storage/innobase/include/mtr0log.ic
index 701f1482e64..972fdc81518 100644
--- a/storage/innobase/include/mtr0log.ic
+++ b/storage/innobase/include/mtr0log.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -227,20 +228,11 @@ mlog_write_initial_log_record_fast(
if (space == TRX_SYS_SPACE
&& offset >= FSP_EXTENT_SIZE && offset < 3 * FSP_EXTENT_SIZE) {
- if (buf_dblwr_being_created) {
- /* Do nothing: we only come to this branch in an
- InnoDB database creation. We do not redo log
- anything for the doublewrite buffer pages. */
- return(log_ptr);
- } else {
- ib::error() << "Trying to redo log a record of type "
- << type << " on page "
- << page_id_t(space, offset) << "in the"
- " doublewrite buffer, continuing anyway."
- " Please post a bug report to"
- " bugs.mysql.com.";
- ut_ad(0);
- }
+ ut_ad(buf_dblwr_being_created);
+ /* Do nothing: we only come to this branch in an
+ InnoDB database creation. We do not redo log
+ anything for the doublewrite buffer pages. */
+ return(log_ptr);
}
return(mlog_write_initial_log_record_low(type, space, offset,
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index a02333109cc..045a14221a3 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -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) 2012, Facebook Inc.
Copyright (c) 2013, 2017, MariaDB Corporation
@@ -269,8 +269,12 @@ struct mtr_t {
MLOG_FILE_NAME records and a MLOG_CHECKPOINT marker.
The caller must invoke log_mutex_enter() and log_mutex_exit().
This is to be used at log_checkpoint().
- @param[in] checkpoint_lsn the LSN of the log checkpoint */
- void commit_checkpoint(lsn_t checkpoint_lsn);
+ @param[in] checkpoint_lsn the LSN of the log checkpoint
+ @param[in] write_mlog_checkpoint Write MLOG_CHECKPOINT marker
+ if it is enabled. */
+ void commit_checkpoint(
+ lsn_t checkpoint_lsn,
+ bool write_mlog_checkpoint);
/** Return current size of the buffer.
@return savepoint */
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index 6a82c06e3ed..e3396a4b7f7 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -52,24 +52,11 @@ struct fil_space_t;
extern bool os_has_said_disk_full;
extern my_bool srv_use_trim;
-/** Number of pending read operations */
-extern ulint os_n_pending_reads;
-/** Number of pending write operations */
-extern ulint os_n_pending_writes;
-
/** File offset in bytes */
typedef ib_uint64_t os_offset_t;
#ifdef _WIN32
-/**
-Gets the operating system version. Currently works only on Windows.
-@return OS_WIN95, OS_WIN31, OS_WINNT, OS_WIN2000, OS_WINXP, OS_WINVISTA,
-OS_WIN7. */
-
-ulint
-os_get_os_version();
-
typedef HANDLE os_file_dir_t; /*!< directory stream */
/** We define always WIN_ASYNC_IO, and check at run-time whether
diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h
index 7aea976a37e..6f521b5a2ec 100644
--- a/storage/innobase/include/os0thread.h
+++ b/storage/innobase/include/os0thread.h
@@ -118,9 +118,19 @@ os_thread_create_func(
os_thread_id_t* thread_id); /*!< out: id of the created
thread, or NULL */
-/** Exits the current thread. */
+/** Waits until the specified thread completes and joins it.
+Its return value is ignored.
+@param[in,out] thread thread to join */
void
-os_thread_exit()
+os_thread_join(
+ os_thread_id_t thread);
+
+/** Exits the current thread.
+@param[in] detach if true, the thread will be detached right before
+exiting. If false, another thread is responsible for joining this thread */
+void
+os_thread_exit(
+ bool detach = true)
UNIV_COLD MY_ATTRIBUTE((noreturn));
/*****************************************************************//**
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index 7250a96bb5d..1c680ce7cc4 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -295,7 +295,7 @@ page_is_comp(
/*=========*/
const page_t* page) /*!< in: index page */
{
- return(page_header_get_field(page, PAGE_N_HEAP) & 0x8000);
+ return(page[PAGE_HEADER + PAGE_N_HEAP] & 0x80);
}
/************************************************************//**
diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
index e1062c00a6f..c1d5443d9e5 100644
--- a/storage/innobase/include/page0zip.h
+++ b/storage/innobase/include/page0zip.h
@@ -512,19 +512,7 @@ ibool
page_zip_verify_checksum(
/*=====================*/
const void* data, /*!< in: compressed page */
- ulint size /*!< in: size of compressed page */
-#ifdef UNIV_INNOCHECKSUM
- /* these variables are used only for innochecksum tool. */
- ,uintmax_t page_no, /*!< in: page number of
- given read_buf */
- bool strict_check, /*!< in: true if strict-check
- option is enable */
- bool is_log_enabled, /*!< in: true if log option is
- enable */
- FILE* log_file /*!< in: file pointer to
- log_file */
-#endif /* UNIV_INNOCHECKSUM */
-);
+ ulint size); /*!< in: size of compressed page */
#ifndef UNIV_INNOCHECKSUM
/**********************************************************************//**
diff --git a/storage/innobase/include/pars0grm.h b/storage/innobase/include/pars0grm.h
index 788090a2e74..90a7468bc9a 100644
--- a/storage/innobase/include/pars0grm.h
+++ b/storage/innobase/include/pars0grm.h
@@ -48,104 +48,101 @@ extern int yydebug;
PARS_INT_LIT = 258,
PARS_FLOAT_LIT = 259,
PARS_STR_LIT = 260,
- PARS_FIXBINARY_LIT = 261,
- PARS_BLOB_LIT = 262,
- PARS_NULL_LIT = 263,
- PARS_ID_TOKEN = 264,
- PARS_AND_TOKEN = 265,
- PARS_OR_TOKEN = 266,
- PARS_NOT_TOKEN = 267,
- PARS_GE_TOKEN = 268,
- PARS_LE_TOKEN = 269,
- PARS_NE_TOKEN = 270,
- PARS_PROCEDURE_TOKEN = 271,
- PARS_IN_TOKEN = 272,
- PARS_OUT_TOKEN = 273,
- PARS_BINARY_TOKEN = 274,
- PARS_BLOB_TOKEN = 275,
- PARS_INT_TOKEN = 276,
- PARS_INTEGER_TOKEN = 277,
- PARS_FLOAT_TOKEN = 278,
- PARS_CHAR_TOKEN = 279,
- PARS_IS_TOKEN = 280,
- PARS_BEGIN_TOKEN = 281,
- PARS_END_TOKEN = 282,
- PARS_IF_TOKEN = 283,
- PARS_THEN_TOKEN = 284,
- PARS_ELSE_TOKEN = 285,
- PARS_ELSIF_TOKEN = 286,
- PARS_LOOP_TOKEN = 287,
- PARS_WHILE_TOKEN = 288,
- PARS_RETURN_TOKEN = 289,
- PARS_SELECT_TOKEN = 290,
- PARS_SUM_TOKEN = 291,
- PARS_COUNT_TOKEN = 292,
- PARS_DISTINCT_TOKEN = 293,
- PARS_FROM_TOKEN = 294,
- PARS_WHERE_TOKEN = 295,
- PARS_FOR_TOKEN = 296,
- PARS_DDOT_TOKEN = 297,
- PARS_READ_TOKEN = 298,
- PARS_ORDER_TOKEN = 299,
- PARS_BY_TOKEN = 300,
- PARS_ASC_TOKEN = 301,
- PARS_DESC_TOKEN = 302,
- PARS_INSERT_TOKEN = 303,
- PARS_INTO_TOKEN = 304,
- PARS_VALUES_TOKEN = 305,
- PARS_UPDATE_TOKEN = 306,
- PARS_SET_TOKEN = 307,
- PARS_DELETE_TOKEN = 308,
- PARS_CURRENT_TOKEN = 309,
- PARS_OF_TOKEN = 310,
- PARS_CREATE_TOKEN = 311,
- PARS_TABLE_TOKEN = 312,
- PARS_INDEX_TOKEN = 313,
- PARS_UNIQUE_TOKEN = 314,
- PARS_CLUSTERED_TOKEN = 315,
- PARS_ON_TOKEN = 316,
- PARS_ASSIGN_TOKEN = 317,
- PARS_DECLARE_TOKEN = 318,
- PARS_CURSOR_TOKEN = 319,
- PARS_SQL_TOKEN = 320,
- PARS_OPEN_TOKEN = 321,
- PARS_FETCH_TOKEN = 322,
- PARS_CLOSE_TOKEN = 323,
- PARS_NOTFOUND_TOKEN = 324,
- PARS_TO_CHAR_TOKEN = 325,
- PARS_TO_NUMBER_TOKEN = 326,
- PARS_TO_BINARY_TOKEN = 327,
- PARS_BINARY_TO_NUMBER_TOKEN = 328,
- PARS_SUBSTR_TOKEN = 329,
- PARS_REPLSTR_TOKEN = 330,
- PARS_CONCAT_TOKEN = 331,
- PARS_INSTR_TOKEN = 332,
- PARS_LENGTH_TOKEN = 333,
- PARS_SYSDATE_TOKEN = 334,
- PARS_PRINTF_TOKEN = 335,
- PARS_ASSERT_TOKEN = 336,
- PARS_RND_TOKEN = 337,
- PARS_RND_STR_TOKEN = 338,
- PARS_ROW_PRINTF_TOKEN = 339,
- PARS_COMMIT_TOKEN = 340,
- PARS_ROLLBACK_TOKEN = 341,
- PARS_WORK_TOKEN = 342,
- PARS_UNSIGNED_TOKEN = 343,
- PARS_EXIT_TOKEN = 344,
- PARS_FUNCTION_TOKEN = 345,
- PARS_LOCK_TOKEN = 346,
- PARS_SHARE_TOKEN = 347,
- PARS_MODE_TOKEN = 348,
- PARS_LIKE_TOKEN = 349,
- PARS_LIKE_TOKEN_EXACT = 350,
- PARS_LIKE_TOKEN_PREFIX = 351,
- PARS_LIKE_TOKEN_SUFFIX = 352,
- PARS_LIKE_TOKEN_SUBSTR = 353,
- PARS_TABLE_NAME_TOKEN = 354,
- PARS_COMPACT_TOKEN = 355,
- PARS_BLOCK_SIZE_TOKEN = 356,
- PARS_BIGINT_TOKEN = 357,
- NEG = 358
+ PARS_NULL_LIT = 261,
+ PARS_ID_TOKEN = 262,
+ PARS_AND_TOKEN = 263,
+ PARS_OR_TOKEN = 264,
+ PARS_NOT_TOKEN = 265,
+ PARS_GE_TOKEN = 266,
+ PARS_LE_TOKEN = 267,
+ PARS_NE_TOKEN = 268,
+ PARS_PROCEDURE_TOKEN = 269,
+ PARS_IN_TOKEN = 270,
+ PARS_OUT_TOKEN = 271,
+ PARS_BINARY_TOKEN = 272,
+ PARS_BLOB_TOKEN = 273,
+ PARS_INT_TOKEN = 274,
+ PARS_FLOAT_TOKEN = 275,
+ PARS_CHAR_TOKEN = 276,
+ PARS_IS_TOKEN = 277,
+ PARS_BEGIN_TOKEN = 278,
+ PARS_END_TOKEN = 279,
+ PARS_IF_TOKEN = 280,
+ PARS_THEN_TOKEN = 281,
+ PARS_ELSE_TOKEN = 282,
+ PARS_ELSIF_TOKEN = 283,
+ PARS_LOOP_TOKEN = 284,
+ PARS_WHILE_TOKEN = 285,
+ PARS_RETURN_TOKEN = 286,
+ PARS_SELECT_TOKEN = 287,
+ PARS_SUM_TOKEN = 288,
+ PARS_COUNT_TOKEN = 289,
+ PARS_DISTINCT_TOKEN = 290,
+ PARS_FROM_TOKEN = 291,
+ PARS_WHERE_TOKEN = 292,
+ PARS_FOR_TOKEN = 293,
+ PARS_DDOT_TOKEN = 294,
+ PARS_READ_TOKEN = 295,
+ PARS_ORDER_TOKEN = 296,
+ PARS_BY_TOKEN = 297,
+ PARS_ASC_TOKEN = 298,
+ PARS_DESC_TOKEN = 299,
+ PARS_INSERT_TOKEN = 300,
+ PARS_INTO_TOKEN = 301,
+ PARS_VALUES_TOKEN = 302,
+ PARS_UPDATE_TOKEN = 303,
+ PARS_SET_TOKEN = 304,
+ PARS_DELETE_TOKEN = 305,
+ PARS_CURRENT_TOKEN = 306,
+ PARS_OF_TOKEN = 307,
+ PARS_CREATE_TOKEN = 308,
+ PARS_TABLE_TOKEN = 309,
+ PARS_INDEX_TOKEN = 310,
+ PARS_UNIQUE_TOKEN = 311,
+ PARS_CLUSTERED_TOKEN = 312,
+ PARS_ON_TOKEN = 313,
+ PARS_ASSIGN_TOKEN = 314,
+ PARS_DECLARE_TOKEN = 315,
+ PARS_CURSOR_TOKEN = 316,
+ PARS_SQL_TOKEN = 317,
+ PARS_OPEN_TOKEN = 318,
+ PARS_FETCH_TOKEN = 319,
+ PARS_CLOSE_TOKEN = 320,
+ PARS_NOTFOUND_TOKEN = 321,
+ PARS_TO_CHAR_TOKEN = 322,
+ PARS_TO_NUMBER_TOKEN = 323,
+ PARS_TO_BINARY_TOKEN = 324,
+ PARS_BINARY_TO_NUMBER_TOKEN = 325,
+ PARS_SUBSTR_TOKEN = 326,
+ PARS_REPLSTR_TOKEN = 327,
+ PARS_CONCAT_TOKEN = 328,
+ PARS_INSTR_TOKEN = 329,
+ PARS_LENGTH_TOKEN = 330,
+ PARS_SYSDATE_TOKEN = 331,
+ PARS_PRINTF_TOKEN = 332,
+ PARS_ASSERT_TOKEN = 333,
+ PARS_RND_TOKEN = 334,
+ PARS_RND_STR_TOKEN = 335,
+ PARS_ROW_PRINTF_TOKEN = 336,
+ PARS_COMMIT_TOKEN = 337,
+ PARS_ROLLBACK_TOKEN = 338,
+ PARS_WORK_TOKEN = 339,
+ PARS_UNSIGNED_TOKEN = 340,
+ PARS_EXIT_TOKEN = 341,
+ PARS_FUNCTION_TOKEN = 342,
+ PARS_LOCK_TOKEN = 343,
+ PARS_SHARE_TOKEN = 344,
+ PARS_MODE_TOKEN = 345,
+ PARS_LIKE_TOKEN = 346,
+ PARS_LIKE_TOKEN_EXACT = 347,
+ PARS_LIKE_TOKEN_PREFIX = 348,
+ PARS_LIKE_TOKEN_SUFFIX = 349,
+ PARS_LIKE_TOKEN_SUBSTR = 350,
+ PARS_TABLE_NAME_TOKEN = 351,
+ PARS_COMPACT_TOKEN = 352,
+ PARS_BLOCK_SIZE_TOKEN = 353,
+ PARS_BIGINT_TOKEN = 354,
+ NEG = 355
};
#endif
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index 59bd786d25c..0557b585ae1 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -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) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -540,9 +540,6 @@ row_scan_index_for_mysql(
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct
in MySQL handle */
const dict_index_t* index, /*!< in: index */
- bool check_keys, /*!< in: true=check for mis-
- ordered or duplicate records,
- false=count the rows only */
ulint* n_rows) /*!< out: number of entries
seen in the consistent read */
MY_ATTRIBUTE((warn_unused_result));
diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h
index 1b1597d0fba..e4034f3a6ff 100644
--- a/storage/innobase/include/srv0mon.h
+++ b/storage/innobase/include/srv0mon.h
@@ -2,7 +2,7 @@
Copyright (c) 2010, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -603,9 +603,10 @@ on the counters */
/** Atomically increment a monitor counter.
Use MONITOR_INC if appropriate mutex protection exists.
-@param monitor monitor to be incremented by 1 */
-# define MONITOR_ATOMIC_INC(monitor) \
- if (MONITOR_IS_ON(monitor)) { \
+@param monitor monitor to be incremented by 1
+@param enabled whether the monitor is enabled */
+#define MONITOR_ATOMIC_INC_LOW(monitor, enabled) \
+ if (enabled) { \
ib_uint64_t value; \
value = my_atomic_add64( \
(int64*) &MONITOR_VALUE(monitor), 1) + 1; \
@@ -618,9 +619,10 @@ Use MONITOR_INC if appropriate mutex protection exists.
/** Atomically decrement a monitor counter.
Use MONITOR_DEC if appropriate mutex protection exists.
-@param monitor monitor to be decremented by 1 */
-# define MONITOR_ATOMIC_DEC(monitor) \
- if (MONITOR_IS_ON(monitor)) { \
+@param monitor monitor to be decremented by 1
+@param enabled whether the monitor is enabled */
+#define MONITOR_ATOMIC_DEC_LOW(monitor, enabled) \
+ if (enabled) { \
ib_uint64_t value; \
value = my_atomic_add64( \
(int64*) &MONITOR_VALUE(monitor), -1) - 1; \
@@ -631,6 +633,17 @@ Use MONITOR_DEC if appropriate mutex protection exists.
} \
}
+/** Atomically increment a monitor counter if it is enabled.
+Use MONITOR_INC if appropriate mutex protection exists.
+@param monitor monitor to be incremented by 1 */
+#define MONITOR_ATOMIC_INC(monitor) \
+ MONITOR_ATOMIC_INC_LOW(monitor, MONITOR_IS_ON(monitor))
+/** Atomically decrement a monitor counter if it is enabled.
+Use MONITOR_DEC if appropriate mutex protection exists.
+@param monitor monitor to be decremented by 1 */
+#define MONITOR_ATOMIC_DEC(monitor) \
+ MONITOR_ATOMIC_DEC_LOW(monitor, MONITOR_IS_ON(monitor))
+
#define MONITOR_DEC(monitor) \
if (MONITOR_IS_ON(monitor)) { \
MONITOR_VALUE(monitor)--; \
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index eb08c478965..230d7b7effe 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -301,6 +301,9 @@ extern long srv_mtflush_threads;
/* If this flag is TRUE, then we will use multi threaded flush. */
extern my_bool srv_use_mtflush;
+/** TRUE if the server was successfully started */
+extern bool srv_was_started;
+
/** Server undo tablespaces directory, can be absolute path. */
extern char* srv_undo_dir;
@@ -472,6 +475,7 @@ extern unsigned long long srv_stats_transient_sample_pages;
extern my_bool srv_stats_persistent;
extern unsigned long long srv_stats_persistent_sample_pages;
extern my_bool srv_stats_auto_recalc;
+extern my_bool srv_stats_include_delete_marked;
extern unsigned long long srv_stats_modified_counter;
extern my_bool srv_stats_sample_traditional;
@@ -512,7 +516,6 @@ extern ulong srv_n_spin_wait_rounds;
extern ulong srv_n_free_tickets_to_enter;
extern ulong srv_thread_sleep_delay;
extern uint srv_spin_wait_delay;
-extern ibool srv_priority_boost;
extern ulint srv_truncated_status_writes;
/** Number of initialized rollback segments for persistent undo log */
@@ -746,36 +749,24 @@ srv_set_io_thread_op_info(
Resets the info describing an i/o thread current state. */
void
srv_reset_io_thread_op_info();
-/*=========================*/
-/*******************************************************************//**
-Tells the purge thread that there has been activity in the database
-and wakes up the purge thread if it is suspended (not sleeping). Note
-that there is a small chance that the purge thread stays suspended
-(we do not protect our operation with the srv_sys_t:mutex, for
-performance reasons). */
+
+/** Wake up the purge threads if there is work to do. */
void
-srv_wake_purge_thread_if_not_active(void);
-/*=====================================*/
-/*******************************************************************//**
-Tells the Innobase server that there has been activity in the database
-and wakes up the master thread if it is suspended (not sleeping). Used
-in the MySQL interface. Note that there is a small chance that the master
-thread stays suspended (we do not protect our operation with the kernel
-mutex, for performace reasons). */
+srv_wake_purge_thread_if_not_active();
+/** Wake up the InnoDB master thread if it was suspended (not sleeping). */
void
-srv_active_wake_master_thread_low(void);
-/*===================================*/
+srv_active_wake_master_thread_low();
+
#define srv_active_wake_master_thread() \
do { \
if (!srv_read_only_mode) { \
srv_active_wake_master_thread_low(); \
} \
} while (0)
-/*******************************************************************//**
-Wakes up the master thread if it is suspended or being suspended. */
+/** Wake up the master thread if it is suspended or being suspended. */
void
-srv_wake_master_thread(void);
-/*========================*/
+srv_wake_master_thread();
+
/******************************************************************//**
Outputs to a file the output of the InnoDB Monitor.
@return FALSE if not all information printed
diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h
index d7a5922c954..4f2f4a312ff 100644
--- a/storage/innobase/include/srv0start.h
+++ b/storage/innobase/include/srv0start.h
@@ -121,8 +121,6 @@ extern lsn_t srv_start_lsn;
extern bool srv_is_being_started;
/** TRUE if SYS_TABLESPACES is available for lookups */
extern bool srv_sys_tablespaces_open;
-/** TRUE if the server was successfully started */
-extern ibool srv_was_started;
/** TRUE if the server is being started, before rolling back any
incomplete transactions */
extern bool srv_startup_is_before_trx_rollback_phase;
diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h
index 736c5454711..1d11bfa7811 100644
--- a/storage/innobase/include/sync0types.h
+++ b/storage/innobase/include/sync0types.h
@@ -505,14 +505,32 @@ private:
};
#ifdef UNIV_PFS_MUTEX
-/** Latch element
+/** Latch element.
+Used for mutexes which have PFS keys defined under UNIV_PFS_MUTEX.
@param[in] id Latch id
@param[in] level Latch level
@param[in] key PFS key */
-# define LATCH_ADD(id, level, key) latch_meta[LATCH_ID_ ## id] = \
+# define LATCH_ADD_MUTEX(id, level, key) latch_meta[LATCH_ID_ ## id] =\
+ UT_NEW_NOKEY(latch_meta_t(LATCH_ID_ ## id, #id, level, #level, key))
+
+#ifdef UNIV_PFS_RWLOCK
+/** Latch element.
+Used for rwlocks which have PFS keys defined under UNIV_PFS_RWLOCK.
+@param[in] id Latch id
+@param[in] level Latch level
+@param[in] key PFS key */
+# define LATCH_ADD_RWLOCK(id, level, key) latch_meta[LATCH_ID_ ## id] =\
UT_NEW_NOKEY(latch_meta_t(LATCH_ID_ ## id, #id, level, #level, key))
#else
-# define LATCH_ADD(id, level, key) latch_meta[LATCH_ID_ ## id] = \
+# define LATCH_ADD_RWLOCK(id, level, key) latch_meta[LATCH_ID_ ## id] =\
+ UT_NEW_NOKEY(latch_meta_t(LATCH_ID_ ## id, #id, level, #level, \
+ PSI_NOT_INSTRUMENTED))
+#endif /* UNIV_PFS_RWLOCK */
+
+#else
+# define LATCH_ADD_MUTEX(id, level, key) latch_meta[LATCH_ID_ ## id] =\
+ UT_NEW_NOKEY(latch_meta_t(LATCH_ID_ ## id, #id, level, #level))
+# define LATCH_ADD_RWLOCK(id, level, key) latch_meta[LATCH_ID_ ## id] =\
UT_NEW_NOKEY(latch_meta_t(LATCH_ID_ ## id, #id, level, #level))
#endif /* UNIV_PFS_MUTEX */
@@ -919,7 +937,7 @@ sync_latch_get_level(latch_id_t id)
return(meta.get_level());
}
-#ifdef HAVE_PSI_INTERFACE
+#ifdef UNIV_PFS_MUTEX
/** Get the latch PFS key from the latch ID
@param[in] id Latch ID
@return the PFS key */
diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h
index 95774cbf476..4c162526384 100644
--- a/storage/innobase/include/trx0rseg.h
+++ b/storage/innobase/include/trx0rseg.h
@@ -200,7 +200,10 @@ struct trx_rseg_t {
bool is_persistent() const
{
ut_ad(space == SRV_TMP_SPACE_ID
- || space <= srv_undo_tablespaces);
+ || space <= TRX_SYS_MAX_UNDO_SPACES);
+ ut_ad(space == SRV_TMP_SPACE_ID
+ || space <= srv_undo_tablespaces_active
+ || !srv_was_started);
return(space != SRV_TMP_SPACE_ID);
}
};
diff --git a/storage/innobase/include/trx0rseg.ic b/storage/innobase/include/trx0rseg.ic
index 0a33c747668..45ee3ef8d66 100644
--- a/storage/innobase/include/trx0rseg.ic
+++ b/storage/innobase/include/trx0rseg.ic
@@ -42,7 +42,9 @@ trx_rsegf_get(
buf_block_t* block;
trx_rsegf_t* header;
- ut_ad(space <= srv_undo_tablespaces || space == SRV_TMP_SPACE_ID);
+ ut_ad(space <= srv_undo_tablespaces_active || space == SRV_TMP_SPACE_ID
+ || !srv_was_started);
+ ut_ad(space <= TRX_SYS_MAX_UNDO_SPACES || space == SRV_TMP_SPACE_ID);
block = buf_page_get(
page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr);
@@ -69,7 +71,9 @@ trx_rsegf_get_new(
buf_block_t* block;
trx_rsegf_t* header;
- ut_ad(space <= srv_undo_tablespaces || space == SRV_TMP_SPACE_ID);
+ ut_ad(space <= srv_undo_tablespaces_active || space == SRV_TMP_SPACE_ID
+ || !srv_was_started);
+ ut_ad(space <= TRX_SYS_MAX_UNDO_SPACES || space == SRV_TMP_SPACE_ID);
block = buf_page_get(
page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr);
diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h
index b867600653d..bf8cf2481eb 100644
--- a/storage/innobase/include/trx0sys.h
+++ b/storage/innobase/include/trx0sys.h
@@ -403,10 +403,8 @@ byte, therefore 128; each slot is currently 8 bytes in size. If you want
to raise the level to 256 then you will need to fix some assertions that
impose the 7 bit restriction. e.g., mach_write_to_3() */
#define TRX_SYS_N_RSEGS 128
-/* Originally, InnoDB defined TRX_SYS_N_RSEGS as 256 but created only one
-rollback segment. It initialized some arrays with this number of entries.
-We must remember this limit in order to keep file compatibility. */
-#define TRX_SYS_OLD_N_RSEGS 256
+/** Maximum number of undo tablespaces (not counting the system tablespace) */
+#define TRX_SYS_MAX_UNDO_SPACES (TRX_SYS_N_RSEGS - 1)
/** Maximum length of MySQL binlog file name, in bytes. */
#define TRX_SYS_MYSQL_LOG_NAME_LEN 512
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index b08148578dc..446e619abb9 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -386,6 +386,22 @@ trx_print_latched(
ulint max_query_len); /*!< in: max query length to print,
or 0 to use the default max length */
+#ifdef WITH_WSREP
+/**********************************************************************//**
+Prints info about a transaction.
+Transaction information may be retrieved without having trx_sys->mutex acquired
+so it may not be completely accurate. The caller must own lock_sys->mutex
+and the trx must have some locks to make sure that it does not escape
+without locking lock_sys->mutex. */
+UNIV_INTERN
+void
+wsrep_trx_print_locking(
+ FILE* f, /*!< in: output stream */
+ const trx_t* trx, /*!< in: transaction */
+ ulint max_query_len) /*!< in: max query length to print,
+ or 0 to use the default max length */
+ MY_ATTRIBUTE((nonnull));
+#endif /* WITH_WSREP */
/**********************************************************************//**
Prints info about a transaction.
Acquires and releases lock_sys->mutex and trx_sys->mutex. */
@@ -1468,10 +1484,30 @@ private:
return;
}
- /* Avoid excessive mutex acquire/release */
-
ut_ad(!is_async_rollback(trx));
+ /* If it hasn't already been marked for async rollback.
+ and it will be committed/rolled back. */
+ if (disable) {
+
+ trx_mutex_enter(trx);
+ if (!is_forced_rollback(trx)
+ && is_started(trx)
+ && !trx_is_autocommit_non_locking(trx)) {
+
+ ut_ad(trx->killed_by == 0);
+
+ /* This transaction has crossed the point of
+ no return and cannot be rolled back
+ asynchronously now. It must commit or rollback
+ synhronously. */
+
+ trx->in_innodb |= TRX_FORCE_ROLLBACK_DISABLE;
+ }
+ trx_mutex_exit(trx);
+ }
+
+ /* Avoid excessive mutex acquire/release */
++trx->in_depth;
/* If trx->in_depth is greater than 1 then
@@ -1489,25 +1525,7 @@ private:
wait(trx);
- ut_ad((trx->in_innodb & TRX_FORCE_ROLLBACK_MASK)
- < (TRX_FORCE_ROLLBACK_MASK - 1));
-
- /* If it hasn't already been marked for async rollback.
- and it will be committed/rolled back. */
-
- if (!is_forced_rollback(trx)
- && disable
- && is_started(trx)
- && !trx_is_autocommit_non_locking(trx)) {
-
- ut_ad(trx->killed_by == 0);
-
- /* This transaction has crossed the point of no
- return and cannot be rolled back asynchronously
- now. It must commit or rollback synhronously. */
-
- trx->in_innodb |= TRX_FORCE_ROLLBACK_DISABLE;
- }
+ ut_ad((trx->in_innodb & TRX_FORCE_ROLLBACK_MASK) == 0);
++trx->in_innodb;
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index cb2674ebddf..ee759534301 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -102,11 +102,18 @@ support cross-platform development and expose comonly used SQL names. */
#endif
#include <stdint.h>
+#define __STDC_FORMAT_MACROS /* Enable C99 printf format macros */
#include <inttypes.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#ifdef UNIV_INNOCHECKSUM
+extern bool strict_verify;
+extern FILE* log_file;
+extern uintmax_t cur_page_num;
+#endif /* UNIV_INNOCHECKSUM */
+
#include "my_pthread.h"
/* Following defines are to enable performance schema
instrumentation in each of five InnoDB modules if
@@ -282,16 +289,7 @@ rarely invoked function for size instead for speed. */
#define UNIV_INLINE static inline
-#ifdef _WIN32
-# ifdef _WIN64
-# define UNIV_WORD_SIZE 8
-# else
-# define UNIV_WORD_SIZE 4
-# endif
-#else /* !_WIN32 */
-/** MySQL config.h generated by CMake will define SIZEOF_LONG in Posix */
-#define UNIV_WORD_SIZE SIZEOF_LONG
-#endif /* _WIN32 */
+#define UNIV_WORD_SIZE SIZEOF_SIZE_T
/** The following alignment is used in memory allocations in memory heap
management to ensure correct alignment for doubles etc. */
@@ -463,52 +461,48 @@ mysql_com.h if you are to use this macro. */
==========================
*/
-/* Note that inside MySQL 'byte' is defined as char on Linux! */
-#define byte unsigned char
+/** Unsigned octet of bits */
+typedef unsigned char byte;
+/** Machine-word-width unsigned integer */
+typedef size_t ulint;
+/** Machine-word-width signed integer */
+typedef ssize_t lint;
-/* Another basic type we use is unsigned long integer which should be equal to
-the word size of the machine, that is on a 32-bit platform 32 bits, and on a
-64-bit platform 64 bits. We also give the printf format for the type as a
-macro ULINTPF. */
+/** ulint format for the printf() family of functions */
+#define ULINTPF "%zu"
+/** ulint hexadecimal format for the printf() family of functions */
+#define ULINTPFx "%zx"
#ifdef _WIN32
/* Use the integer types and formatting strings defined in Visual Studio. */
# define UINT32PF "%u"
-# define UINT64PF "%llu"
-# define UINT64PFx "%016llx"
+# define INT64PF "%lld"
# define UINT64scan "llu"
-typedef unsigned __int64 ib_uint64_t;
-typedef unsigned __int32 ib_uint32_t;
-#else
-# define UINT32PF "%u"
-#if SIZEOF_LONG == 8
-# define UINT64PF "%lu"
-# define UINT64PFx "%016lx"
-# define UINT64scan "lu"
-#else
-# define UINT64PF "%llu"
# define UINT64PFx "%016llx"
+#elif defined __APPLE__
+/* Apple prefers to call the 64-bit types 'long long'
+in both 32-bit and 64-bit environments. */
+# define UINT32PF "%" PRIu32
+# define INT64PF "%lld"
# define UINT64scan "llu"
+# define UINT64PFx "%016llx"
+#else
+/* Use the integer types and formatting strings defined in the C99 standard. */
+# define UINT32PF "%" PRIu32
+# define INT64PF "%" PRId64
+# define UINT64scan PRIu64
+# define UINT64PFx "%016" PRIx64
#endif
+
+typedef int64_t ib_int64_t;
typedef uint64_t ib_uint64_t;
typedef uint32_t ib_uint32_t;
-#endif /* _WIN32 */
-#ifdef _WIN64
-typedef unsigned __int64 ulint;
-typedef __int64 lint;
-# define ULINTPF UINT64PF
-#else
-typedef unsigned long int ulint;
-typedef long int lint;
-# define ULINTPF "%lu"
-#endif /* _WIN64 */
+#define UINT64PF "%" UINT64scan
+#define IB_ID_FMT UINT64PF
-#ifndef _WIN32
-#if SIZEOF_LONG != SIZEOF_VOIDP
-#error "Error: InnoDB's ulint must be of the same size as void*"
-#endif
-#endif
+/** Log sequence number (also used for redo log byte arithmetics) */
+typedef ib_uint64_t lsn_t;
/** The 'undefined' value for a ulint */
#define ULINT_UNDEFINED ((ulint)(-1))
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 134853dd0d7..1860cd51362 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -56,6 +56,9 @@ Created 5/7/1996 Heikki Tuuri
/** Lock scheduling algorithm */
ulong innodb_lock_schedule_algorithm = INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS;
+/** The value of innodb_deadlock_detect */
+my_bool innobase_deadlock_detect;
+
/** Total number of cached record locks */
static const ulint REC_LOCK_CACHE = 8;
@@ -124,7 +127,7 @@ public:
@return id of transaction chosen as victim or 0 */
static const trx_t* check_and_resolve(
const lock_t* lock,
- const trx_t* trx);
+ trx_t* trx);
private:
/** Do a shallow copy. Default destructor OK.
@@ -1378,24 +1381,20 @@ wsrep_kill_victim(
is in the queue*/
} else if (lock->trx != trx) {
if (wsrep_log_conflicts) {
- mutex_enter(&trx_sys->mutex);
if (bf_this) {
ib::info() << "*** Priority TRANSACTION:";
} else {
ib::info() << "*** Victim TRANSACTION:";
}
- trx_print_latched(stderr, trx, 3000);
+ wsrep_trx_print_locking(stderr, trx, 3000);
if (bf_other) {
ib::info() << "*** Priority TRANSACTION:";
} else {
ib::info() << "*** Victim TRANSACTION:";
}
-
- trx_print_latched(stderr, lock->trx, 3000);
-
- mutex_exit(&trx_sys->mutex);
+ wsrep_trx_print_locking(stderr, lock->trx, 3000);
ib::info() << "*** WAITING FOR THIS LOCK TO BE GRANTED:";
@@ -2136,25 +2135,8 @@ RecLock::deadlock_check(lock_t* lock)
ut_ad(lock->trx == m_trx);
ut_ad(trx_mutex_own(m_trx));
- bool async_rollback = m_trx->in_innodb & TRX_FORCE_ROLLBACK_ASYNC;
-
- /* This is safe, because DeadlockChecker::check_and_resolve()
- is invoked when a lock wait is enqueued for the currently
- running transaction. Because m_trx is a running transaction
- (it is not currently suspended because of a lock wait),
- its state can only be changed by this thread, which is
- currently associated with the transaction. */
-
- trx_mutex_exit(m_trx);
-
- /* If transaction is marked for ASYNC rollback then we should
- not allow it to wait for another lock causing possible deadlock.
- We return current transaction as deadlock victim here. */
-
- const trx_t* victim_trx = async_rollback ? m_trx
- : DeadlockChecker::check_and_resolve(lock, m_trx);
-
- trx_mutex_enter(m_trx);
+ const trx_t* victim_trx =
+ DeadlockChecker::check_and_resolve(lock, m_trx);
/* Check the outcome of the deadlock test. It is possible that
the transaction that blocked our lock was rolled back and we
@@ -3613,18 +3595,7 @@ lock_move_reorganize_page(
}
}
-#ifdef UNIV_DEBUG
- {
- ulint i = lock_rec_find_set_bit(lock);
-
- /* Check that all locks were moved. */
- if (i != ULINT_UNDEFINED) {
- ib::fatal() << "lock_move_reorganize_page(): "
- << i << " not moved in "
- << (void*) lock;
- }
- }
-#endif /* UNIV_DEBUG */
+ ut_ad(lock_rec_find_set_bit(lock) == ULINT_UNDEFINED);
}
lock_mutex_exit();
@@ -4664,25 +4635,8 @@ lock_table_enqueue_waiting(
/* Enqueue the lock request that will wait to be granted */
lock = lock_table_create(c_lock, table, mode | LOCK_WAIT, trx);
- bool async_rollback = trx->in_innodb & TRX_FORCE_ROLLBACK_ASYNC;
- /* Release the mutex to obey the latching order.
- This is safe, because DeadlockChecker::check_and_resolve()
- is invoked when a lock wait is enqueued for the currently
- running transaction. Because trx is a running transaction
- (it is not currently suspended because of a lock wait),
- its state can only be changed by this thread, which is
- currently associated with the transaction. */
-
- trx_mutex_exit(trx);
-
- /* If transaction is marked for ASYNC rollback then we should
- not allow it to wait for another lock causing possible deadlock.
- We return current transaction as deadlock victim here. */
-
- const trx_t* victim_trx = async_rollback ? trx
- : DeadlockChecker::check_and_resolve(lock, trx);
-
- trx_mutex_enter(trx);
+ const trx_t* victim_trx =
+ DeadlockChecker::check_and_resolve(lock, trx);
if (victim_trx != 0) {
ut_ad(victim_trx == trx);
@@ -6606,7 +6560,7 @@ lock_rec_block_validate(
if (err != DB_SUCCESS) {
ib::error() << "Lock rec block validate failed for tablespace "
- << ((space && space->name) ? space->name : " system ")
+ << space->name
<< " space_id " << space_id
<< " page_no " << page_no << " err " << err;
}
@@ -8452,17 +8406,37 @@ and rolling it back. It will attempt to resolve all deadlocks. The returned
transaction id will be the joining transaction instance or NULL if some other
transaction was chosen as a victim and rolled back or no deadlock found.
-@param lock lock the transaction is requesting
-@param trx transaction requesting the lock
+@param[in] lock lock the transaction is requesting
+@param[in,out] trx transaction requesting the lock
@return transaction instanace chosen as victim or 0 */
const trx_t*
-DeadlockChecker::check_and_resolve(const lock_t* lock, const trx_t* trx)
+DeadlockChecker::check_and_resolve(const lock_t* lock, trx_t* trx)
{
ut_ad(lock_mutex_own());
+ ut_ad(trx_mutex_own(trx));
check_trx_state(trx);
ut_ad(!srv_read_only_mode);
+ /* If transaction is marked for ASYNC rollback then we should
+ not allow it to wait for another lock causing possible deadlock.
+ We return current transaction as deadlock victim here. */
+ if (trx->in_innodb & TRX_FORCE_ROLLBACK_ASYNC) {
+ return(trx);
+ } else if (!innobase_deadlock_detect) {
+ return(NULL);
+ }
+
+ /* Release the mutex to obey the latching order.
+ This is safe, because DeadlockChecker::check_and_resolve()
+ is invoked when a lock wait is enqueued for the currently
+ running transaction. Because m_trx is a running transaction
+ (it is not currently suspended because of a lock wait),
+ its state can only be changed by this thread, which is
+ currently associated with the transaction. */
+
+ trx_mutex_exit(trx);
+
const trx_t* victim_trx;
THD* start_mysql_thd;
bool report_waits = false;
@@ -8502,7 +8476,7 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, const trx_t* trx)
break;
- } else if (victim_trx != 0 && victim_trx != trx) {
+ } else if (victim_trx != NULL && victim_trx != trx) {
ut_ad(victim_trx == checker.m_wait_lock->trx);
@@ -8523,6 +8497,8 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, const trx_t* trx)
lock_deadlock_found = true;
}
+ trx_mutex_enter(trx);
+
return(victim_trx);
}
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index d26886e45f9..7d4e0459610 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -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.
Copyright (c) 2014, 2017, MariaDB Corporation.
@@ -106,12 +106,6 @@ static time_t log_last_margine_warning_time;
#define LOG_BUF_FLUSH_RATIO 2
#define LOG_BUF_FLUSH_MARGIN (LOG_BUF_WRITE_MARGIN + 4 * UNIV_PAGE_SIZE)
-/* Margin for the free space in the smallest log group, before a new query
-step which modifies the database, is started */
-
-#define LOG_CHECKPOINT_FREE_PER_THREAD (4 * UNIV_PAGE_SIZE)
-#define LOG_CHECKPOINT_EXTRA_FREE (8 * UNIV_PAGE_SIZE)
-
/* This parameter controls asynchronous making of a new checkpoint; the value
should be bigger than LOG_POOL_PREFLUSH_RATIO_SYNC */
@@ -742,14 +736,11 @@ failure:
if (!success) {
ib::error() << "Cannot continue operation. ib_logfiles are too"
- " small for innodb_thread_concurrency "
+ " small for innodb_thread_concurrency="
<< srv_thread_concurrency << ". The combined size of"
" ib_logfiles should be bigger than"
- " 200 kB * innodb_thread_concurrency. To get mysqld"
- " to start up, set innodb_thread_concurrency in"
- " my.cnf to a lower value, for example, to 8. After"
- " an ERROR-FREE shutdown of mysqld you can adjust"
- " the size of ib_logfiles. " << INNODB_PARAMETERS_MSG;
+ " 200 kB * innodb_thread_concurrency. "
+ << INNODB_PARAMETERS_MSG;
}
return(success);
@@ -2181,7 +2172,8 @@ wait_suspend_loop:
bool freed = buf_all_freed();
ut_a(freed);
- ut_a(lsn == log_sys->lsn);
+ ut_a(lsn == log_sys->lsn
+ || srv_force_recovery == SRV_FORCE_NO_LOG_REDO);
if (lsn < srv_start_lsn) {
ib::error() << "Shutdown LSN=" << lsn
@@ -2207,7 +2199,8 @@ wait_suspend_loop:
freed = buf_all_freed();
ut_a(freed);
- ut_a(lsn == log_sys->lsn);
+ ut_a(lsn == log_sys->lsn
+ || srv_force_recovery == SRV_FORCE_NO_LOG_REDO);
}
/******************************************************//**
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index adf2d3aca0a..0b46c92f00a 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -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.
Copyright (c) 2013, 2017, MariaDB Corporation.
@@ -532,6 +532,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
@@ -568,6 +569,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. */
@@ -2480,6 +2482,8 @@ loop:
ulint total_len = 0;
ulint n_recs = 0;
+ bool only_mlog_file = true;
+ ulint mlog_rec_len = 0;
for (;;) {
len = recv_parse_log_rec(
@@ -2508,6 +2512,22 @@ loop:
= recv_sys->recovered_offset + total_len;
recv_previous_parsed_rec_is_multi = 1;
+ /* MLOG_FILE_NAME redo log records doesn't make changes
+ to persistent data. If only MLOG_FILE_NAME redo
+ log record exists then reset the parsing buffer pointer
+ by changing recovered_lsn and recovered_offset. */
+ if (type != MLOG_FILE_NAME && only_mlog_file == true) {
+ only_mlog_file = false;
+ }
+
+ if (only_mlog_file) {
+ new_recovered_lsn = recv_calc_lsn_on_data_add(
+ recv_sys->recovered_lsn, len);
+ mlog_rec_len += len;
+ recv_sys->recovered_offset += len;
+ recv_sys->recovered_lsn = new_recovered_lsn;
+ }
+
total_len += len;
n_recs++;
@@ -2521,6 +2541,7 @@ loop:
" n=" ULINTPF,
recv_sys->recovered_lsn,
total_len, n_recs));
+ total_len -= mlog_rec_len;
break;
}
@@ -2740,6 +2761,7 @@ recv_scan_log_recs(
ulint data_len;
bool more_data = false;
bool apply = recv_sys->mlog_checkpoint_lsn != 0;
+ ulint recv_parsing_buf_size = RECV_PARSING_BUF_SIZE;
ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(end_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
@@ -2812,8 +2834,14 @@ recv_scan_log_recs(
parsing buffer if parse_start_lsn is already
non-zero */
+ DBUG_EXECUTE_IF(
+ "reduce_recv_parsing_buf",
+ recv_parsing_buf_size
+ = (70 * 1024);
+ );
+
if (recv_sys->len + 4 * OS_FILE_LOG_BLOCK_SIZE
- >= RECV_PARSING_BUF_SIZE) {
+ >= recv_parsing_buf_size) {
ib::error() << "Log parsing buffer overflow."
" Recovery may have failed!";
@@ -2863,7 +2891,7 @@ recv_scan_log_recs(
*store_to_hash = STORE_NO;
}
- if (recv_sys->recovered_offset > RECV_PARSING_BUF_SIZE / 4) {
+ if (recv_sys->recovered_offset > recv_parsing_buf_size / 4) {
/* Move parsing buffer data to the buffer start */
recv_sys_justify_left_parsing_buf();
@@ -2986,7 +3014,7 @@ recv_init_missing_space(dberr_t err, const recv_spaces_t::const_iterator& i)
@return error code or DB_SUCCESS */
static MY_ATTRIBUTE((warn_unused_result))
dberr_t
-recv_init_crash_recovery_spaces(void)
+recv_init_crash_recovery_spaces()
{
typedef std::set<ulint> space_set_t;
bool flag_deleted = false;
diff --git a/storage/innobase/mach/mach0data.cc b/storage/innobase/mach/mach0data.cc
index b22da00c0f1..6cb33715898 100644
--- a/storage/innobase/mach/mach0data.cc
+++ b/storage/innobase/mach/mach0data.cc
@@ -49,7 +49,22 @@ mach_parse_compressed(
/* 0nnnnnnn (7 bits) */
++*ptr;
return(static_cast<ib_uint32_t>(val));
- } else if (val < 0xC0) {
+ }
+
+ /* Workaround GCC bug
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77673:
+ the compiler moves mach_read_from_4 right to the beginning of the
+ function, causing and out-of-bounds read if we are reading a short
+ integer close to the end of buffer. */
+#if defined(__GNUC__) && (__GNUC__ >= 5) && !defined(__clang__)
+#define DEPLOY_FENCE
+#endif
+
+#ifdef DEPLOY_FENCE
+ __atomic_thread_fence(__ATOMIC_ACQUIRE);
+#endif
+
+ if (val < 0xC0) {
/* 10nnnnnn nnnnnnnn (14 bits) */
if (end_ptr >= *ptr + 2) {
val = mach_read_from_2(*ptr) & 0x3FFF;
@@ -57,7 +72,15 @@ mach_parse_compressed(
*ptr += 2;
return(static_cast<ib_uint32_t>(val));
}
- } else if (val < 0xE0) {
+ *ptr = NULL;
+ return(0);
+ }
+
+#ifdef DEPLOY_FENCE
+ __atomic_thread_fence(__ATOMIC_ACQUIRE);
+#endif
+
+ if (val < 0xE0) {
/* 110nnnnn nnnnnnnn nnnnnnnn (21 bits) */
if (end_ptr >= *ptr + 3) {
val = mach_read_from_3(*ptr) & 0x1FFFFF;
@@ -65,7 +88,15 @@ mach_parse_compressed(
*ptr += 3;
return(static_cast<ib_uint32_t>(val));
}
- } else if (val < 0xF0) {
+ *ptr = NULL;
+ return(0);
+ }
+
+#ifdef DEPLOY_FENCE
+ __atomic_thread_fence(__ATOMIC_ACQUIRE);
+#endif
+
+ if (val < 0xF0) {
/* 1110nnnn nnnnnnnn nnnnnnnn nnnnnnnn (28 bits) */
if (end_ptr >= *ptr + 4) {
val = mach_read_from_4(*ptr) & 0xFFFFFFF;
@@ -73,16 +104,24 @@ mach_parse_compressed(
*ptr += 4;
return(static_cast<ib_uint32_t>(val));
}
- } else {
- ut_ad(val == 0xF0);
-
- /* 11110000 nnnnnnnn nnnnnnnn nnnnnnnn nnnnnnnn (32 bits) */
- if (end_ptr >= *ptr + 5) {
- val = mach_read_from_4(*ptr + 1);
- ut_ad(val > 0xFFFFFFF);
- *ptr += 5;
- return(static_cast<ib_uint32_t>(val));
- }
+ *ptr = NULL;
+ return(0);
+ }
+
+#ifdef DEPLOY_FENCE
+ __atomic_thread_fence(__ATOMIC_ACQUIRE);
+#endif
+
+#undef DEPLOY_FENCE
+
+ ut_ad(val == 0xF0);
+
+ /* 11110000 nnnnnnnn nnnnnnnn nnnnnnnn nnnnnnnn (32 bits) */
+ if (end_ptr >= *ptr + 5) {
+ val = mach_read_from_4(*ptr + 1);
+ ut_ad(val > 0xFFFFFFF);
+ *ptr += 5;
+ return(static_cast<ib_uint32_t>(val));
}
*ptr = NULL;
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index c626937b0d8..d8c7d59fe27 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -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) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -580,9 +580,13 @@ but generated some redo log on a higher level, such as
MLOG_FILE_NAME records and a MLOG_CHECKPOINT marker.
The caller must invoke log_mutex_enter() and log_mutex_exit().
This is to be used at log_checkpoint().
-@param[in] checkpoint_lsn the LSN of the log checkpoint */
+@param[in] checkpoint_lsn the LSN of the log checkpoint
+@param[in] write_mlog_checkpoint Write MLOG_CHECKPOINT marker
+ if it is enabled. */
void
-mtr_t::commit_checkpoint(lsn_t checkpoint_lsn)
+mtr_t::commit_checkpoint(
+ lsn_t checkpoint_lsn,
+ bool write_mlog_checkpoint)
{
ut_ad(log_mutex_own());
ut_ad(is_active());
@@ -593,6 +597,7 @@ mtr_t::commit_checkpoint(lsn_t checkpoint_lsn)
ut_ad(m_impl.m_memo.size() == 0);
ut_ad(!srv_read_only_mode);
ut_d(m_impl.m_state = MTR_STATE_COMMITTING);
+ ut_ad(write_mlog_checkpoint || m_impl.m_n_log_recs > 1);
/* This is a dirty read, for debugging. */
ut_ad(!recv_no_log_write);
@@ -608,20 +613,24 @@ mtr_t::commit_checkpoint(lsn_t checkpoint_lsn)
&m_impl.m_log, MLOG_MULTI_REC_END, MLOG_1BYTE);
}
- byte* ptr = m_impl.m_log.push<byte*>(SIZE_OF_MLOG_CHECKPOINT);
+ if (write_mlog_checkpoint) {
+ byte* ptr = m_impl.m_log.push<byte*>(SIZE_OF_MLOG_CHECKPOINT);
#if SIZE_OF_MLOG_CHECKPOINT != 9
# error SIZE_OF_MLOG_CHECKPOINT != 9
#endif
- *ptr = MLOG_CHECKPOINT;
- mach_write_to_8(ptr + 1, checkpoint_lsn);
+ *ptr = MLOG_CHECKPOINT;
+ mach_write_to_8(ptr + 1, checkpoint_lsn);
+ }
Command cmd(this);
cmd.finish_write(m_impl.m_log.size());
cmd.release_resources();
- DBUG_PRINT("ib_log",
- ("MLOG_CHECKPOINT(" LSN_PF ") written at " LSN_PF,
- checkpoint_lsn, log_sys->lsn));
+ if (write_mlog_checkpoint) {
+ DBUG_PRINT("ib_log",
+ ("MLOG_CHECKPOINT(" LSN_PF ") written at " LSN_PF,
+ checkpoint_lsn, log_sys->lsn));
+ }
}
#ifdef UNIV_DEBUG
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 43f04186f0e..110ac6f40f1 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2012, 2017, MariaDB Corporation.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -687,10 +687,6 @@ ulint os_n_fsyncs;
static ulint os_n_file_reads_old;
static ulint os_n_file_writes_old;
static ulint os_n_fsyncs_old;
-/** Number of pending write operations */
-ulint os_n_pending_writes;
-/** Number of pending read operations */
-ulint os_n_pending_reads;
static time_t os_last_printout;
bool os_has_said_disk_full;
@@ -3500,7 +3496,8 @@ SyncFileIO::execute(Slot* slot)
/* Wait for async io to complete */
ret = GetOverlappedResult(slot->file, &slot->control, &slot->n_bytes, TRUE);
}
- return(ret ? slot->n_bytes : -1);
+
+ return(ret ? static_cast<ssize_t>(slot->n_bytes) : -1);
}
/* Startup/shutdown */
@@ -4945,14 +4942,11 @@ os_file_pwrite(
++os_n_file_writes;
- (void) my_atomic_addlint(&os_n_pending_writes, 1);
- MONITOR_ATOMIC_INC(MONITOR_OS_PENDING_WRITES);
-
+ const bool monitor = MONITOR_IS_ON(MONITOR_OS_PENDING_WRITES);
+ MONITOR_ATOMIC_INC_LOW(MONITOR_OS_PENDING_WRITES, monitor);
ssize_t n_bytes = os_file_io(type, file, const_cast<byte*>(buf),
n, offset, err);
-
- (void) my_atomic_addlint(&os_n_pending_writes, -1);
- MONITOR_ATOMIC_DEC(MONITOR_OS_PENDING_WRITES);
+ MONITOR_ATOMIC_DEC_LOW(MONITOR_OS_PENDING_WRITES, monitor);
return(n_bytes);
}
@@ -5032,13 +5026,10 @@ os_file_pread(
{
++os_n_file_reads;
- (void) my_atomic_addlint(&os_n_pending_reads, 1);
- MONITOR_ATOMIC_INC(MONITOR_OS_PENDING_READS);
-
+ const bool monitor = MONITOR_IS_ON(MONITOR_OS_PENDING_READS);
+ MONITOR_ATOMIC_INC_LOW(MONITOR_OS_PENDING_READS, monitor);
ssize_t n_bytes = os_file_io(type, file, buf, n, offset, err);
-
- (void) my_atomic_addlint(&os_n_pending_reads, -1);
- MONITOR_ATOMIC_DEC(MONITOR_OS_PENDING_READS);
+ MONITOR_ATOMIC_DEC_LOW(MONITOR_OS_PENDING_READS, monitor);
return(n_bytes);
}
@@ -7362,7 +7353,7 @@ AIO::print_segment_info(
fprintf(file, ", ");
}
- fprintf(file, "%lu", *segments);
+ fprintf(file, ULINTPF, *segments);
}
fprintf(file, "] ");
@@ -7443,8 +7434,8 @@ os_aio_print(FILE* file)
double avg_bytes_read;
for (ulint i = 0; i < srv_n_file_io_threads; ++i) {
- fprintf(file, "I/O thread %lu state: %s (%s)",
- (ulint) i,
+ fprintf(file, "I/O thread " ULINTPF " state: %s (%s)",
+ i,
srv_io_thread_op_info[i],
srv_io_thread_function[i]);
@@ -7467,19 +7458,24 @@ os_aio_print(FILE* file)
time_elapsed = 0.001 + difftime(current_time, os_last_printout);
fprintf(file,
- "Pending flushes (fsync) log: %lu; buffer pool: %lu\n"
- "%lu OS file reads, %lu OS file writes, %lu OS fsyncs\n",
- (ulint) fil_n_pending_log_flushes,
- (ulint) fil_n_pending_tablespace_flushes,
- (ulint) os_n_file_reads,
- (ulint) os_n_file_writes,
- (ulint) os_n_fsyncs);
-
- if (os_n_pending_writes != 0 || os_n_pending_reads != 0) {
+ "Pending flushes (fsync) log: " ULINTPF
+ "; buffer pool: " ULINTPF "\n"
+ ULINTPF " OS file reads, "
+ ULINTPF " OS file writes, "
+ ULINTPF " OS fsyncs\n",
+ fil_n_pending_log_flushes,
+ fil_n_pending_tablespace_flushes,
+ os_n_file_reads,
+ os_n_file_writes,
+ os_n_fsyncs);
+
+ const ulint n_reads = ulint(MONITOR_VALUE(MONITOR_OS_PENDING_READS));
+ const ulint n_writes = ulint(MONITOR_VALUE(MONITOR_OS_PENDING_WRITES));
+
+ if (n_reads != 0 || n_writes != 0) {
fprintf(file,
- "%lu pending preads, %lu pending pwrites\n",
- (ulint) os_n_pending_reads,
- (ulint) os_n_pending_writes);
+ ULINTPF " pending reads, " ULINTPF " pending writes\n",
+ n_reads, n_writes);
}
if (os_n_file_reads == os_n_file_reads_old) {
@@ -7490,7 +7486,7 @@ os_aio_print(FILE* file)
}
fprintf(file,
- "%.2f reads/s, %lu avg bytes/read,"
+ "%.2f reads/s, " ULINTPF " avg bytes/read,"
" %.2f writes/s, %.2f fsyncs/s\n",
(os_n_file_reads - os_n_file_reads_old)
/ time_elapsed,
@@ -7545,7 +7541,7 @@ AIO::to_file(FILE* file) const
{
acquire();
- fprintf(file, " %lu\n", static_cast<ulint>(m_n_reserved));
+ fprintf(file, " " ULINTPF "\n", m_n_reserved);
for (ulint i = 0; i < m_slots.size(); ++i) {
diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc
index 4012c281f8d..72199b4cf0b 100644
--- a/storage/innobase/os/os0thread.cc
+++ b/storage/innobase/os/os0thread.cc
@@ -161,9 +161,32 @@ os_thread_create_func(
return((os_thread_t)new_thread_id);
}
-/** Exits the current thread. */
+/** Waits until the specified thread completes and joins it.
+Its return value is ignored.
+@param[in,out] thread thread to join */
void
-os_thread_exit()
+os_thread_join(
+ os_thread_id_t thread)
+{
+#ifdef _WIN32
+ /* Do nothing. */
+#else
+#ifdef UNIV_DEBUG
+ const int ret =
+#endif /* UNIV_DEBUG */
+ pthread_join(thread, NULL);
+
+ /* Waiting on already-quit threads is allowed. */
+ ut_ad(ret == 0 || ret == ESRCH);
+#endif /* _WIN32 */
+}
+
+/** Exits the current thread.
+@param[in] detach if true, the thread will be detached right before
+exiting. If false, another thread is responsible for joining this thread */
+void
+os_thread_exit(
+ bool detach)
{
#ifdef UNIV_DEBUG_THREAD_CREATION
ib::info() << "Thread exits, id "
@@ -184,7 +207,9 @@ os_thread_exit()
ExitThread(0);
#else
mutex_exit(&thread_mutex);
- pthread_detach(pthread_self());
+ if (detach) {
+ pthread_detach(pthread_self());
+ }
pthread_exit(NULL);
#endif
}
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
index f2ba1c64229..df7d26c63e8 100644
--- a/storage/innobase/page/page0cur.cc
+++ b/storage/innobase/page/page0cur.cc
@@ -1324,7 +1324,8 @@ use_heap:
data_len = rec_offs_data_size(offsets);
fprintf(stderr, "InnoDB: Error: current_rec == insert_rec "
- " extra_len %lu data_len %lu insert_buf %p rec %p\n",
+ " extra_len " ULINTPF
+ " data_len " ULINTPF " insert_buf %p rec %p\n",
extra_len, data_len, insert_buf, rec);
fprintf(stderr, "InnoDB; Physical record: \n");
rec_print(stderr, rec, index);
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index 11b8838ce2d..e718081ed63 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -2,7 +2,7 @@
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2014, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -4973,19 +4973,7 @@ ibool
page_zip_verify_checksum(
/*=====================*/
const void* data, /*!< in: compressed page */
- ulint size /*!< in: size of compressed page */
-#ifdef UNIV_INNOCHECKSUM
- /* these variables are used only for innochecksum tool. */
- ,uintmax_t page_no, /*!< in: page number of
- given read_buf */
- bool strict_check, /*!< in: true if strict-check
- option is enable */
- bool is_log_enabled, /*!< in: true if log option is
- enabled */
- FILE* log_file /*!< in: file pointer to
- log_file */
-#endif /* UNIV_INNOCHECKSUM */
-)
+ ulint size) /*!< in: size of compressed page */
{
const unsigned char* p = static_cast<const unsigned char*>(data)
+ FIL_PAGE_SPACE_OR_CHKSUM;
@@ -5023,9 +5011,9 @@ page_zip_verify_checksum(
break;
}
if (i >= size) {
- if (is_log_enabled) {
+ if (log_file) {
fprintf(log_file, "Page::%lu is empty and"
- " uncorrupted\n", page_no);
+ " uncorrupted\n", cur_page_num);
}
return(TRUE);
@@ -5061,28 +5049,28 @@ page_zip_verify_checksum(
const uint32_t calc = page_zip_calc_checksum(data, size, curr_algo);
#ifdef UNIV_INNOCHECKSUM
- if (is_log_enabled) {
+ if (log_file) {
fprintf(log_file, "page::%lu;"
" %s checksum: calculated = %u;"
- " recorded = %u\n", page_no,
+ " recorded = %u\n", cur_page_num,
buf_checksum_algorithm_name(
static_cast<srv_checksum_algorithm_t>(
srv_checksum_algorithm)),
calc, stored);
}
- if (!strict_check) {
+ if (!strict_verify) {
const uint32_t crc32 = page_zip_calc_checksum(
data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
- if (is_log_enabled) {
+ if (log_file) {
fprintf(log_file, "page::%lu: crc32 checksum:"
" calculated = %u; recorded = %u\n",
- page_no, crc32, stored);
+ cur_page_num, crc32, stored);
fprintf(log_file, "page::%lu: none checksum:"
" calculated = %lu; recorded = %u\n",
- page_no, BUF_NO_CHECKSUM_MAGIC, stored);
+ cur_page_num, BUF_NO_CHECKSUM_MAGIC, stored);
}
}
#endif /* UNIV_INNOCHECKSUM */
diff --git a/storage/innobase/pars/pars0grm.cc b/storage/innobase/pars/pars0grm.cc
index ef732209978..a0a09771106 100644
--- a/storage/innobase/pars/pars0grm.cc
+++ b/storage/innobase/pars/pars0grm.cc
@@ -119,104 +119,101 @@ extern int yydebug;
PARS_INT_LIT = 258,
PARS_FLOAT_LIT = 259,
PARS_STR_LIT = 260,
- PARS_FIXBINARY_LIT = 261,
- PARS_BLOB_LIT = 262,
- PARS_NULL_LIT = 263,
- PARS_ID_TOKEN = 264,
- PARS_AND_TOKEN = 265,
- PARS_OR_TOKEN = 266,
- PARS_NOT_TOKEN = 267,
- PARS_GE_TOKEN = 268,
- PARS_LE_TOKEN = 269,
- PARS_NE_TOKEN = 270,
- PARS_PROCEDURE_TOKEN = 271,
- PARS_IN_TOKEN = 272,
- PARS_OUT_TOKEN = 273,
- PARS_BINARY_TOKEN = 274,
- PARS_BLOB_TOKEN = 275,
- PARS_INT_TOKEN = 276,
- PARS_INTEGER_TOKEN = 277,
- PARS_FLOAT_TOKEN = 278,
- PARS_CHAR_TOKEN = 279,
- PARS_IS_TOKEN = 280,
- PARS_BEGIN_TOKEN = 281,
- PARS_END_TOKEN = 282,
- PARS_IF_TOKEN = 283,
- PARS_THEN_TOKEN = 284,
- PARS_ELSE_TOKEN = 285,
- PARS_ELSIF_TOKEN = 286,
- PARS_LOOP_TOKEN = 287,
- PARS_WHILE_TOKEN = 288,
- PARS_RETURN_TOKEN = 289,
- PARS_SELECT_TOKEN = 290,
- PARS_SUM_TOKEN = 291,
- PARS_COUNT_TOKEN = 292,
- PARS_DISTINCT_TOKEN = 293,
- PARS_FROM_TOKEN = 294,
- PARS_WHERE_TOKEN = 295,
- PARS_FOR_TOKEN = 296,
- PARS_DDOT_TOKEN = 297,
- PARS_READ_TOKEN = 298,
- PARS_ORDER_TOKEN = 299,
- PARS_BY_TOKEN = 300,
- PARS_ASC_TOKEN = 301,
- PARS_DESC_TOKEN = 302,
- PARS_INSERT_TOKEN = 303,
- PARS_INTO_TOKEN = 304,
- PARS_VALUES_TOKEN = 305,
- PARS_UPDATE_TOKEN = 306,
- PARS_SET_TOKEN = 307,
- PARS_DELETE_TOKEN = 308,
- PARS_CURRENT_TOKEN = 309,
- PARS_OF_TOKEN = 310,
- PARS_CREATE_TOKEN = 311,
- PARS_TABLE_TOKEN = 312,
- PARS_INDEX_TOKEN = 313,
- PARS_UNIQUE_TOKEN = 314,
- PARS_CLUSTERED_TOKEN = 315,
- PARS_ON_TOKEN = 316,
- PARS_ASSIGN_TOKEN = 317,
- PARS_DECLARE_TOKEN = 318,
- PARS_CURSOR_TOKEN = 319,
- PARS_SQL_TOKEN = 320,
- PARS_OPEN_TOKEN = 321,
- PARS_FETCH_TOKEN = 322,
- PARS_CLOSE_TOKEN = 323,
- PARS_NOTFOUND_TOKEN = 324,
- PARS_TO_CHAR_TOKEN = 325,
- PARS_TO_NUMBER_TOKEN = 326,
- PARS_TO_BINARY_TOKEN = 327,
- PARS_BINARY_TO_NUMBER_TOKEN = 328,
- PARS_SUBSTR_TOKEN = 329,
- PARS_REPLSTR_TOKEN = 330,
- PARS_CONCAT_TOKEN = 331,
- PARS_INSTR_TOKEN = 332,
- PARS_LENGTH_TOKEN = 333,
- PARS_SYSDATE_TOKEN = 334,
- PARS_PRINTF_TOKEN = 335,
- PARS_ASSERT_TOKEN = 336,
- PARS_RND_TOKEN = 337,
- PARS_RND_STR_TOKEN = 338,
- PARS_ROW_PRINTF_TOKEN = 339,
- PARS_COMMIT_TOKEN = 340,
- PARS_ROLLBACK_TOKEN = 341,
- PARS_WORK_TOKEN = 342,
- PARS_UNSIGNED_TOKEN = 343,
- PARS_EXIT_TOKEN = 344,
- PARS_FUNCTION_TOKEN = 345,
- PARS_LOCK_TOKEN = 346,
- PARS_SHARE_TOKEN = 347,
- PARS_MODE_TOKEN = 348,
- PARS_LIKE_TOKEN = 349,
- PARS_LIKE_TOKEN_EXACT = 350,
- PARS_LIKE_TOKEN_PREFIX = 351,
- PARS_LIKE_TOKEN_SUFFIX = 352,
- PARS_LIKE_TOKEN_SUBSTR = 353,
- PARS_TABLE_NAME_TOKEN = 354,
- PARS_COMPACT_TOKEN = 355,
- PARS_BLOCK_SIZE_TOKEN = 356,
- PARS_BIGINT_TOKEN = 357,
- NEG = 358
+ PARS_NULL_LIT = 261,
+ PARS_ID_TOKEN = 262,
+ PARS_AND_TOKEN = 263,
+ PARS_OR_TOKEN = 264,
+ PARS_NOT_TOKEN = 265,
+ PARS_GE_TOKEN = 266,
+ PARS_LE_TOKEN = 267,
+ PARS_NE_TOKEN = 268,
+ PARS_PROCEDURE_TOKEN = 269,
+ PARS_IN_TOKEN = 270,
+ PARS_OUT_TOKEN = 271,
+ PARS_BINARY_TOKEN = 272,
+ PARS_BLOB_TOKEN = 273,
+ PARS_INT_TOKEN = 274,
+ PARS_FLOAT_TOKEN = 275,
+ PARS_CHAR_TOKEN = 276,
+ PARS_IS_TOKEN = 277,
+ PARS_BEGIN_TOKEN = 278,
+ PARS_END_TOKEN = 279,
+ PARS_IF_TOKEN = 280,
+ PARS_THEN_TOKEN = 281,
+ PARS_ELSE_TOKEN = 282,
+ PARS_ELSIF_TOKEN = 283,
+ PARS_LOOP_TOKEN = 284,
+ PARS_WHILE_TOKEN = 285,
+ PARS_RETURN_TOKEN = 286,
+ PARS_SELECT_TOKEN = 287,
+ PARS_SUM_TOKEN = 288,
+ PARS_COUNT_TOKEN = 289,
+ PARS_DISTINCT_TOKEN = 290,
+ PARS_FROM_TOKEN = 291,
+ PARS_WHERE_TOKEN = 292,
+ PARS_FOR_TOKEN = 293,
+ PARS_DDOT_TOKEN = 294,
+ PARS_READ_TOKEN = 295,
+ PARS_ORDER_TOKEN = 296,
+ PARS_BY_TOKEN = 297,
+ PARS_ASC_TOKEN = 298,
+ PARS_DESC_TOKEN = 299,
+ PARS_INSERT_TOKEN = 300,
+ PARS_INTO_TOKEN = 301,
+ PARS_VALUES_TOKEN = 302,
+ PARS_UPDATE_TOKEN = 303,
+ PARS_SET_TOKEN = 304,
+ PARS_DELETE_TOKEN = 305,
+ PARS_CURRENT_TOKEN = 306,
+ PARS_OF_TOKEN = 307,
+ PARS_CREATE_TOKEN = 308,
+ PARS_TABLE_TOKEN = 309,
+ PARS_INDEX_TOKEN = 310,
+ PARS_UNIQUE_TOKEN = 311,
+ PARS_CLUSTERED_TOKEN = 312,
+ PARS_ON_TOKEN = 313,
+ PARS_ASSIGN_TOKEN = 314,
+ PARS_DECLARE_TOKEN = 315,
+ PARS_CURSOR_TOKEN = 316,
+ PARS_SQL_TOKEN = 317,
+ PARS_OPEN_TOKEN = 318,
+ PARS_FETCH_TOKEN = 319,
+ PARS_CLOSE_TOKEN = 320,
+ PARS_NOTFOUND_TOKEN = 321,
+ PARS_TO_CHAR_TOKEN = 322,
+ PARS_TO_NUMBER_TOKEN = 323,
+ PARS_TO_BINARY_TOKEN = 324,
+ PARS_BINARY_TO_NUMBER_TOKEN = 325,
+ PARS_SUBSTR_TOKEN = 326,
+ PARS_REPLSTR_TOKEN = 327,
+ PARS_CONCAT_TOKEN = 328,
+ PARS_INSTR_TOKEN = 329,
+ PARS_LENGTH_TOKEN = 330,
+ PARS_SYSDATE_TOKEN = 331,
+ PARS_PRINTF_TOKEN = 332,
+ PARS_ASSERT_TOKEN = 333,
+ PARS_RND_TOKEN = 334,
+ PARS_RND_STR_TOKEN = 335,
+ PARS_ROW_PRINTF_TOKEN = 336,
+ PARS_COMMIT_TOKEN = 337,
+ PARS_ROLLBACK_TOKEN = 338,
+ PARS_WORK_TOKEN = 339,
+ PARS_UNSIGNED_TOKEN = 340,
+ PARS_EXIT_TOKEN = 341,
+ PARS_FUNCTION_TOKEN = 342,
+ PARS_LOCK_TOKEN = 343,
+ PARS_SHARE_TOKEN = 344,
+ PARS_MODE_TOKEN = 345,
+ PARS_LIKE_TOKEN = 346,
+ PARS_LIKE_TOKEN_EXACT = 347,
+ PARS_LIKE_TOKEN_PREFIX = 348,
+ PARS_LIKE_TOKEN_SUFFIX = 349,
+ PARS_LIKE_TOKEN_SUBSTR = 350,
+ PARS_TABLE_NAME_TOKEN = 351,
+ PARS_COMPACT_TOKEN = 352,
+ PARS_BLOCK_SIZE_TOKEN = 353,
+ PARS_BIGINT_TOKEN = 354,
+ NEG = 355
};
#endif
@@ -236,7 +233,7 @@ int yyparse (void);
/* Copy the second part of user declarations. */
-#line 240 "pars0grm.cc" /* yacc.c:358 */
+#line 237 "pars0grm.cc" /* yacc.c:358 */
#ifdef short
# undef short
@@ -478,21 +475,21 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 5
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 824
+#define YYLAST 780
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 119
+#define YYNTOKENS 116
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 72
/* YYNRULES -- Number of rules. */
-#define YYNRULES 181
+#define YYNRULES 178
/* YYNSTATES -- Number of states. */
-#define YYNSTATES 348
+#define YYNSTATES 345
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 358
+#define YYMAXUTOK 355
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -504,16 +501,16 @@ static const yytype_uint8 yytranslate[] =
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 111, 2, 2,
- 113, 114, 108, 107, 116, 106, 2, 109, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 112,
- 104, 103, 105, 115, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 108, 2, 2,
+ 110, 111, 105, 104, 113, 103, 2, 106, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 109,
+ 101, 100, 102, 112, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 117, 2, 118, 2, 2, 2, 2,
+ 2, 2, 2, 114, 2, 115, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -536,32 +533,31 @@ static const yytype_uint8 yytranslate[] =
65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- 95, 96, 97, 98, 99, 100, 101, 102, 110
+ 95, 96, 97, 98, 99, 107
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 163, 163, 166, 167, 168, 169, 170, 171, 172,
- 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
- 183, 184, 185, 186, 187, 191, 192, 197, 198, 200,
- 201, 202, 203, 204, 205, 206, 207, 208, 209, 210,
- 211, 212, 213, 214, 216, 217, 218, 219, 220, 221,
- 222, 223, 224, 226, 231, 232, 233, 234, 236, 237,
- 238, 239, 240, 241, 242, 245, 247, 248, 252, 258,
- 263, 264, 265, 269, 273, 274, 279, 280, 281, 286,
- 287, 288, 292, 293, 298, 304, 311, 312, 313, 318,
- 320, 323, 327, 328, 332, 333, 338, 339, 344, 345,
- 346, 350, 351, 358, 373, 378, 381, 389, 395, 396,
- 401, 407, 416, 424, 432, 439, 447, 455, 461, 468,
- 474, 475, 480, 481, 483, 487, 494, 500, 510, 514,
- 518, 525, 532, 536, 544, 553, 554, 559, 560, 565,
- 566, 572, 573, 579, 580, 585, 586, 591, 602, 603,
- 608, 609, 613, 614, 618, 632, 633, 637, 642, 647,
- 648, 649, 650, 651, 652, 656, 661, 669, 670, 671,
- 676, 682, 684, 685, 689, 697, 703, 704, 707, 709,
- 710, 714
+ 0, 160, 160, 163, 164, 165, 166, 167, 168, 169,
+ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ 180, 181, 182, 183, 184, 188, 189, 194, 195, 197,
+ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
+ 208, 209, 211, 212, 213, 214, 215, 216, 217, 218,
+ 219, 221, 226, 227, 228, 229, 231, 232, 233, 234,
+ 235, 236, 237, 240, 242, 243, 247, 253, 258, 259,
+ 260, 264, 268, 269, 274, 275, 276, 281, 282, 283,
+ 287, 288, 293, 299, 306, 307, 308, 313, 315, 318,
+ 322, 323, 327, 328, 333, 334, 339, 340, 341, 345,
+ 346, 353, 368, 373, 376, 384, 390, 391, 396, 402,
+ 411, 419, 427, 434, 442, 450, 456, 463, 469, 470,
+ 475, 476, 478, 482, 489, 495, 505, 509, 513, 520,
+ 527, 531, 539, 548, 549, 554, 555, 560, 561, 567,
+ 568, 574, 575, 580, 581, 586, 597, 598, 603, 604,
+ 608, 609, 613, 627, 628, 632, 637, 642, 643, 644,
+ 645, 646, 650, 655, 663, 664, 665, 670, 676, 678,
+ 679, 683, 691, 697, 698, 701, 703, 704, 708
};
#endif
@@ -571,19 +567,18 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "PARS_INT_LIT", "PARS_FLOAT_LIT",
- "PARS_STR_LIT", "PARS_FIXBINARY_LIT", "PARS_BLOB_LIT", "PARS_NULL_LIT",
- "PARS_ID_TOKEN", "PARS_AND_TOKEN", "PARS_OR_TOKEN", "PARS_NOT_TOKEN",
- "PARS_GE_TOKEN", "PARS_LE_TOKEN", "PARS_NE_TOKEN",
- "PARS_PROCEDURE_TOKEN", "PARS_IN_TOKEN", "PARS_OUT_TOKEN",
- "PARS_BINARY_TOKEN", "PARS_BLOB_TOKEN", "PARS_INT_TOKEN",
- "PARS_INTEGER_TOKEN", "PARS_FLOAT_TOKEN", "PARS_CHAR_TOKEN",
- "PARS_IS_TOKEN", "PARS_BEGIN_TOKEN", "PARS_END_TOKEN", "PARS_IF_TOKEN",
- "PARS_THEN_TOKEN", "PARS_ELSE_TOKEN", "PARS_ELSIF_TOKEN",
- "PARS_LOOP_TOKEN", "PARS_WHILE_TOKEN", "PARS_RETURN_TOKEN",
- "PARS_SELECT_TOKEN", "PARS_SUM_TOKEN", "PARS_COUNT_TOKEN",
- "PARS_DISTINCT_TOKEN", "PARS_FROM_TOKEN", "PARS_WHERE_TOKEN",
- "PARS_FOR_TOKEN", "PARS_DDOT_TOKEN", "PARS_READ_TOKEN",
- "PARS_ORDER_TOKEN", "PARS_BY_TOKEN", "PARS_ASC_TOKEN", "PARS_DESC_TOKEN",
+ "PARS_STR_LIT", "PARS_NULL_LIT", "PARS_ID_TOKEN", "PARS_AND_TOKEN",
+ "PARS_OR_TOKEN", "PARS_NOT_TOKEN", "PARS_GE_TOKEN", "PARS_LE_TOKEN",
+ "PARS_NE_TOKEN", "PARS_PROCEDURE_TOKEN", "PARS_IN_TOKEN",
+ "PARS_OUT_TOKEN", "PARS_BINARY_TOKEN", "PARS_BLOB_TOKEN",
+ "PARS_INT_TOKEN", "PARS_FLOAT_TOKEN", "PARS_CHAR_TOKEN", "PARS_IS_TOKEN",
+ "PARS_BEGIN_TOKEN", "PARS_END_TOKEN", "PARS_IF_TOKEN", "PARS_THEN_TOKEN",
+ "PARS_ELSE_TOKEN", "PARS_ELSIF_TOKEN", "PARS_LOOP_TOKEN",
+ "PARS_WHILE_TOKEN", "PARS_RETURN_TOKEN", "PARS_SELECT_TOKEN",
+ "PARS_SUM_TOKEN", "PARS_COUNT_TOKEN", "PARS_DISTINCT_TOKEN",
+ "PARS_FROM_TOKEN", "PARS_WHERE_TOKEN", "PARS_FOR_TOKEN",
+ "PARS_DDOT_TOKEN", "PARS_READ_TOKEN", "PARS_ORDER_TOKEN",
+ "PARS_BY_TOKEN", "PARS_ASC_TOKEN", "PARS_DESC_TOKEN",
"PARS_INSERT_TOKEN", "PARS_INTO_TOKEN", "PARS_VALUES_TOKEN",
"PARS_UPDATE_TOKEN", "PARS_SET_TOKEN", "PARS_DELETE_TOKEN",
"PARS_CURRENT_TOKEN", "PARS_OF_TOKEN", "PARS_CREATE_TOKEN",
@@ -646,15 +641,15 @@ static const yytype_uint16 yytoknum[] =
325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
- 355, 356, 357, 61, 60, 62, 45, 43, 42, 47,
- 358, 37, 59, 40, 41, 63, 44, 123, 125
+ 61, 60, 62, 45, 43, 42, 47, 355, 37, 59,
+ 40, 41, 63, 44, 123, 125
};
# endif
-#define YYPACT_NINF -179
+#define YYPACT_NINF -176
#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-179)))
+ (!!((Yystate) == (-176)))
#define YYTABLE_NINF -1
@@ -665,41 +660,41 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */
static const yytype_int16 yypact[] =
{
- 35, 50, 72, -37, -36, -179, -179, 67, 49, -179,
- -78, 13, 13, 53, 67, -179, -179, -179, -179, -179,
- -179, -179, -179, 76, -179, 13, -179, 7, -31, -34,
- -179, -179, -179, -179, -14, -179, 77, 83, 583, -179,
- 78, -10, 42, 284, 284, -179, 17, 96, 58, 2,
- 69, -16, 105, 107, 108, -179, -179, -179, 84, 31,
- 37, -179, 113, -179, 403, -179, 14, 15, 19, -4,
- 21, 89, 23, 24, 89, 25, 26, 32, 33, 44,
- 45, 47, 51, 52, 54, 55, 56, 57, 60, 62,
- 63, 84, -179, 284, -179, -179, -179, -179, -179, -179,
- 43, 284, 59, -179, -179, -179, -179, -179, -179, -179,
- -179, -179, -179, -179, 284, 284, 571, 70, 612, 73,
- 74, -179, 699, -179, -45, 95, 145, 2, -179, -179,
- 136, 2, 2, -179, 129, -179, 116, -179, -179, -179,
- -179, 79, -179, -179, -179, 284, -179, 80, -179, -179,
- 194, -179, -179, -179, -179, -179, -179, -179, -179, -179,
- -179, -179, -179, -179, -179, -179, -179, -179, -179, -179,
- -179, -179, -179, 82, 699, 121, 715, 122, 3, 210,
- 284, 284, 284, 284, 284, 583, 190, 284, 284, 284,
- 284, 284, 284, 284, 284, 583, 284, -29, 187, 173,
- 2, 284, -179, 195, -179, 92, -179, 149, 199, 97,
- 699, -72, 284, 156, 699, -179, -179, -179, -179, 715,
- 715, 4, 4, 699, 343, -179, 4, 4, 4, 12,
- 12, 3, 3, -69, 463, 226, 204, 101, -179, 100,
- -179, -32, -179, 642, 114, -179, 103, 217, 218, 117,
- -179, 100, -179, -66, -179, 284, -59, 220, 583, 284,
- -179, 202, 207, -179, 203, -179, 128, -179, 244, 284,
- 2, 216, 284, 284, 195, 13, -179, -52, 200, 146,
- 144, 154, 699, -179, -179, 583, 672, -179, 246, -179,
- -179, -179, -179, 224, 189, 679, 699, -179, 165, 181,
- 217, 2, -179, -179, -179, 583, -179, -179, 265, 239,
- 583, 281, 197, -179, 193, -179, 182, 583, 205, 253,
- -179, 523, 185, -179, 289, 206, -179, 293, 212, 294,
- 274, -179, 300, -179, 307, -179, -51, -179, 22, -179,
- -179, -179, -179, 302, -179, -179, -179, -179
+ 20, 21, 41, -64, -59, -176, -176, 48, 54, -176,
+ -74, 12, 12, 45, 48, -176, -176, -176, -176, -176,
+ -176, -176, 69, -176, 12, -176, 8, -32, -43, -176,
+ -176, -176, -176, -13, -176, 72, 81, 445, -176, 75,
+ -11, 42, 530, 530, -176, 16, 99, 67, -3, 78,
+ -14, 108, 109, 110, -176, -176, -176, 86, 36, 44,
+ -176, 122, -176, 216, -176, 22, 23, 25, 6, 26,
+ 93, 27, 33, 93, 46, 51, 53, 56, 61, 63,
+ 64, 66, 68, 70, 71, 76, 79, 89, 94, 95,
+ 86, -176, 530, -176, -176, -176, -176, 43, 530, 49,
+ -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,
+ -176, 530, 530, 570, 77, 603, 80, 96, -176, 674,
+ -176, -38, 118, 161, -3, -176, -176, 129, -3, -3,
+ -176, 148, -176, 163, -176, -176, -176, -176, 97, -176,
+ -176, -176, 530, -176, 100, -176, -176, 481, -176, -176,
+ -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,
+ -176, -176, -176, -176, -176, -176, -176, -176, -176, -176,
+ 102, 674, 149, 220, 155, 14, 91, 530, 530, 530,
+ 530, 530, 445, 219, 530, 530, 530, 530, 530, 530,
+ 530, 530, 445, 530, -24, 218, 267, -3, 530, -176,
+ 221, -176, 117, -176, 179, 228, 124, 674, -65, 530,
+ 185, 674, -176, -176, -176, -176, 220, 220, 19, 19,
+ 674, 136, -176, 19, 19, 19, 3, 3, 14, 14,
+ -57, 326, 554, 231, 128, -176, 130, -176, -1, -176,
+ 610, 142, -176, 131, 238, 242, 141, -176, 130, -176,
+ -52, -176, 530, -51, 246, 445, 530, -176, 227, 233,
+ -176, 229, -176, 151, -176, 252, 530, -3, 225, 530,
+ 530, 221, 12, -176, -48, 207, 156, 153, 164, 674,
+ -176, -176, 445, 626, -176, 250, -176, -176, -176, -176,
+ 230, 194, 655, 674, -176, 173, 187, 238, -3, -176,
+ -176, -176, 445, -176, -176, 270, 245, 445, 284, 204,
+ -176, 192, -176, 181, 445, 203, 253, -176, 386, 193,
+ -176, 286, 205, -176, 296, 217, 299, 279, -176, 303,
+ -176, 307, -176, -47, -176, 30, -176, -176, -176, -176,
+ 305, -176, -176, -176, -176
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -707,67 +702,67 @@ static const yytype_int16 yypact[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 0, 0, 0, 0, 1, 2, 167, 0, 168,
- 0, 0, 0, 0, 0, 163, 164, 159, 160, 162,
- 161, 165, 166, 171, 169, 0, 172, 178, 0, 0,
- 173, 176, 177, 179, 0, 170, 0, 0, 0, 180,
- 0, 0, 0, 0, 0, 129, 86, 0, 0, 0,
- 0, 150, 0, 0, 0, 70, 71, 72, 0, 0,
- 0, 128, 0, 25, 0, 3, 0, 0, 0, 0,
- 0, 92, 0, 0, 92, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 2, 164, 0, 165,
+ 0, 0, 0, 0, 0, 160, 161, 157, 159, 158,
+ 162, 163, 168, 166, 0, 169, 175, 0, 0, 170,
+ 173, 174, 176, 0, 167, 0, 0, 0, 177, 0,
+ 0, 0, 0, 0, 127, 84, 0, 0, 0, 0,
+ 148, 0, 0, 0, 68, 69, 70, 0, 0, 0,
+ 126, 0, 25, 0, 3, 0, 0, 0, 0, 0,
+ 90, 0, 0, 90, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 175, 0, 29, 30, 31, 32, 33, 34,
- 27, 0, 35, 54, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 0, 0, 0, 0, 0, 0,
- 0, 89, 82, 87, 91, 0, 0, 0, 155, 156,
- 0, 0, 0, 151, 152, 130, 0, 131, 117, 157,
- 158, 0, 181, 26, 4, 79, 11, 0, 106, 12,
- 0, 112, 113, 16, 17, 115, 116, 14, 15, 13,
- 10, 8, 5, 6, 7, 9, 18, 20, 19, 23,
- 24, 21, 22, 0, 118, 0, 51, 0, 40, 0,
+ 0, 172, 0, 29, 30, 31, 32, 27, 0, 33,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 62, 0, 0, 0, 0, 0, 0, 0, 87, 80,
+ 85, 89, 0, 0, 0, 153, 154, 0, 0, 0,
+ 149, 150, 128, 0, 129, 115, 155, 156, 0, 178,
+ 26, 4, 77, 11, 0, 104, 12, 0, 110, 111,
+ 16, 17, 113, 114, 14, 15, 13, 10, 8, 5,
+ 6, 7, 9, 18, 20, 19, 23, 24, 21, 22,
+ 0, 116, 0, 49, 0, 38, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 79, 0, 0, 0, 76, 0,
- 0, 0, 104, 0, 114, 0, 153, 0, 76, 65,
- 80, 0, 79, 0, 93, 174, 52, 53, 41, 49,
- 50, 46, 47, 48, 122, 43, 42, 44, 45, 37,
- 36, 38, 39, 0, 0, 0, 0, 0, 77, 90,
- 88, 92, 74, 0, 0, 108, 111, 0, 0, 77,
- 133, 132, 66, 0, 69, 0, 0, 0, 0, 0,
- 120, 124, 0, 28, 0, 85, 0, 83, 0, 0,
- 0, 94, 0, 0, 0, 0, 135, 0, 0, 0,
- 0, 0, 81, 105, 110, 123, 0, 121, 0, 126,
- 84, 78, 75, 0, 96, 0, 107, 109, 137, 143,
- 0, 0, 73, 68, 67, 0, 125, 95, 0, 101,
- 0, 0, 139, 144, 145, 136, 0, 119, 0, 0,
- 103, 0, 0, 140, 141, 0, 147, 0, 0, 0,
- 0, 138, 0, 134, 0, 148, 0, 97, 98, 127,
- 142, 146, 154, 0, 99, 100, 102, 149
+ 0, 77, 0, 0, 0, 74, 0, 0, 0, 102,
+ 0, 112, 0, 151, 0, 74, 63, 78, 0, 77,
+ 0, 91, 171, 50, 51, 39, 47, 48, 44, 45,
+ 46, 120, 41, 40, 42, 43, 35, 34, 36, 37,
+ 0, 0, 0, 0, 0, 75, 88, 86, 90, 72,
+ 0, 0, 106, 109, 0, 0, 75, 131, 130, 64,
+ 0, 67, 0, 0, 0, 0, 0, 118, 122, 0,
+ 28, 0, 83, 0, 81, 0, 0, 0, 92, 0,
+ 0, 0, 0, 133, 0, 0, 0, 0, 0, 79,
+ 103, 108, 121, 0, 119, 0, 124, 82, 76, 73,
+ 0, 94, 0, 105, 107, 135, 141, 0, 0, 71,
+ 66, 65, 0, 123, 93, 0, 99, 0, 0, 137,
+ 142, 143, 134, 0, 117, 0, 0, 101, 0, 0,
+ 138, 139, 0, 145, 0, 0, 0, 0, 136, 0,
+ 132, 0, 146, 0, 95, 96, 125, 140, 144, 152,
+ 0, 97, 98, 100, 147
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -179, -179, -63, -178, -41, -179, -179, -179, -179, -179,
- -179, -179, 104, -154, 123, -179, -179, -68, -179, -179,
- -179, -179, -30, -179, -179, 64, -179, 247, -179, -179,
- -179, -179, -179, -179, -179, -179, 65, -179, -179, -179,
- -179, -179, -179, -179, -179, -179, -179, 27, -179, -179,
- -179, -179, -179, -179, -179, -179, -179, -179, -179, -117,
- -179, -179, -12, 309, -179, 298, -179, -179, -179, 303,
- -179, -179
+ -176, -176, -62, -175, -40, -176, -176, -176, -176, -176,
+ -176, -176, 111, -166, 119, -176, -176, -67, -176, -176,
+ -176, -176, -33, -176, -176, 47, -176, 240, -176, -176,
+ -176, -176, -176, -176, -176, -176, 59, -176, -176, -176,
+ -176, -176, -176, -176, -176, -176, -176, 17, -176, -176,
+ -176, -176, -176, -176, -176, -176, -176, -176, -176, -115,
+ -176, -176, -12, 313, -176, 293, -176, -176, -176, 295,
+ -176, -176
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 2, 63, 64, 210, 117, 253, 65, 66, 67,
- 250, 241, 239, 211, 123, 124, 125, 151, 294, 309,
- 346, 320, 68, 69, 70, 245, 246, 152, 71, 72,
- 73, 74, 75, 76, 77, 78, 260, 261, 262, 79,
- 80, 81, 82, 83, 84, 85, 86, 276, 277, 312,
- 324, 333, 314, 326, 87, 336, 134, 207, 88, 130,
- 89, 90, 21, 9, 10, 26, 27, 31, 32, 33,
- 34, 3
+ -1, 2, 62, 63, 207, 114, 250, 64, 65, 66,
+ 247, 238, 236, 208, 120, 121, 122, 148, 291, 306,
+ 343, 317, 67, 68, 69, 242, 243, 149, 70, 71,
+ 72, 73, 74, 75, 76, 77, 257, 258, 259, 78,
+ 79, 80, 81, 82, 83, 84, 85, 273, 274, 309,
+ 321, 330, 311, 323, 86, 333, 131, 204, 87, 127,
+ 88, 89, 20, 9, 10, 25, 26, 30, 31, 32,
+ 33, 3
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@@ -775,241 +770,232 @@ static const yytype_int16 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint16 yytable[] =
{
- 22, 143, 116, 118, 198, 122, 155, 224, 269, 236,
- 202, 128, 38, 28, 204, 205, 25, 234, 184, 184,
- 94, 95, 96, 97, 98, 99, 100, 184, 138, 101,
- 36, 46, 15, 16, 17, 18, 13, 19, 14, 148,
- 233, 132, 254, 133, 255, 263, 147, 255, 280, 29,
- 281, 1, 174, 119, 120, 283, 37, 255, 256, 4,
- 176, 173, 299, 342, 300, 343, 11, 12, 344, 345,
- 29, 199, 5, 178, 179, 6, 8, 7, 23, 237,
- 285, 35, 102, 242, 270, 25, 40, 103, 104, 105,
- 106, 107, 41, 108, 109, 110, 111, 186, 186, 112,
- 113, 129, 92, 91, 93, 126, 186, 127, 131, 214,
- 190, 191, 192, 193, 135, 20, 136, 137, 139, 46,
- 192, 193, 141, 114, 140, 121, 144, 317, 145, 150,
- 115, 146, 321, 149, 200, 153, 154, 157, 158, 219,
- 220, 221, 222, 223, 159, 160, 226, 227, 228, 229,
- 230, 231, 232, 292, 175, 235, 161, 162, 122, 163,
- 243, 143, 201, 164, 165, 208, 166, 167, 168, 169,
- 177, 143, 170, 271, 171, 172, 94, 95, 96, 97,
- 98, 99, 100, 194, 316, 101, 196, 197, 203, 206,
- 216, 217, 209, 212, 215, 225, 238, 94, 95, 96,
- 97, 98, 99, 100, 244, 247, 101, 248, 249, 119,
- 120, 257, 252, 266, 282, 267, 268, 273, 286, 274,
- 180, 181, 143, 182, 183, 184, 275, 278, 214, 284,
- 279, 295, 296, 259, 288, 289, 180, 181, 102, 182,
- 183, 184, 290, 103, 104, 105, 106, 107, 213, 108,
- 109, 110, 111, 291, 143, 112, 113, 293, 143, 102,
- 302, 301, 303, 298, 103, 104, 105, 106, 107, 304,
- 108, 109, 110, 111, 306, 307, 112, 113, 311, 114,
- 308, 313, 318, 319, 322, 323, 115, 94, 95, 96,
- 97, 98, 99, 100, 325, 327, 101, 328, 329, 331,
- 114, 332, 335, 338, 186, 337, 339, 115, 340, 334,
- 341, 347, 251, 187, 188, 189, 190, 191, 192, 193,
- 186, 156, 240, 24, 218, 30, 287, 315, 0, 187,
- 188, 189, 190, 191, 192, 193, 0, 39, 297, 0,
- 265, 0, 0, 0, 0, 0, 0, 0, 0, 102,
- 0, 0, 42, 0, 103, 104, 105, 106, 107, 0,
- 108, 109, 110, 111, 0, 0, 112, 113, 0, 0,
- 0, 43, 0, 258, 259, 0, 44, 45, 46, 0,
- 0, 0, 0, 0, 47, 0, 0, 0, 0, 0,
- 114, 48, 0, 0, 49, 0, 50, 115, 0, 51,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 52,
- 53, 54, 42, 0, 0, 0, 0, 0, 55, 0,
- 0, 0, 0, 56, 57, 0, 0, 58, 59, 60,
- 142, 43, 61, 0, 0, 0, 44, 45, 46, 0,
- 0, 0, 0, 0, 47, 0, 0, 0, 0, 0,
- 0, 48, 0, 0, 49, 0, 50, 0, 0, 51,
- 62, 0, 0, 0, 0, 0, 0, 0, 0, 52,
- 53, 54, 42, 0, 0, 0, 0, 0, 55, 0,
- 0, 0, 0, 56, 57, 0, 0, 58, 59, 60,
- 264, 43, 61, 0, 0, 0, 44, 45, 46, 0,
- 0, 0, 0, 0, 47, 0, 0, 0, 0, 0,
- 0, 48, 0, 0, 49, 0, 50, 0, 0, 51,
- 62, 0, 0, 0, 0, 0, 0, 0, 0, 52,
- 53, 54, 42, 0, 0, 0, 0, 0, 55, 0,
- 0, 0, 0, 56, 57, 0, 0, 58, 59, 60,
- 330, 43, 61, 0, 0, 0, 44, 45, 46, 0,
- 0, 0, 0, 0, 47, 0, 0, 0, 0, 0,
- 0, 48, 0, 0, 49, 0, 50, 0, 0, 51,
- 62, 180, 181, 0, 182, 183, 184, 0, 0, 52,
- 53, 54, 42, 0, 0, 0, 0, 0, 55, 0,
- 185, 0, 0, 56, 57, 0, 0, 58, 59, 60,
- 0, 43, 61, 0, 0, 0, 44, 45, 46, 0,
- 0, 0, 180, 181, 47, 182, 183, 184, 0, 0,
- 0, 48, 0, 0, 49, 0, 50, 0, 0, 51,
- 62, 0, 0, 0, 195, 0, 0, 0, 0, 52,
- 53, 54, 180, 181, 0, 182, 183, 184, 55, 0,
- 0, 0, 0, 56, 57, 186, 0, 58, 59, 60,
- 0, 0, 61, 0, 187, 188, 189, 190, 191, 192,
- 193, 0, 180, 181, 272, 182, 183, 184, 0, 180,
- 181, 0, 182, 183, 184, 0, 0, 0, 0, 0,
- 62, 305, 0, 0, 0, 0, 186, 0, 0, 180,
- 181, 310, 182, 183, 184, 187, 188, 189, 190, 191,
- 192, 193, 0, 0, 0, 0, 0, 0, 182, 183,
- 184, 0, 0, 0, 0, 0, 186, 0, 0, 0,
- 0, 0, 0, 0, 0, 187, 188, 189, 190, 191,
- 192, 193, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 186, 0, 0, 0,
- 0, 0, 0, 186, 0, 187, 188, 189, 190, 191,
- 192, 193, 187, 188, 189, 190, 191, 192, 193, 0,
- 0, 0, 0, 186, 0, 0, 0, 0, 0, 0,
- 0, 0, 187, 188, 189, 190, 191, 192, 193, 186,
- 0, 0, 0, 0, 0, 0, 0, 0, 187, 188,
- 189, 190, 191, 192, 193
+ 21, 140, 113, 115, 125, 119, 152, 221, 195, 199,
+ 37, 233, 27, 201, 202, 24, 181, 231, 35, 93,
+ 94, 95, 96, 97, 135, 230, 98, 181, 4, 15,
+ 16, 17, 181, 18, 1, 145, 266, 13, 45, 14,
+ 129, 5, 130, 253, 36, 6, 251, 28, 252, 116,
+ 117, 7, 171, 144, 260, 8, 252, 170, 173, 277,
+ 280, 278, 252, 296, 339, 297, 340, 22, 28, 11,
+ 12, 175, 176, 341, 342, 196, 24, 34, 99, 39,
+ 282, 234, 239, 100, 101, 102, 103, 104, 40, 105,
+ 106, 107, 108, 126, 183, 109, 110, 90, 91, 177,
+ 178, 92, 179, 180, 181, 183, 123, 211, 189, 190,
+ 183, 19, 267, 124, 128, 132, 133, 134, 45, 111,
+ 136, 118, 187, 188, 189, 190, 112, 314, 137, 138,
+ 147, 141, 318, 142, 143, 146, 150, 216, 217, 218,
+ 219, 220, 151, 41, 223, 224, 225, 226, 227, 228,
+ 229, 172, 289, 232, 197, 154, 119, 174, 240, 140,
+ 155, 42, 156, 255, 256, 157, 43, 44, 45, 140,
+ 158, 268, 159, 160, 46, 161, 198, 162, 200, 163,
+ 164, 47, 183, 313, 48, 165, 49, 191, 166, 50,
+ 193, 184, 185, 186, 187, 188, 189, 190, 167, 51,
+ 52, 53, 215, 168, 169, 203, 194, 206, 54, 205,
+ 209, 212, 279, 55, 56, 213, 283, 57, 58, 59,
+ 140, 214, 60, 41, 222, 235, 211, 244, 241, 292,
+ 293, 179, 180, 181, 245, 246, 249, 254, 263, 264,
+ 139, 42, 270, 265, 271, 272, 43, 44, 45, 275,
+ 61, 276, 140, 281, 46, 256, 140, 285, 286, 288,
+ 295, 47, 287, 290, 48, 298, 49, 299, 300, 50,
+ 93, 94, 95, 96, 97, 303, 301, 98, 304, 51,
+ 52, 53, 305, 308, 310, 315, 316, 319, 54, 320,
+ 322, 324, 325, 55, 56, 326, 329, 57, 58, 59,
+ 116, 117, 60, 332, 328, 331, 335, 334, 336, 337,
+ 338, 183, 344, 153, 312, 237, 248, 284, 294, 29,
+ 184, 185, 186, 187, 188, 189, 190, 23, 38, 99,
+ 61, 0, 0, 41, 100, 101, 102, 103, 104, 0,
+ 105, 106, 107, 108, 0, 0, 109, 110, 0, 0,
+ 261, 42, 0, 0, 0, 0, 43, 44, 45, 0,
+ 0, 0, 0, 0, 46, 0, 0, 0, 0, 0,
+ 111, 47, 0, 0, 48, 0, 49, 112, 0, 50,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 51,
+ 52, 53, 0, 41, 0, 0, 0, 0, 54, 0,
+ 0, 0, 0, 55, 56, 0, 0, 57, 58, 59,
+ 327, 42, 60, 0, 0, 0, 43, 44, 45, 0,
+ 0, 0, 0, 0, 46, 0, 0, 0, 0, 0,
+ 0, 47, 0, 0, 48, 0, 49, 0, 0, 50,
+ 61, 0, 0, 0, 0, 0, 0, 0, 0, 51,
+ 52, 53, 41, 0, 0, 0, 0, 0, 54, 0,
+ 0, 0, 0, 55, 56, 0, 0, 57, 58, 59,
+ 42, 0, 60, 0, 0, 43, 44, 45, 0, 0,
+ 0, 0, 0, 46, 93, 94, 95, 96, 97, 0,
+ 47, 98, 0, 48, 0, 49, 0, 0, 50, 0,
+ 61, 0, 0, 0, 0, 0, 0, 0, 51, 52,
+ 53, 0, 0, 0, 0, 0, 0, 54, 0, 0,
+ 0, 0, 55, 56, 0, 0, 57, 58, 59, 0,
+ 0, 60, 210, 93, 94, 95, 96, 97, 0, 0,
+ 98, 0, 0, 99, 0, 0, 0, 0, 100, 101,
+ 102, 103, 104, 0, 105, 106, 107, 108, 0, 61,
+ 109, 110, 177, 178, 0, 179, 180, 181, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 177, 178,
+ 0, 179, 180, 181, 111, 0, 0, 0, 0, 0,
+ 0, 112, 99, 0, 0, 0, 182, 100, 101, 102,
+ 103, 104, 0, 105, 106, 107, 108, 0, 0, 109,
+ 110, 177, 178, 0, 179, 180, 181, 0, 177, 178,
+ 0, 179, 180, 181, 0, 0, 0, 0, 0, 0,
+ 0, 0, 192, 111, 177, 178, 0, 179, 180, 181,
+ 112, 0, 0, 0, 0, 183, 0, 0, 0, 269,
+ 0, 0, 302, 0, 184, 185, 186, 187, 188, 189,
+ 190, 183, 0, 177, 178, 262, 179, 180, 181, 0,
+ 184, 185, 186, 187, 188, 189, 190, 0, 0, 0,
+ 0, 0, 177, 178, 307, 179, 180, 181, 0, 0,
+ 0, 0, 0, 0, 183, 0, 0, 0, 0, 0,
+ 0, 183, 0, 184, 185, 186, 187, 188, 189, 190,
+ 184, 185, 186, 187, 188, 189, 190, 183, 0, 0,
+ 0, 0, 0, 0, 0, 0, 184, 185, 186, 187,
+ 188, 189, 190, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 183, 0, 0, 0,
+ 0, 0, 0, 0, 0, 184, 185, 186, 187, 188,
+ 189, 190, 0, 0, 0, 183, 0, 0, 0, 0,
+ 0, 0, 0, 0, 184, 185, 186, 187, 188, 189,
+ 190
};
static const yytype_int16 yycheck[] =
{
- 12, 64, 43, 44, 49, 46, 74, 185, 40, 38,
- 127, 9, 26, 25, 131, 132, 9, 195, 15, 15,
- 3, 4, 5, 6, 7, 8, 9, 15, 58, 12,
- 64, 35, 19, 20, 21, 22, 114, 24, 116, 69,
- 194, 57, 114, 59, 116, 114, 50, 116, 114, 63,
- 116, 16, 93, 36, 37, 114, 90, 116, 212, 9,
- 101, 91, 114, 114, 116, 116, 17, 18, 46, 47,
- 63, 116, 0, 114, 115, 112, 9, 113, 25, 108,
- 258, 112, 65, 200, 116, 9, 9, 70, 71, 72,
- 73, 74, 9, 76, 77, 78, 79, 94, 94, 82,
- 83, 99, 112, 25, 62, 9, 94, 49, 39, 150,
- 106, 107, 108, 109, 9, 102, 9, 9, 87, 35,
- 108, 109, 9, 106, 87, 108, 112, 305, 113, 40,
- 113, 112, 310, 112, 39, 112, 112, 112, 112, 180,
- 181, 182, 183, 184, 112, 112, 187, 188, 189, 190,
- 191, 192, 193, 270, 111, 196, 112, 112, 199, 112,
- 201, 224, 17, 112, 112, 49, 112, 112, 112, 112,
- 111, 234, 112, 241, 112, 112, 3, 4, 5, 6,
- 7, 8, 9, 113, 301, 12, 113, 113, 52, 60,
- 69, 69, 113, 113, 112, 5, 9, 3, 4, 5,
- 6, 7, 8, 9, 9, 113, 12, 58, 9, 36,
- 37, 55, 115, 9, 255, 114, 116, 103, 259, 116,
- 10, 11, 285, 13, 14, 15, 9, 9, 269, 9,
- 113, 272, 273, 31, 27, 32, 10, 11, 65, 13,
- 14, 15, 114, 70, 71, 72, 73, 74, 54, 76,
- 77, 78, 79, 9, 317, 82, 83, 41, 321, 65,
- 114, 61, 118, 275, 70, 71, 72, 73, 74, 115,
- 76, 77, 78, 79, 28, 51, 82, 83, 113, 106,
- 91, 100, 17, 44, 3, 88, 113, 3, 4, 5,
- 6, 7, 8, 9, 101, 113, 12, 92, 45, 114,
- 106, 12, 9, 9, 94, 93, 32, 113, 8, 103,
- 3, 9, 208, 103, 104, 105, 106, 107, 108, 109,
- 94, 74, 199, 14, 114, 27, 261, 300, -1, 103,
- 104, 105, 106, 107, 108, 109, -1, 34, 274, -1,
- 114, -1, -1, -1, -1, -1, -1, -1, -1, 65,
- -1, -1, 9, -1, 70, 71, 72, 73, 74, -1,
- 76, 77, 78, 79, -1, -1, 82, 83, -1, -1,
- -1, 28, -1, 30, 31, -1, 33, 34, 35, -1,
- -1, -1, -1, -1, 41, -1, -1, -1, -1, -1,
- 106, 48, -1, -1, 51, -1, 53, 113, -1, 56,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 66,
- 67, 68, 9, -1, -1, -1, -1, -1, 75, -1,
- -1, -1, -1, 80, 81, -1, -1, 84, 85, 86,
- 27, 28, 89, -1, -1, -1, 33, 34, 35, -1,
- -1, -1, -1, -1, 41, -1, -1, -1, -1, -1,
- -1, 48, -1, -1, 51, -1, 53, -1, -1, 56,
- 117, -1, -1, -1, -1, -1, -1, -1, -1, 66,
- 67, 68, 9, -1, -1, -1, -1, -1, 75, -1,
- -1, -1, -1, 80, 81, -1, -1, 84, 85, 86,
- 27, 28, 89, -1, -1, -1, 33, 34, 35, -1,
- -1, -1, -1, -1, 41, -1, -1, -1, -1, -1,
- -1, 48, -1, -1, 51, -1, 53, -1, -1, 56,
- 117, -1, -1, -1, -1, -1, -1, -1, -1, 66,
- 67, 68, 9, -1, -1, -1, -1, -1, 75, -1,
- -1, -1, -1, 80, 81, -1, -1, 84, 85, 86,
- 27, 28, 89, -1, -1, -1, 33, 34, 35, -1,
- -1, -1, -1, -1, 41, -1, -1, -1, -1, -1,
- -1, 48, -1, -1, 51, -1, 53, -1, -1, 56,
- 117, 10, 11, -1, 13, 14, 15, -1, -1, 66,
- 67, 68, 9, -1, -1, -1, -1, -1, 75, -1,
- 29, -1, -1, 80, 81, -1, -1, 84, 85, 86,
- -1, 28, 89, -1, -1, -1, 33, 34, 35, -1,
- -1, -1, 10, 11, 41, 13, 14, 15, -1, -1,
- -1, 48, -1, -1, 51, -1, 53, -1, -1, 56,
- 117, -1, -1, -1, 32, -1, -1, -1, -1, 66,
- 67, 68, 10, 11, -1, 13, 14, 15, 75, -1,
- -1, -1, -1, 80, 81, 94, -1, 84, 85, 86,
- -1, -1, 89, -1, 103, 104, 105, 106, 107, 108,
- 109, -1, 10, 11, 42, 13, 14, 15, -1, 10,
- 11, -1, 13, 14, 15, -1, -1, -1, -1, -1,
- 117, 29, -1, -1, -1, -1, 94, -1, -1, 10,
- 11, 32, 13, 14, 15, 103, 104, 105, 106, 107,
- 108, 109, -1, -1, -1, -1, -1, -1, 13, 14,
- 15, -1, -1, -1, -1, -1, 94, -1, -1, -1,
- -1, -1, -1, -1, -1, 103, 104, 105, 106, 107,
- 108, 109, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 94, -1, -1, -1,
- -1, -1, -1, 94, -1, 103, 104, 105, 106, 107,
- 108, 109, 103, 104, 105, 106, 107, 108, 109, -1,
- -1, -1, -1, 94, -1, -1, -1, -1, -1, -1,
- -1, -1, 103, 104, 105, 106, 107, 108, 109, 94,
- -1, -1, -1, -1, -1, -1, -1, -1, 103, 104,
- 105, 106, 107, 108, 109
+ 12, 63, 42, 43, 7, 45, 73, 182, 46, 124,
+ 23, 35, 24, 128, 129, 7, 13, 192, 61, 3,
+ 4, 5, 6, 7, 57, 191, 10, 13, 7, 17,
+ 18, 19, 13, 21, 14, 68, 37, 111, 32, 113,
+ 54, 0, 56, 209, 87, 109, 111, 60, 113, 33,
+ 34, 110, 92, 47, 111, 7, 113, 90, 98, 111,
+ 111, 113, 113, 111, 111, 113, 113, 22, 60, 15,
+ 16, 111, 112, 43, 44, 113, 7, 109, 62, 7,
+ 255, 105, 197, 67, 68, 69, 70, 71, 7, 73,
+ 74, 75, 76, 96, 91, 79, 80, 22, 109, 8,
+ 9, 59, 11, 12, 13, 91, 7, 147, 105, 106,
+ 91, 99, 113, 46, 36, 7, 7, 7, 32, 103,
+ 84, 105, 103, 104, 105, 106, 110, 302, 84, 7,
+ 37, 109, 307, 110, 109, 109, 109, 177, 178, 179,
+ 180, 181, 109, 7, 184, 185, 186, 187, 188, 189,
+ 190, 108, 267, 193, 36, 109, 196, 108, 198, 221,
+ 109, 25, 109, 27, 28, 109, 30, 31, 32, 231,
+ 109, 238, 109, 109, 38, 109, 15, 109, 49, 109,
+ 109, 45, 91, 298, 48, 109, 50, 110, 109, 53,
+ 110, 100, 101, 102, 103, 104, 105, 106, 109, 63,
+ 64, 65, 111, 109, 109, 57, 110, 110, 72, 46,
+ 110, 109, 252, 77, 78, 66, 256, 81, 82, 83,
+ 282, 66, 86, 7, 5, 7, 266, 110, 7, 269,
+ 270, 11, 12, 13, 55, 7, 112, 52, 7, 111,
+ 24, 25, 100, 113, 113, 7, 30, 31, 32, 7,
+ 114, 110, 314, 7, 38, 28, 318, 24, 29, 7,
+ 272, 45, 111, 38, 48, 58, 50, 111, 115, 53,
+ 3, 4, 5, 6, 7, 25, 112, 10, 48, 63,
+ 64, 65, 88, 110, 97, 15, 41, 3, 72, 85,
+ 98, 110, 89, 77, 78, 42, 10, 81, 82, 83,
+ 33, 34, 86, 7, 111, 100, 7, 90, 29, 6,
+ 3, 91, 7, 73, 297, 196, 205, 258, 271, 26,
+ 100, 101, 102, 103, 104, 105, 106, 14, 33, 62,
+ 114, -1, -1, 7, 67, 68, 69, 70, 71, -1,
+ 73, 74, 75, 76, -1, -1, 79, 80, -1, -1,
+ 24, 25, -1, -1, -1, -1, 30, 31, 32, -1,
+ -1, -1, -1, -1, 38, -1, -1, -1, -1, -1,
+ 103, 45, -1, -1, 48, -1, 50, 110, -1, 53,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 63,
+ 64, 65, -1, 7, -1, -1, -1, -1, 72, -1,
+ -1, -1, -1, 77, 78, -1, -1, 81, 82, 83,
+ 24, 25, 86, -1, -1, -1, 30, 31, 32, -1,
+ -1, -1, -1, -1, 38, -1, -1, -1, -1, -1,
+ -1, 45, -1, -1, 48, -1, 50, -1, -1, 53,
+ 114, -1, -1, -1, -1, -1, -1, -1, -1, 63,
+ 64, 65, 7, -1, -1, -1, -1, -1, 72, -1,
+ -1, -1, -1, 77, 78, -1, -1, 81, 82, 83,
+ 25, -1, 86, -1, -1, 30, 31, 32, -1, -1,
+ -1, -1, -1, 38, 3, 4, 5, 6, 7, -1,
+ 45, 10, -1, 48, -1, 50, -1, -1, 53, -1,
+ 114, -1, -1, -1, -1, -1, -1, -1, 63, 64,
+ 65, -1, -1, -1, -1, -1, -1, 72, -1, -1,
+ -1, -1, 77, 78, -1, -1, 81, 82, 83, -1,
+ -1, 86, 51, 3, 4, 5, 6, 7, -1, -1,
+ 10, -1, -1, 62, -1, -1, -1, -1, 67, 68,
+ 69, 70, 71, -1, 73, 74, 75, 76, -1, 114,
+ 79, 80, 8, 9, -1, 11, 12, 13, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 8, 9,
+ -1, 11, 12, 13, 103, -1, -1, -1, -1, -1,
+ -1, 110, 62, -1, -1, -1, 26, 67, 68, 69,
+ 70, 71, -1, 73, 74, 75, 76, -1, -1, 79,
+ 80, 8, 9, -1, 11, 12, 13, -1, 8, 9,
+ -1, 11, 12, 13, -1, -1, -1, -1, -1, -1,
+ -1, -1, 29, 103, 8, 9, -1, 11, 12, 13,
+ 110, -1, -1, -1, -1, 91, -1, -1, -1, 39,
+ -1, -1, 26, -1, 100, 101, 102, 103, 104, 105,
+ 106, 91, -1, 8, 9, 111, 11, 12, 13, -1,
+ 100, 101, 102, 103, 104, 105, 106, -1, -1, -1,
+ -1, -1, 8, 9, 29, 11, 12, 13, -1, -1,
+ -1, -1, -1, -1, 91, -1, -1, -1, -1, -1,
+ -1, 91, -1, 100, 101, 102, 103, 104, 105, 106,
+ 100, 101, 102, 103, 104, 105, 106, 91, -1, -1,
+ -1, -1, -1, -1, -1, -1, 100, 101, 102, 103,
+ 104, 105, 106, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 91, -1, -1, -1,
+ -1, -1, -1, -1, -1, 100, 101, 102, 103, 104,
+ 105, 106, -1, -1, -1, 91, -1, -1, -1, -1,
+ -1, -1, -1, -1, 100, 101, 102, 103, 104, 105,
+ 106
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 16, 120, 190, 9, 0, 112, 113, 9, 182,
- 183, 17, 18, 114, 116, 19, 20, 21, 22, 24,
- 102, 181, 181, 25, 182, 9, 184, 185, 181, 63,
- 184, 186, 187, 188, 189, 112, 64, 90, 26, 188,
- 9, 9, 9, 28, 33, 34, 35, 41, 48, 51,
- 53, 56, 66, 67, 68, 75, 80, 81, 84, 85,
- 86, 89, 117, 121, 122, 126, 127, 128, 141, 142,
- 143, 147, 148, 149, 150, 151, 152, 153, 154, 158,
- 159, 160, 161, 162, 163, 164, 165, 173, 177, 179,
- 180, 25, 112, 62, 3, 4, 5, 6, 7, 8,
- 9, 12, 65, 70, 71, 72, 73, 74, 76, 77,
- 78, 79, 82, 83, 106, 113, 123, 124, 123, 36,
- 37, 108, 123, 133, 134, 135, 9, 49, 9, 99,
- 178, 39, 57, 59, 175, 9, 9, 9, 141, 87,
- 87, 9, 27, 121, 112, 113, 112, 50, 141, 112,
- 40, 136, 146, 112, 112, 136, 146, 112, 112, 112,
- 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 141, 123, 111, 123, 111, 123, 123,
- 10, 11, 13, 14, 15, 29, 94, 103, 104, 105,
- 106, 107, 108, 109, 113, 32, 113, 113, 49, 116,
- 39, 17, 178, 52, 178, 178, 60, 176, 49, 113,
- 123, 132, 113, 54, 123, 112, 69, 69, 114, 123,
- 123, 123, 123, 123, 122, 5, 123, 123, 123, 123,
- 123, 123, 123, 132, 122, 123, 38, 108, 9, 131,
- 133, 130, 178, 123, 9, 144, 145, 113, 58, 9,
- 129, 131, 115, 125, 114, 116, 132, 55, 30, 31,
- 155, 156, 157, 114, 27, 114, 9, 114, 116, 40,
- 116, 136, 42, 103, 116, 9, 166, 167, 9, 113,
- 114, 116, 123, 114, 9, 122, 123, 155, 27, 32,
- 114, 9, 178, 41, 137, 123, 123, 144, 181, 114,
- 116, 61, 114, 118, 115, 29, 28, 51, 91, 138,
- 32, 113, 168, 100, 171, 166, 178, 122, 17, 44,
- 140, 122, 3, 88, 169, 101, 172, 113, 92, 45,
- 27, 114, 12, 170, 103, 9, 174, 93, 9, 32,
- 8, 3, 114, 116, 46, 47, 139, 9
+ 0, 14, 117, 187, 7, 0, 109, 110, 7, 179,
+ 180, 15, 16, 111, 113, 17, 18, 19, 21, 99,
+ 178, 178, 22, 179, 7, 181, 182, 178, 60, 181,
+ 183, 184, 185, 186, 109, 61, 87, 23, 185, 7,
+ 7, 7, 25, 30, 31, 32, 38, 45, 48, 50,
+ 53, 63, 64, 65, 72, 77, 78, 81, 82, 83,
+ 86, 114, 118, 119, 123, 124, 125, 138, 139, 140,
+ 144, 145, 146, 147, 148, 149, 150, 151, 155, 156,
+ 157, 158, 159, 160, 161, 162, 170, 174, 176, 177,
+ 22, 109, 59, 3, 4, 5, 6, 7, 10, 62,
+ 67, 68, 69, 70, 71, 73, 74, 75, 76, 79,
+ 80, 103, 110, 120, 121, 120, 33, 34, 105, 120,
+ 130, 131, 132, 7, 46, 7, 96, 175, 36, 54,
+ 56, 172, 7, 7, 7, 138, 84, 84, 7, 24,
+ 118, 109, 110, 109, 47, 138, 109, 37, 133, 143,
+ 109, 109, 133, 143, 109, 109, 109, 109, 109, 109,
+ 109, 109, 109, 109, 109, 109, 109, 109, 109, 109,
+ 138, 120, 108, 120, 108, 120, 120, 8, 9, 11,
+ 12, 13, 26, 91, 100, 101, 102, 103, 104, 105,
+ 106, 110, 29, 110, 110, 46, 113, 36, 15, 175,
+ 49, 175, 175, 57, 173, 46, 110, 120, 129, 110,
+ 51, 120, 109, 66, 66, 111, 120, 120, 120, 120,
+ 120, 119, 5, 120, 120, 120, 120, 120, 120, 120,
+ 129, 119, 120, 35, 105, 7, 128, 130, 127, 175,
+ 120, 7, 141, 142, 110, 55, 7, 126, 128, 112,
+ 122, 111, 113, 129, 52, 27, 28, 152, 153, 154,
+ 111, 24, 111, 7, 111, 113, 37, 113, 133, 39,
+ 100, 113, 7, 163, 164, 7, 110, 111, 113, 120,
+ 111, 7, 119, 120, 152, 24, 29, 111, 7, 175,
+ 38, 134, 120, 120, 141, 178, 111, 113, 58, 111,
+ 115, 112, 26, 25, 48, 88, 135, 29, 110, 165,
+ 97, 168, 163, 175, 119, 15, 41, 137, 119, 3,
+ 85, 166, 98, 169, 110, 89, 42, 24, 111, 10,
+ 167, 100, 7, 171, 90, 7, 29, 6, 3, 111,
+ 113, 43, 44, 136, 7
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 119, 120, 121, 121, 121, 121, 121, 121, 121,
- 121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
- 121, 121, 121, 121, 121, 122, 122, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 125, 125, 125, 126, 127,
- 128, 128, 128, 129, 130, 130, 131, 131, 131, 132,
- 132, 132, 133, 133, 133, 133, 134, 134, 134, 135,
- 135, 135, 136, 136, 137, 137, 138, 138, 139, 139,
- 139, 140, 140, 141, 142, 143, 143, 144, 145, 145,
- 146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
- 156, 156, 157, 157, 157, 158, 159, 160, 161, 162,
- 163, 164, 165, 165, 166, 167, 167, 168, 168, 169,
- 169, 170, 170, 171, 171, 172, 172, 173, 174, 174,
- 175, 175, 176, 176, 177, 178, 178, 179, 180, 181,
- 181, 181, 181, 181, 181, 182, 182, 183, 183, 183,
- 184, 185, 185, 185, 186, 187, 188, 188, 189, 189,
- 189, 190
+ 0, 116, 117, 118, 118, 118, 118, 118, 118, 118,
+ 118, 118, 118, 118, 118, 118, 118, 118, 118, 118,
+ 118, 118, 118, 118, 118, 119, 119, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 121, 121, 121, 121, 121, 121, 121, 121,
+ 121, 121, 121, 122, 122, 122, 123, 124, 125, 125,
+ 125, 126, 127, 127, 128, 128, 128, 129, 129, 129,
+ 130, 130, 130, 130, 131, 131, 131, 132, 132, 132,
+ 133, 133, 134, 134, 135, 135, 136, 136, 136, 137,
+ 137, 138, 139, 140, 140, 141, 142, 142, 143, 144,
+ 145, 146, 147, 148, 149, 150, 151, 152, 153, 153,
+ 154, 154, 154, 155, 156, 157, 158, 159, 160, 161,
+ 162, 162, 163, 164, 164, 165, 165, 166, 166, 167,
+ 167, 168, 168, 169, 169, 170, 171, 171, 172, 172,
+ 173, 173, 174, 175, 175, 176, 177, 178, 178, 178,
+ 178, 178, 179, 179, 180, 180, 180, 181, 182, 182,
+ 182, 183, 184, 185, 185, 186, 186, 186, 187
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
@@ -1018,22 +1004,21 @@ static const yytype_uint8 yyr2[] =
0, 2, 2, 1, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 1, 2, 1, 4, 1,
- 1, 1, 1, 1, 1, 1, 3, 3, 3, 3,
- 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 2, 3, 3, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 0, 1, 3, 6, 4,
- 1, 1, 1, 3, 1, 3, 0, 1, 3, 0,
- 1, 3, 1, 4, 5, 4, 0, 1, 3, 1,
- 3, 1, 0, 2, 0, 2, 0, 4, 0, 1,
- 1, 0, 4, 8, 3, 5, 2, 3, 1, 3,
- 4, 4, 2, 2, 3, 2, 2, 2, 3, 4,
- 1, 2, 0, 2, 1, 7, 6, 10, 1, 1,
- 2, 2, 4, 4, 5, 1, 3, 0, 3, 0,
- 1, 0, 2, 0, 1, 0, 3, 8, 1, 3,
- 0, 1, 0, 1, 10, 1, 1, 2, 2, 1,
- 1, 1, 1, 1, 1, 3, 3, 0, 1, 3,
- 3, 0, 1, 2, 6, 4, 1, 1, 0, 1,
- 2, 11
+ 1, 1, 1, 1, 3, 3, 3, 3, 2, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
+ 3, 3, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 1, 3, 6, 4, 1, 1,
+ 1, 3, 1, 3, 0, 1, 3, 0, 1, 3,
+ 1, 4, 5, 4, 0, 1, 3, 1, 3, 1,
+ 0, 2, 0, 2, 0, 4, 0, 1, 1, 0,
+ 4, 8, 3, 5, 2, 3, 1, 3, 4, 4,
+ 2, 2, 3, 2, 2, 2, 3, 4, 1, 2,
+ 0, 2, 1, 7, 6, 10, 1, 1, 2, 2,
+ 4, 4, 5, 1, 3, 0, 3, 0, 1, 0,
+ 2, 0, 1, 0, 3, 8, 1, 3, 0, 1,
+ 0, 1, 10, 1, 1, 2, 2, 1, 1, 1,
+ 1, 1, 3, 3, 0, 1, 3, 3, 0, 1,
+ 2, 6, 4, 1, 1, 0, 1, 2, 11
};
@@ -1710,471 +1695,459 @@ yyreduce:
switch (yyn)
{
case 25:
-#line 191 "pars0grm.y" /* yacc.c:1646 */
+#line 188 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 1716 "pars0grm.cc" /* yacc.c:1646 */
+#line 1701 "pars0grm.cc" /* yacc.c:1646 */
break;
case 26:
-#line 193 "pars0grm.y" /* yacc.c:1646 */
+#line 190 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last((yyvsp[-1]), (yyvsp[0])); }
-#line 1722 "pars0grm.cc" /* yacc.c:1646 */
+#line 1707 "pars0grm.cc" /* yacc.c:1646 */
break;
case 27:
-#line 197 "pars0grm.y" /* yacc.c:1646 */
+#line 194 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
-#line 1728 "pars0grm.cc" /* yacc.c:1646 */
+#line 1713 "pars0grm.cc" /* yacc.c:1646 */
break;
case 28:
-#line 199 "pars0grm.y" /* yacc.c:1646 */
+#line 196 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_func((yyvsp[-3]), (yyvsp[-1])); }
-#line 1734 "pars0grm.cc" /* yacc.c:1646 */
+#line 1719 "pars0grm.cc" /* yacc.c:1646 */
break;
case 29:
-#line 200 "pars0grm.y" /* yacc.c:1646 */
+#line 197 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
-#line 1740 "pars0grm.cc" /* yacc.c:1646 */
+#line 1725 "pars0grm.cc" /* yacc.c:1646 */
break;
case 30:
-#line 201 "pars0grm.y" /* yacc.c:1646 */
+#line 198 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
-#line 1746 "pars0grm.cc" /* yacc.c:1646 */
+#line 1731 "pars0grm.cc" /* yacc.c:1646 */
break;
case 31:
-#line 202 "pars0grm.y" /* yacc.c:1646 */
+#line 199 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
-#line 1752 "pars0grm.cc" /* yacc.c:1646 */
+#line 1737 "pars0grm.cc" /* yacc.c:1646 */
break;
case 32:
-#line 203 "pars0grm.y" /* yacc.c:1646 */
+#line 200 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
-#line 1758 "pars0grm.cc" /* yacc.c:1646 */
+#line 1743 "pars0grm.cc" /* yacc.c:1646 */
break;
case 33:
-#line 204 "pars0grm.y" /* yacc.c:1646 */
+#line 201 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]);}
-#line 1764 "pars0grm.cc" /* yacc.c:1646 */
+#line 1749 "pars0grm.cc" /* yacc.c:1646 */
break;
case 34:
-#line 205 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]);}
-#line 1770 "pars0grm.cc" /* yacc.c:1646 */
+#line 202 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op('+', (yyvsp[-2]), (yyvsp[0])); }
+#line 1755 "pars0grm.cc" /* yacc.c:1646 */
break;
case 35:
-#line 206 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]);}
-#line 1776 "pars0grm.cc" /* yacc.c:1646 */
+#line 203 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op('-', (yyvsp[-2]), (yyvsp[0])); }
+#line 1761 "pars0grm.cc" /* yacc.c:1646 */
break;
case 36:
-#line 207 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('+', (yyvsp[-2]), (yyvsp[0])); }
-#line 1782 "pars0grm.cc" /* yacc.c:1646 */
+#line 204 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op('*', (yyvsp[-2]), (yyvsp[0])); }
+#line 1767 "pars0grm.cc" /* yacc.c:1646 */
break;
case 37:
-#line 208 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('-', (yyvsp[-2]), (yyvsp[0])); }
-#line 1788 "pars0grm.cc" /* yacc.c:1646 */
+#line 205 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op('/', (yyvsp[-2]), (yyvsp[0])); }
+#line 1773 "pars0grm.cc" /* yacc.c:1646 */
break;
case 38:
-#line 209 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('*', (yyvsp[-2]), (yyvsp[0])); }
-#line 1794 "pars0grm.cc" /* yacc.c:1646 */
+#line 206 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op('-', (yyvsp[0]), NULL); }
+#line 1779 "pars0grm.cc" /* yacc.c:1646 */
break;
case 39:
-#line 210 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('/', (yyvsp[-2]), (yyvsp[0])); }
-#line 1800 "pars0grm.cc" /* yacc.c:1646 */
+#line 207 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[-1]); }
+#line 1785 "pars0grm.cc" /* yacc.c:1646 */
break;
case 40:
-#line 211 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('-', (yyvsp[0]), NULL); }
-#line 1806 "pars0grm.cc" /* yacc.c:1646 */
+#line 208 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op('=', (yyvsp[-2]), (yyvsp[0])); }
+#line 1791 "pars0grm.cc" /* yacc.c:1646 */
break;
case 41:
-#line 212 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[-1]); }
-#line 1812 "pars0grm.cc" /* yacc.c:1646 */
+#line 210 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op(PARS_LIKE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
+#line 1797 "pars0grm.cc" /* yacc.c:1646 */
break;
case 42:
-#line 213 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('=', (yyvsp[-2]), (yyvsp[0])); }
-#line 1818 "pars0grm.cc" /* yacc.c:1646 */
+#line 211 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op('<', (yyvsp[-2]), (yyvsp[0])); }
+#line 1803 "pars0grm.cc" /* yacc.c:1646 */
break;
case 43:
-#line 215 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_LIKE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1824 "pars0grm.cc" /* yacc.c:1646 */
+#line 212 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op('>', (yyvsp[-2]), (yyvsp[0])); }
+#line 1809 "pars0grm.cc" /* yacc.c:1646 */
break;
case 44:
-#line 216 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('<', (yyvsp[-2]), (yyvsp[0])); }
-#line 1830 "pars0grm.cc" /* yacc.c:1646 */
+#line 213 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op(PARS_GE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
+#line 1815 "pars0grm.cc" /* yacc.c:1646 */
break;
case 45:
-#line 217 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op('>', (yyvsp[-2]), (yyvsp[0])); }
-#line 1836 "pars0grm.cc" /* yacc.c:1646 */
+#line 214 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op(PARS_LE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
+#line 1821 "pars0grm.cc" /* yacc.c:1646 */
break;
case 46:
-#line 218 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_GE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1842 "pars0grm.cc" /* yacc.c:1646 */
+#line 215 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op(PARS_NE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
+#line 1827 "pars0grm.cc" /* yacc.c:1646 */
break;
case 47:
-#line 219 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_LE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1848 "pars0grm.cc" /* yacc.c:1646 */
+#line 216 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op(PARS_AND_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
+#line 1833 "pars0grm.cc" /* yacc.c:1646 */
break;
case 48:
-#line 220 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_NE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1854 "pars0grm.cc" /* yacc.c:1646 */
+#line 217 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op(PARS_OR_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
+#line 1839 "pars0grm.cc" /* yacc.c:1646 */
break;
case 49:
-#line 221 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_AND_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1860 "pars0grm.cc" /* yacc.c:1646 */
+#line 218 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op(PARS_NOT_TOKEN, (yyvsp[0]), NULL); }
+#line 1845 "pars0grm.cc" /* yacc.c:1646 */
break;
case 50:
-#line 222 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_OR_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1866 "pars0grm.cc" /* yacc.c:1646 */
+#line 220 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[-2]), NULL); }
+#line 1851 "pars0grm.cc" /* yacc.c:1646 */
break;
case 51:
-#line 223 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_NOT_TOKEN, (yyvsp[0]), NULL); }
-#line 1872 "pars0grm.cc" /* yacc.c:1646 */
+#line 222 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[-2]), NULL); }
+#line 1857 "pars0grm.cc" /* yacc.c:1646 */
break;
case 52:
-#line 225 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[-2]), NULL); }
-#line 1878 "pars0grm.cc" /* yacc.c:1646 */
+#line 226 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_to_char_token; }
+#line 1863 "pars0grm.cc" /* yacc.c:1646 */
break;
case 53:
#line 227 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[-2]), NULL); }
-#line 1884 "pars0grm.cc" /* yacc.c:1646 */
+ { (yyval) = &pars_to_number_token; }
+#line 1869 "pars0grm.cc" /* yacc.c:1646 */
break;
case 54:
-#line 231 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_to_char_token; }
-#line 1890 "pars0grm.cc" /* yacc.c:1646 */
+#line 228 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_to_binary_token; }
+#line 1875 "pars0grm.cc" /* yacc.c:1646 */
break;
case 55:
-#line 232 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_to_number_token; }
-#line 1896 "pars0grm.cc" /* yacc.c:1646 */
+#line 230 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_binary_to_number_token; }
+#line 1881 "pars0grm.cc" /* yacc.c:1646 */
break;
case 56:
-#line 233 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_to_binary_token; }
-#line 1902 "pars0grm.cc" /* yacc.c:1646 */
+#line 231 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_substr_token; }
+#line 1887 "pars0grm.cc" /* yacc.c:1646 */
break;
case 57:
-#line 235 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_binary_to_number_token; }
-#line 1908 "pars0grm.cc" /* yacc.c:1646 */
+#line 232 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_concat_token; }
+#line 1893 "pars0grm.cc" /* yacc.c:1646 */
break;
case 58:
-#line 236 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_substr_token; }
-#line 1914 "pars0grm.cc" /* yacc.c:1646 */
+#line 233 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_instr_token; }
+#line 1899 "pars0grm.cc" /* yacc.c:1646 */
break;
case 59:
-#line 237 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_concat_token; }
-#line 1920 "pars0grm.cc" /* yacc.c:1646 */
+#line 234 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_length_token; }
+#line 1905 "pars0grm.cc" /* yacc.c:1646 */
break;
case 60:
-#line 238 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_instr_token; }
-#line 1926 "pars0grm.cc" /* yacc.c:1646 */
+#line 235 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_sysdate_token; }
+#line 1911 "pars0grm.cc" /* yacc.c:1646 */
break;
case 61:
-#line 239 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_length_token; }
-#line 1932 "pars0grm.cc" /* yacc.c:1646 */
+#line 236 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_rnd_token; }
+#line 1917 "pars0grm.cc" /* yacc.c:1646 */
break;
case 62:
-#line 240 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_sysdate_token; }
-#line 1938 "pars0grm.cc" /* yacc.c:1646 */
+#line 237 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_rnd_str_token; }
+#line 1923 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 63:
-#line 241 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_rnd_token; }
-#line 1944 "pars0grm.cc" /* yacc.c:1646 */
+ case 66:
+#line 248 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_stored_procedure_call(
+ static_cast<sym_node_t*>((yyvsp[-4]))); }
+#line 1930 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 64:
-#line 242 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_rnd_str_token; }
-#line 1950 "pars0grm.cc" /* yacc.c:1646 */
+ case 67:
+#line 254 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_procedure_call((yyvsp[-3]), (yyvsp[-1])); }
+#line 1936 "pars0grm.cc" /* yacc.c:1646 */
break;
case 68:
-#line 253 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_stored_procedure_call(
- static_cast<sym_node_t*>((yyvsp[-4]))); }
-#line 1957 "pars0grm.cc" /* yacc.c:1646 */
+#line 258 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_replstr_token; }
+#line 1942 "pars0grm.cc" /* yacc.c:1646 */
break;
case 69:
#line 259 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_procedure_call((yyvsp[-3]), (yyvsp[-1])); }
-#line 1963 "pars0grm.cc" /* yacc.c:1646 */
+ { (yyval) = &pars_printf_token; }
+#line 1948 "pars0grm.cc" /* yacc.c:1646 */
break;
case 70:
-#line 263 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_replstr_token; }
-#line 1969 "pars0grm.cc" /* yacc.c:1646 */
+#line 260 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_assert_token; }
+#line 1954 "pars0grm.cc" /* yacc.c:1646 */
break;
case 71:
#line 264 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_printf_token; }
-#line 1975 "pars0grm.cc" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[-2]); }
+#line 1960 "pars0grm.cc" /* yacc.c:1646 */
break;
case 72:
-#line 265 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_assert_token; }
-#line 1981 "pars0grm.cc" /* yacc.c:1646 */
+#line 268 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
+#line 1966 "pars0grm.cc" /* yacc.c:1646 */
break;
case 73:
-#line 269 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[-2]); }
-#line 1987 "pars0grm.cc" /* yacc.c:1646 */
+#line 270 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
+#line 1972 "pars0grm.cc" /* yacc.c:1646 */
break;
case 74:
-#line 273 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 1993 "pars0grm.cc" /* yacc.c:1646 */
+#line 274 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
+#line 1978 "pars0grm.cc" /* yacc.c:1646 */
break;
case 75:
#line 275 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 1999 "pars0grm.cc" /* yacc.c:1646 */
+ { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
+#line 1984 "pars0grm.cc" /* yacc.c:1646 */
break;
case 76:
-#line 279 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2005 "pars0grm.cc" /* yacc.c:1646 */
+#line 277 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
+#line 1990 "pars0grm.cc" /* yacc.c:1646 */
break;
case 77:
-#line 280 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2011 "pars0grm.cc" /* yacc.c:1646 */
+#line 281 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
+#line 1996 "pars0grm.cc" /* yacc.c:1646 */
break;
case 78:
#line 282 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2017 "pars0grm.cc" /* yacc.c:1646 */
+ { (yyval) = que_node_list_add_last(NULL, (yyvsp[0]));}
+#line 2002 "pars0grm.cc" /* yacc.c:1646 */
break;
case 79:
-#line 286 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2023 "pars0grm.cc" /* yacc.c:1646 */
+#line 283 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
+#line 2008 "pars0grm.cc" /* yacc.c:1646 */
break;
case 80:
#line 287 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last(NULL, (yyvsp[0]));}
-#line 2029 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 81:
-#line 288 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2035 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 82:
-#line 292 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2041 "pars0grm.cc" /* yacc.c:1646 */
+#line 2014 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 83:
-#line 294 "pars0grm.y" /* yacc.c:1646 */
+ case 81:
+#line 289 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_func(&pars_count_token,
que_node_list_add_last(NULL,
sym_tab_add_int_lit(
pars_sym_tab_global, 1))); }
-#line 2050 "pars0grm.cc" /* yacc.c:1646 */
+#line 2023 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 84:
-#line 299 "pars0grm.y" /* yacc.c:1646 */
+ case 82:
+#line 294 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_func(&pars_count_token,
que_node_list_add_last(NULL,
pars_func(&pars_distinct_token,
que_node_list_add_last(
NULL, (yyvsp[-1]))))); }
-#line 2060 "pars0grm.cc" /* yacc.c:1646 */
+#line 2033 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 85:
-#line 305 "pars0grm.y" /* yacc.c:1646 */
+ case 83:
+#line 300 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_func(&pars_sum_token,
que_node_list_add_last(NULL,
(yyvsp[-1]))); }
-#line 2068 "pars0grm.cc" /* yacc.c:1646 */
+#line 2041 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 86:
-#line 311 "pars0grm.y" /* yacc.c:1646 */
+ case 84:
+#line 306 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2074 "pars0grm.cc" /* yacc.c:1646 */
+#line 2047 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 87:
-#line 312 "pars0grm.y" /* yacc.c:1646 */
+ case 85:
+#line 307 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2080 "pars0grm.cc" /* yacc.c:1646 */
+#line 2053 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 88:
-#line 314 "pars0grm.y" /* yacc.c:1646 */
+ case 86:
+#line 309 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2086 "pars0grm.cc" /* yacc.c:1646 */
+#line 2059 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 89:
-#line 318 "pars0grm.y" /* yacc.c:1646 */
+ case 87:
+#line 313 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_select_list(&pars_star_denoter,
NULL); }
-#line 2093 "pars0grm.cc" /* yacc.c:1646 */
+#line 2066 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 90:
-#line 321 "pars0grm.y" /* yacc.c:1646 */
+ case 88:
+#line 316 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_select_list(
(yyvsp[-2]), static_cast<sym_node_t*>((yyvsp[0]))); }
-#line 2100 "pars0grm.cc" /* yacc.c:1646 */
+#line 2073 "pars0grm.cc" /* yacc.c:1646 */
+ break;
+
+ case 89:
+#line 318 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = pars_select_list((yyvsp[0]), NULL); }
+#line 2079 "pars0grm.cc" /* yacc.c:1646 */
+ break;
+
+ case 90:
+#line 322 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = NULL; }
+#line 2085 "pars0grm.cc" /* yacc.c:1646 */
break;
case 91:
#line 323 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = pars_select_list((yyvsp[0]), NULL); }
-#line 2106 "pars0grm.cc" /* yacc.c:1646 */
+ { (yyval) = (yyvsp[0]); }
+#line 2091 "pars0grm.cc" /* yacc.c:1646 */
break;
case 92:
#line 327 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2112 "pars0grm.cc" /* yacc.c:1646 */
+#line 2097 "pars0grm.cc" /* yacc.c:1646 */
break;
case 93:
-#line 328 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = (yyvsp[0]); }
-#line 2118 "pars0grm.cc" /* yacc.c:1646 */
+#line 329 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_update_token; }
+#line 2103 "pars0grm.cc" /* yacc.c:1646 */
break;
case 94:
-#line 332 "pars0grm.y" /* yacc.c:1646 */
+#line 333 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2124 "pars0grm.cc" /* yacc.c:1646 */
+#line 2109 "pars0grm.cc" /* yacc.c:1646 */
break;
case 95:
-#line 334 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_update_token; }
-#line 2130 "pars0grm.cc" /* yacc.c:1646 */
+#line 335 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_share_token; }
+#line 2115 "pars0grm.cc" /* yacc.c:1646 */
break;
case 96:
-#line 338 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = NULL; }
-#line 2136 "pars0grm.cc" /* yacc.c:1646 */
+#line 339 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_asc_token; }
+#line 2121 "pars0grm.cc" /* yacc.c:1646 */
break;
case 97:
#line 340 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_share_token; }
-#line 2142 "pars0grm.cc" /* yacc.c:1646 */
+ { (yyval) = &pars_asc_token; }
+#line 2127 "pars0grm.cc" /* yacc.c:1646 */
break;
case 98:
-#line 344 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_asc_token; }
-#line 2148 "pars0grm.cc" /* yacc.c:1646 */
+#line 341 "pars0grm.y" /* yacc.c:1646 */
+ { (yyval) = &pars_desc_token; }
+#line 2133 "pars0grm.cc" /* yacc.c:1646 */
break;
case 99:
#line 345 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_asc_token; }
-#line 2154 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 100:
-#line 346 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_desc_token; }
-#line 2160 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 101:
-#line 350 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2166 "pars0grm.cc" /* yacc.c:1646 */
+#line 2139 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 102:
-#line 352 "pars0grm.y" /* yacc.c:1646 */
+ case 100:
+#line 347 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_order_by(
static_cast<sym_node_t*>((yyvsp[-1])),
static_cast<pars_res_word_t*>((yyvsp[0]))); }
-#line 2174 "pars0grm.cc" /* yacc.c:1646 */
+#line 2147 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 103:
-#line 363 "pars0grm.y" /* yacc.c:1646 */
+ case 101:
+#line 358 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_select_statement(
static_cast<sel_node_t*>((yyvsp[-6])),
static_cast<sym_node_t*>((yyvsp[-4])),
@@ -2182,498 +2155,492 @@ yyreduce:
static_cast<pars_res_word_t*>((yyvsp[-2])),
static_cast<pars_res_word_t*>((yyvsp[-1])),
static_cast<order_node_t*>((yyvsp[0]))); }
-#line 2186 "pars0grm.cc" /* yacc.c:1646 */
+#line 2159 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 104:
-#line 374 "pars0grm.y" /* yacc.c:1646 */
+ case 102:
+#line 369 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2192 "pars0grm.cc" /* yacc.c:1646 */
+#line 2165 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 105:
-#line 379 "pars0grm.y" /* yacc.c:1646 */
+ case 103:
+#line 374 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_insert_statement(
static_cast<sym_node_t*>((yyvsp[-4])), (yyvsp[-1]), NULL); }
-#line 2199 "pars0grm.cc" /* yacc.c:1646 */
+#line 2172 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 106:
-#line 382 "pars0grm.y" /* yacc.c:1646 */
+ case 104:
+#line 377 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_insert_statement(
static_cast<sym_node_t*>((yyvsp[-1])),
NULL,
static_cast<sel_node_t*>((yyvsp[0]))); }
-#line 2208 "pars0grm.cc" /* yacc.c:1646 */
+#line 2181 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 107:
-#line 389 "pars0grm.y" /* yacc.c:1646 */
+ case 105:
+#line 384 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_column_assignment(
static_cast<sym_node_t*>((yyvsp[-2])),
static_cast<que_node_t*>((yyvsp[0]))); }
-#line 2216 "pars0grm.cc" /* yacc.c:1646 */
+#line 2189 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 108:
-#line 395 "pars0grm.y" /* yacc.c:1646 */
+ case 106:
+#line 390 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2222 "pars0grm.cc" /* yacc.c:1646 */
+#line 2195 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 109:
-#line 397 "pars0grm.y" /* yacc.c:1646 */
+ case 107:
+#line 392 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2228 "pars0grm.cc" /* yacc.c:1646 */
+#line 2201 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 110:
-#line 403 "pars0grm.y" /* yacc.c:1646 */
+ case 108:
+#line 398 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2234 "pars0grm.cc" /* yacc.c:1646 */
+#line 2207 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 111:
-#line 409 "pars0grm.y" /* yacc.c:1646 */
+ case 109:
+#line 404 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_update_statement_start(
FALSE,
static_cast<sym_node_t*>((yyvsp[-2])),
static_cast<col_assign_node_t*>((yyvsp[0]))); }
-#line 2243 "pars0grm.cc" /* yacc.c:1646 */
+#line 2216 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 112:
-#line 417 "pars0grm.y" /* yacc.c:1646 */
+ case 110:
+#line 412 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_update_statement(
static_cast<upd_node_t*>((yyvsp[-1])),
NULL,
static_cast<que_node_t*>((yyvsp[0]))); }
-#line 2252 "pars0grm.cc" /* yacc.c:1646 */
+#line 2225 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 113:
-#line 425 "pars0grm.y" /* yacc.c:1646 */
+ case 111:
+#line 420 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_update_statement(
static_cast<upd_node_t*>((yyvsp[-1])),
static_cast<sym_node_t*>((yyvsp[0])),
NULL); }
-#line 2261 "pars0grm.cc" /* yacc.c:1646 */
+#line 2234 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 114:
-#line 433 "pars0grm.y" /* yacc.c:1646 */
+ case 112:
+#line 428 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_update_statement_start(
TRUE,
static_cast<sym_node_t*>((yyvsp[0])), NULL); }
-#line 2269 "pars0grm.cc" /* yacc.c:1646 */
+#line 2242 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 115:
-#line 440 "pars0grm.y" /* yacc.c:1646 */
+ case 113:
+#line 435 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_update_statement(
static_cast<upd_node_t*>((yyvsp[-1])),
NULL,
static_cast<que_node_t*>((yyvsp[0]))); }
-#line 2278 "pars0grm.cc" /* yacc.c:1646 */
+#line 2251 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 116:
-#line 448 "pars0grm.y" /* yacc.c:1646 */
+ case 114:
+#line 443 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_update_statement(
static_cast<upd_node_t*>((yyvsp[-1])),
static_cast<sym_node_t*>((yyvsp[0])),
NULL); }
-#line 2287 "pars0grm.cc" /* yacc.c:1646 */
+#line 2260 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 117:
-#line 456 "pars0grm.y" /* yacc.c:1646 */
+ case 115:
+#line 451 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_row_printf_statement(
static_cast<sel_node_t*>((yyvsp[0]))); }
-#line 2294 "pars0grm.cc" /* yacc.c:1646 */
+#line 2267 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 118:
-#line 462 "pars0grm.y" /* yacc.c:1646 */
+ case 116:
+#line 457 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_assignment_statement(
static_cast<sym_node_t*>((yyvsp[-2])),
static_cast<que_node_t*>((yyvsp[0]))); }
-#line 2302 "pars0grm.cc" /* yacc.c:1646 */
+#line 2275 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 119:
-#line 470 "pars0grm.y" /* yacc.c:1646 */
+ case 117:
+#line 465 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_elsif_element((yyvsp[-2]), (yyvsp[0])); }
-#line 2308 "pars0grm.cc" /* yacc.c:1646 */
+#line 2281 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 120:
-#line 474 "pars0grm.y" /* yacc.c:1646 */
+ case 118:
+#line 469 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2314 "pars0grm.cc" /* yacc.c:1646 */
+#line 2287 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 121:
-#line 476 "pars0grm.y" /* yacc.c:1646 */
+ case 119:
+#line 471 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last((yyvsp[-1]), (yyvsp[0])); }
-#line 2320 "pars0grm.cc" /* yacc.c:1646 */
+#line 2293 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 122:
-#line 480 "pars0grm.y" /* yacc.c:1646 */
+ case 120:
+#line 475 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2326 "pars0grm.cc" /* yacc.c:1646 */
+#line 2299 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 123:
-#line 482 "pars0grm.y" /* yacc.c:1646 */
+ case 121:
+#line 477 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2332 "pars0grm.cc" /* yacc.c:1646 */
+#line 2305 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 124:
-#line 483 "pars0grm.y" /* yacc.c:1646 */
+ case 122:
+#line 478 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2338 "pars0grm.cc" /* yacc.c:1646 */
+#line 2311 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 125:
-#line 490 "pars0grm.y" /* yacc.c:1646 */
+ case 123:
+#line 485 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_if_statement((yyvsp[-5]), (yyvsp[-3]), (yyvsp[-2])); }
-#line 2344 "pars0grm.cc" /* yacc.c:1646 */
+#line 2317 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 126:
-#line 496 "pars0grm.y" /* yacc.c:1646 */
+ case 124:
+#line 491 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_while_statement((yyvsp[-4]), (yyvsp[-2])); }
-#line 2350 "pars0grm.cc" /* yacc.c:1646 */
+#line 2323 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 127:
-#line 504 "pars0grm.y" /* yacc.c:1646 */
+ case 125:
+#line 499 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_for_statement(
static_cast<sym_node_t*>((yyvsp[-8])),
(yyvsp[-6]), (yyvsp[-4]), (yyvsp[-2])); }
-#line 2358 "pars0grm.cc" /* yacc.c:1646 */
+#line 2331 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 128:
-#line 510 "pars0grm.y" /* yacc.c:1646 */
+ case 126:
+#line 505 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_exit_statement(); }
-#line 2364 "pars0grm.cc" /* yacc.c:1646 */
+#line 2337 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 129:
-#line 514 "pars0grm.y" /* yacc.c:1646 */
+ case 127:
+#line 509 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_return_statement(); }
-#line 2370 "pars0grm.cc" /* yacc.c:1646 */
+#line 2343 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 130:
-#line 519 "pars0grm.y" /* yacc.c:1646 */
+ case 128:
+#line 514 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_open_statement(
ROW_SEL_OPEN_CURSOR,
static_cast<sym_node_t*>((yyvsp[0]))); }
-#line 2378 "pars0grm.cc" /* yacc.c:1646 */
+#line 2351 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 131:
-#line 526 "pars0grm.y" /* yacc.c:1646 */
+ case 129:
+#line 521 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_open_statement(
ROW_SEL_CLOSE_CURSOR,
static_cast<sym_node_t*>((yyvsp[0]))); }
-#line 2386 "pars0grm.cc" /* yacc.c:1646 */
+#line 2359 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 132:
-#line 533 "pars0grm.y" /* yacc.c:1646 */
+ case 130:
+#line 528 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_fetch_statement(
static_cast<sym_node_t*>((yyvsp[-2])),
static_cast<sym_node_t*>((yyvsp[0])), NULL); }
-#line 2394 "pars0grm.cc" /* yacc.c:1646 */
+#line 2367 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 133:
-#line 537 "pars0grm.y" /* yacc.c:1646 */
+ case 131:
+#line 532 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_fetch_statement(
static_cast<sym_node_t*>((yyvsp[-2])),
NULL,
static_cast<sym_node_t*>((yyvsp[0]))); }
-#line 2403 "pars0grm.cc" /* yacc.c:1646 */
+#line 2376 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 134:
-#line 545 "pars0grm.y" /* yacc.c:1646 */
+ case 132:
+#line 540 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_column_def(
static_cast<sym_node_t*>((yyvsp[-4])),
static_cast<pars_res_word_t*>((yyvsp[-3])),
static_cast<sym_node_t*>((yyvsp[-2])),
(yyvsp[-1]), (yyvsp[0])); }
-#line 2413 "pars0grm.cc" /* yacc.c:1646 */
+#line 2386 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 135:
-#line 553 "pars0grm.y" /* yacc.c:1646 */
+ case 133:
+#line 548 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2419 "pars0grm.cc" /* yacc.c:1646 */
+#line 2392 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 136:
-#line 555 "pars0grm.y" /* yacc.c:1646 */
+ case 134:
+#line 550 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2425 "pars0grm.cc" /* yacc.c:1646 */
+#line 2398 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 137:
-#line 559 "pars0grm.y" /* yacc.c:1646 */
+ case 135:
+#line 554 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2431 "pars0grm.cc" /* yacc.c:1646 */
+#line 2404 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 138:
-#line 561 "pars0grm.y" /* yacc.c:1646 */
+ case 136:
+#line 556 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[-1]); }
-#line 2437 "pars0grm.cc" /* yacc.c:1646 */
+#line 2410 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 139:
-#line 565 "pars0grm.y" /* yacc.c:1646 */
+ case 137:
+#line 560 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2443 "pars0grm.cc" /* yacc.c:1646 */
+#line 2416 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 140:
-#line 567 "pars0grm.y" /* yacc.c:1646 */
+ case 138:
+#line 562 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = &pars_int_token;
/* pass any non-NULL pointer */ }
-#line 2450 "pars0grm.cc" /* yacc.c:1646 */
+#line 2423 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 141:
-#line 572 "pars0grm.y" /* yacc.c:1646 */
+ case 139:
+#line 567 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2456 "pars0grm.cc" /* yacc.c:1646 */
+#line 2429 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 142:
-#line 574 "pars0grm.y" /* yacc.c:1646 */
+ case 140:
+#line 569 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = &pars_int_token;
/* pass any non-NULL pointer */ }
-#line 2463 "pars0grm.cc" /* yacc.c:1646 */
+#line 2436 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 143:
-#line 579 "pars0grm.y" /* yacc.c:1646 */
+ case 141:
+#line 574 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2469 "pars0grm.cc" /* yacc.c:1646 */
+#line 2442 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 144:
-#line 580 "pars0grm.y" /* yacc.c:1646 */
+ case 142:
+#line 575 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = &pars_int_token;
/* pass any non-NULL pointer */ }
-#line 2476 "pars0grm.cc" /* yacc.c:1646 */
+#line 2449 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 145:
-#line 585 "pars0grm.y" /* yacc.c:1646 */
+ case 143:
+#line 580 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2482 "pars0grm.cc" /* yacc.c:1646 */
+#line 2455 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 146:
-#line 587 "pars0grm.y" /* yacc.c:1646 */
+ case 144:
+#line 582 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2488 "pars0grm.cc" /* yacc.c:1646 */
+#line 2461 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 147:
-#line 594 "pars0grm.y" /* yacc.c:1646 */
+ case 145:
+#line 589 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_create_table(
static_cast<sym_node_t*>((yyvsp[-5])),
static_cast<sym_node_t*>((yyvsp[-3])),
static_cast<sym_node_t*>((yyvsp[-1])),
static_cast<sym_node_t*>((yyvsp[0]))); }
-#line 2498 "pars0grm.cc" /* yacc.c:1646 */
+#line 2471 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 148:
-#line 602 "pars0grm.y" /* yacc.c:1646 */
+ case 146:
+#line 597 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2504 "pars0grm.cc" /* yacc.c:1646 */
+#line 2477 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 149:
-#line 604 "pars0grm.y" /* yacc.c:1646 */
+ case 147:
+#line 599 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2510 "pars0grm.cc" /* yacc.c:1646 */
+#line 2483 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 150:
-#line 608 "pars0grm.y" /* yacc.c:1646 */
+ case 148:
+#line 603 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2516 "pars0grm.cc" /* yacc.c:1646 */
+#line 2489 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 151:
-#line 609 "pars0grm.y" /* yacc.c:1646 */
+ case 149:
+#line 604 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = &pars_unique_token; }
-#line 2522 "pars0grm.cc" /* yacc.c:1646 */
+#line 2495 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 152:
-#line 613 "pars0grm.y" /* yacc.c:1646 */
+ case 150:
+#line 608 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2528 "pars0grm.cc" /* yacc.c:1646 */
+#line 2501 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 153:
-#line 614 "pars0grm.y" /* yacc.c:1646 */
+ case 151:
+#line 609 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = &pars_clustered_token; }
-#line 2534 "pars0grm.cc" /* yacc.c:1646 */
+#line 2507 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 154:
-#line 623 "pars0grm.y" /* yacc.c:1646 */
+ case 152:
+#line 618 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_create_index(
static_cast<pars_res_word_t*>((yyvsp[-8])),
static_cast<pars_res_word_t*>((yyvsp[-7])),
static_cast<sym_node_t*>((yyvsp[-5])),
static_cast<sym_node_t*>((yyvsp[-3])),
static_cast<sym_node_t*>((yyvsp[-1]))); }
-#line 2545 "pars0grm.cc" /* yacc.c:1646 */
+#line 2518 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 155:
-#line 632 "pars0grm.y" /* yacc.c:1646 */
+ case 153:
+#line 627 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2551 "pars0grm.cc" /* yacc.c:1646 */
+#line 2524 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 156:
-#line 633 "pars0grm.y" /* yacc.c:1646 */
+ case 154:
+#line 628 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = (yyvsp[0]); }
-#line 2557 "pars0grm.cc" /* yacc.c:1646 */
+#line 2530 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 157:
-#line 638 "pars0grm.y" /* yacc.c:1646 */
+ case 155:
+#line 633 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_commit_statement(); }
-#line 2563 "pars0grm.cc" /* yacc.c:1646 */
+#line 2536 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 158:
-#line 643 "pars0grm.y" /* yacc.c:1646 */
+ case 156:
+#line 638 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_rollback_statement(); }
-#line 2569 "pars0grm.cc" /* yacc.c:1646 */
+#line 2542 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 159:
-#line 647 "pars0grm.y" /* yacc.c:1646 */
- { (yyval) = &pars_int_token; }
-#line 2575 "pars0grm.cc" /* yacc.c:1646 */
- break;
-
- case 160:
-#line 648 "pars0grm.y" /* yacc.c:1646 */
+ case 157:
+#line 642 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = &pars_int_token; }
-#line 2581 "pars0grm.cc" /* yacc.c:1646 */
+#line 2548 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 161:
-#line 649 "pars0grm.y" /* yacc.c:1646 */
+ case 158:
+#line 643 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = &pars_bigint_token; }
-#line 2587 "pars0grm.cc" /* yacc.c:1646 */
+#line 2554 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 162:
-#line 650 "pars0grm.y" /* yacc.c:1646 */
+ case 159:
+#line 644 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = &pars_char_token; }
-#line 2593 "pars0grm.cc" /* yacc.c:1646 */
+#line 2560 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 163:
-#line 651 "pars0grm.y" /* yacc.c:1646 */
+ case 160:
+#line 645 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = &pars_binary_token; }
-#line 2599 "pars0grm.cc" /* yacc.c:1646 */
+#line 2566 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 164:
-#line 652 "pars0grm.y" /* yacc.c:1646 */
+ case 161:
+#line 646 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = &pars_blob_token; }
-#line 2605 "pars0grm.cc" /* yacc.c:1646 */
+#line 2572 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 165:
-#line 657 "pars0grm.y" /* yacc.c:1646 */
+ case 162:
+#line 651 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_parameter_declaration(
static_cast<sym_node_t*>((yyvsp[-2])),
PARS_INPUT,
static_cast<pars_res_word_t*>((yyvsp[0]))); }
-#line 2614 "pars0grm.cc" /* yacc.c:1646 */
+#line 2581 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 166:
-#line 662 "pars0grm.y" /* yacc.c:1646 */
+ case 163:
+#line 656 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_parameter_declaration(
static_cast<sym_node_t*>((yyvsp[-2])),
PARS_OUTPUT,
static_cast<pars_res_word_t*>((yyvsp[0]))); }
-#line 2623 "pars0grm.cc" /* yacc.c:1646 */
+#line 2590 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 167:
-#line 669 "pars0grm.y" /* yacc.c:1646 */
+ case 164:
+#line 663 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = NULL; }
-#line 2629 "pars0grm.cc" /* yacc.c:1646 */
+#line 2596 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 168:
-#line 670 "pars0grm.y" /* yacc.c:1646 */
+ case 165:
+#line 664 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2635 "pars0grm.cc" /* yacc.c:1646 */
+#line 2602 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 169:
-#line 672 "pars0grm.y" /* yacc.c:1646 */
+ case 166:
+#line 666 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2641 "pars0grm.cc" /* yacc.c:1646 */
+#line 2608 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 170:
-#line 677 "pars0grm.y" /* yacc.c:1646 */
+ case 167:
+#line 671 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_variable_declaration(
static_cast<sym_node_t*>((yyvsp[-2])),
static_cast<pars_res_word_t*>((yyvsp[-1]))); }
-#line 2649 "pars0grm.cc" /* yacc.c:1646 */
+#line 2616 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 174:
-#line 691 "pars0grm.y" /* yacc.c:1646 */
+ case 171:
+#line 685 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_cursor_declaration(
static_cast<sym_node_t*>((yyvsp[-3])),
static_cast<sel_node_t*>((yyvsp[-1]))); }
-#line 2657 "pars0grm.cc" /* yacc.c:1646 */
+#line 2624 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 175:
-#line 698 "pars0grm.y" /* yacc.c:1646 */
+ case 172:
+#line 692 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_function_declaration(
static_cast<sym_node_t*>((yyvsp[-1]))); }
-#line 2664 "pars0grm.cc" /* yacc.c:1646 */
+#line 2631 "pars0grm.cc" /* yacc.c:1646 */
break;
- case 181:
-#line 720 "pars0grm.y" /* yacc.c:1646 */
+ case 178:
+#line 714 "pars0grm.y" /* yacc.c:1646 */
{ (yyval) = pars_procedure_definition(
static_cast<sym_node_t*>((yyvsp[-9])),
static_cast<sym_node_t*>((yyvsp[-7])),
(yyvsp[-1])); }
-#line 2673 "pars0grm.cc" /* yacc.c:1646 */
+#line 2640 "pars0grm.cc" /* yacc.c:1646 */
break;
-#line 2677 "pars0grm.cc" /* yacc.c:1646 */
+#line 2644 "pars0grm.cc" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -2901,5 +2868,5 @@ yyreturn:
#endif
return yyresult;
}
-#line 726 "pars0grm.y" /* yacc.c:1906 */
+#line 720 "pars0grm.y" /* yacc.c:1906 */
diff --git a/storage/innobase/pars/pars0grm.y b/storage/innobase/pars/pars0grm.y
index 5f3cb41310f..9b0a6766c3e 100644
--- a/storage/innobase/pars/pars0grm.y
+++ b/storage/innobase/pars/pars0grm.y
@@ -48,8 +48,6 @@ yylex(void);
%token PARS_INT_LIT
%token PARS_FLOAT_LIT
%token PARS_STR_LIT
-%token PARS_FIXBINARY_LIT
-%token PARS_BLOB_LIT
%token PARS_NULL_LIT
%token PARS_ID_TOKEN
%token PARS_AND_TOKEN
@@ -64,7 +62,6 @@ yylex(void);
%token PARS_BINARY_TOKEN
%token PARS_BLOB_TOKEN
%token PARS_INT_TOKEN
-%token PARS_INTEGER_TOKEN
%token PARS_FLOAT_TOKEN
%token PARS_CHAR_TOKEN
%token PARS_IS_TOKEN
@@ -200,8 +197,6 @@ exp:
| PARS_INT_LIT { $$ = $1;}
| PARS_FLOAT_LIT { $$ = $1;}
| PARS_STR_LIT { $$ = $1;}
- | PARS_FIXBINARY_LIT { $$ = $1;}
- | PARS_BLOB_LIT { $$ = $1;}
| PARS_NULL_LIT { $$ = $1;}
| PARS_SQL_TOKEN { $$ = $1;}
| exp '+' exp { $$ = pars_op('+', $1, $3); }
@@ -645,7 +640,6 @@ rollback_statement:
type_name:
PARS_INT_TOKEN { $$ = &pars_int_token; }
- | PARS_INTEGER_TOKEN { $$ = &pars_int_token; }
| PARS_BIGINT_TOKEN { $$ = &pars_bigint_token; }
| PARS_CHAR_TOKEN { $$ = &pars_char_token; }
| PARS_BINARY_TOKEN { $$ = &pars_binary_token; }
diff --git a/storage/innobase/pars/pars0sym.cc b/storage/innobase/pars/pars0sym.cc
index ed49500dd94..8249af53b39 100644
--- a/storage/innobase/pars/pars0sym.cc
+++ b/storage/innobase/pars/pars0sym.cc
@@ -223,25 +223,15 @@ sym_tab_add_bound_lit(
switch (blit->type) {
case DATA_FIXBINARY:
+ case DATA_CHAR:
+ ut_ad(blit->length > 0);
len = blit->length;
- *lit_type = PARS_FIXBINARY_LIT;
- break;
-
+ /* fall through */
case DATA_BLOB:
- *lit_type = PARS_BLOB_LIT;
- break;
-
case DATA_VARCHAR:
*lit_type = PARS_STR_LIT;
break;
- case DATA_CHAR:
- ut_a(blit->length > 0);
-
- len = blit->length;
- *lit_type = PARS_STR_LIT;
- break;
-
case DATA_INT:
ut_a(blit->length > 0);
ut_a(blit->length <= 8);
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index cc611725095..26bb12e8a03 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -1652,6 +1652,7 @@ rec_copy_prefix_to_buf(
ulint prefix_len;
ulint null_mask;
ulint status;
+ bool is_rtr_node_ptr = false;
UNIV_PREFETCH_RW(*buf);
@@ -1673,6 +1674,7 @@ rec_copy_prefix_to_buf(
/* For R-tree, we need to copy the child page number field. */
if (dict_index_is_spatial(index)) {
ut_ad(n_fields == DICT_INDEX_SPATIAL_NODEPTR_SIZE + 1);
+ is_rtr_node_ptr = true;
} else {
/* it doesn't make sense to copy the child page number
field */
@@ -1717,7 +1719,11 @@ rec_copy_prefix_to_buf(
null_mask <<= 1;
}
- if (field->fixed_len) {
+ if (is_rtr_node_ptr && i == 1) {
+ /* For rtree node ptr rec, we need to
+ copy the page no field with 4 bytes len. */
+ prefix_len += 4;
+ } else if (field->fixed_len) {
prefix_len += field->fixed_len;
} else {
ulint len = *lens--;
@@ -1871,17 +1877,17 @@ rec_print_old(
n = rec_get_n_fields_old(rec);
- fprintf(file, "PHYSICAL RECORD: n_fields %lu;"
- " %u-byte offsets; info bits %lu\n",
- (ulong) n,
+ fprintf(file, "PHYSICAL RECORD: n_fields " ULINTPF ";"
+ " %u-byte offsets; info bits " ULINTPF "\n",
+ n,
rec_get_1byte_offs_flag(rec) ? 1 : 2,
- (ulong) rec_get_info_bits(rec, FALSE));
+ rec_get_info_bits(rec, FALSE));
for (i = 0; i < n; i++) {
data = rec_get_nth_field_old(rec, i, &len);
- fprintf(file, " %lu:", (ulong) i);
+ fprintf(file, " " ULINTPF ":", i);
if (len != UNIV_SQL_NULL) {
if (len <= 30) {
@@ -1890,8 +1896,8 @@ rec_print_old(
} else {
ut_print_buf(file, data, 30);
- fprintf(file, " (total %lu bytes)",
- (ulong) len);
+ fprintf(file, " (total " ULINTPF " bytes)",
+ len);
}
} else {
fprintf(file, " SQL NULL, size " ULINTPF " ",
@@ -1924,7 +1930,7 @@ rec_print_comp(
data = rec_get_nth_field(rec, offsets, i, &len);
- fprintf(file, " %lu:", (ulong) i);
+ fprintf(file, " " ULINTPF ":", i);
if (len != UNIV_SQL_NULL) {
if (len <= 30) {
@@ -1932,16 +1938,17 @@ rec_print_comp(
ut_print_buf(file, data, len);
} else if (rec_offs_nth_extern(offsets, i)) {
ut_print_buf(file, data, 30);
- fprintf(file, " (total %lu bytes, external)",
- (ulong) len);
+ fprintf(file,
+ " (total " ULINTPF " bytes, external)",
+ len);
ut_print_buf(file, data + len
- BTR_EXTERN_FIELD_REF_SIZE,
BTR_EXTERN_FIELD_REF_SIZE);
} else {
ut_print_buf(file, data, 30);
- fprintf(file, " (total %lu bytes)",
- (ulong) len);
+ fprintf(file, " (total " ULINTPF " bytes)",
+ len);
}
} else {
fputs(" SQL NULL", file);
@@ -2007,7 +2014,7 @@ rec_print_mbr_old(
}
}
} else {
- fprintf(file, " SQL NULL, size %lu ",
+ fprintf(file, " SQL NULL, size " ULINTPF " ",
rec_get_nth_field_size(rec, i));
}
@@ -2123,10 +2130,10 @@ rec_print_new(
return;
}
- fprintf(file, "PHYSICAL RECORD: n_fields %lu;"
- " compact format; info bits %lu\n",
- (ulong) rec_offs_n_fields(offsets),
- (ulong) rec_get_info_bits(rec, TRUE));
+ fprintf(file, "PHYSICAL RECORD: n_fields " ULINTPF ";"
+ " compact format; info bits " ULINTPF "\n",
+ rec_offs_n_fields(offsets),
+ rec_get_info_bits(rec, TRUE));
rec_print_comp(file, rec, offsets);
rec_validate(rec, offsets);
@@ -2342,9 +2349,10 @@ wsrep_rec_get_foreign_key(
data = rec_get_nth_field(rec, offsets, i, &len);
if (key_len + ((len != UNIV_SQL_NULL) ? len + 1 : 1) >
*buf_len) {
- fprintf (stderr,
- "WSREP: FK key len exceeded %lu %lu %lu\n",
- key_len, len, *buf_len);
+ fprintf(stderr,
+ "WSREP: FK key len exceeded "
+ ULINTPF " " ULINTPF " " ULINTPF "\n",
+ key_len, len, *buf_len);
goto err_out;
}
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index 19e1ba926d0..fca6ae5a1bf 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2016, MariaDB Corporation.
+Copyright (c) 2015, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -946,7 +946,7 @@ loop:
goto exit;
} else if (retried > 10000) {
ut_ad(!doc_item);
- /* retied too many times and cannot get new record */
+ /* retried too many times and cannot get new record */
ib::error() << "FTS parallel sort processed "
<< num_doc_processed
<< " records, the sort queue has "
@@ -1144,7 +1144,7 @@ fts_parallel_merge(
os_event_set(psort_info->psort_common->merge_event);
psort_info->child_status = FTS_CHILD_EXITING;
- os_thread_exit();
+ os_thread_exit(false);
OS_THREAD_DUMMY_RETURN;
}
@@ -1157,15 +1157,16 @@ row_fts_start_parallel_merge(
fts_psort_t* merge_info) /*!< in: parallel sort info */
{
int i = 0;
- os_thread_id_t thd_id;
/* Kick off merge/insert threads */
for (i = 0; i < FTS_NUM_AUX_INDEX; i++) {
merge_info[i].psort_id = i;
merge_info[i].child_status = 0;
- merge_info[i].thread_hdl = os_thread_create(fts_parallel_merge,
- (void*) &merge_info[i], &thd_id);
+ merge_info[i].thread_hdl = os_thread_create(
+ fts_parallel_merge,
+ (void*) &merge_info[i],
+ &merge_info[i].thread_hdl);
}
}
@@ -1480,10 +1481,9 @@ row_fts_build_sel_tree_level(
int child_left;
int child_right;
ulint i;
- ulint num_item;
+ ulint num_item = ulint(1) << level;
- start = static_cast<ulint>((1 << level) - 1);
- num_item = static_cast<ulint>(1 << level);
+ start = num_item - 1;
for (i = 0; i < num_item; i++) {
child_left = sel_tree[(start + i) * 2 + 1];
@@ -1552,7 +1552,7 @@ row_fts_build_sel_tree(
treelevel++;
}
- start = (1 << treelevel) - 1;
+ start = (ulint(1) << treelevel) - 1;
for (i = 0; i < (int) fts_sort_pll_degree; i++) {
sel_tree[i + start] = i;
@@ -1673,7 +1673,7 @@ row_fts_merge_insert(
}
if (fts_enable_diag_print) {
- ib::info() << "InnoDB_FTS: to inserted " << count_diag
+ ib::info() << "InnoDB_FTS: to insert " << count_diag
<< " records";
}
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index b70a1952f97..01a55d0dc61 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -468,16 +468,6 @@ protected:
return(DB_SUCCESS);
}
- /**
- @return true if it is a root page */
- bool is_root_page(const page_t* page) const UNIV_NOTHROW
- {
- ut_ad(fil_page_index_page_check(page));
-
- return(mach_read_from_4(page + FIL_PAGE_NEXT) == FIL_NULL
- && mach_read_from_4(page + FIL_PAGE_PREV) == FIL_NULL);
- }
-
/** Check if the page is marked as free in the extent descriptor.
@param page_no page number to check in the extent descriptor.
@return true if the page is marked as free */
@@ -669,7 +659,7 @@ FetchIndexRootPages::operator() (
err = set_current_xdes(block->page.id.page_no(), page);
} else if (fil_page_index_page_check(page)
&& !is_free(block->page.id.page_no())
- && is_root_page(page)) {
+ && page_is_root(page)) {
index_id_t id = btr_page_get_index_id(page);
@@ -1088,10 +1078,9 @@ row_import::match_index_columns(
ib_errf(thd, IB_LOG_LEVEL_ERROR,
ER_TABLE_SCHEMA_MISMATCH,
- "Index field count %lu doesn't match"
- " tablespace metadata file value %lu",
- (ulong) index->n_fields,
- (ulong) cfg_index->m_n_fields);
+ "Index field count %u doesn't match"
+ " tablespace metadata file value " ULINTPF,
+ index->n_fields, cfg_index->m_n_fields);
return(DB_ERROR);
}
@@ -1108,8 +1097,8 @@ row_import::match_index_columns(
ER_TABLE_SCHEMA_MISMATCH,
"Index field name %s doesn't match"
" tablespace metadata field name %s"
- " for field position %lu",
- field->name(), cfg_field->name(), (ulong) i);
+ " for field position " ULINTPF,
+ field->name(), cfg_field->name(), i);
err = DB_ERROR;
}
@@ -1117,12 +1106,10 @@ row_import::match_index_columns(
if (cfg_field->prefix_len != field->prefix_len) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
ER_TABLE_SCHEMA_MISMATCH,
- "Index %s field %s prefix len %lu"
- " doesn't match metadata file value"
- " %lu",
+ "Index %s field %s prefix len %u"
+ " doesn't match metadata file value %u",
index->name(), field->name(),
- (ulong) field->prefix_len,
- (ulong) cfg_field->prefix_len);
+ field->prefix_len, cfg_field->prefix_len);
err = DB_ERROR;
}
@@ -1130,12 +1117,11 @@ row_import::match_index_columns(
if (cfg_field->fixed_len != field->fixed_len) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
ER_TABLE_SCHEMA_MISMATCH,
- "Index %s field %s fixed len %lu"
- " doesn't match metadata file value"
- " %lu",
+ "Index %s field %s fixed len %u"
+ " doesn't match metadata file value %u",
index->name(), field->name(),
- (ulong) field->fixed_len,
- (ulong) cfg_field->fixed_len);
+ field->fixed_len,
+ cfg_field->fixed_len);
err = DB_ERROR;
}
@@ -1176,12 +1162,11 @@ row_import::match_table_columns(
} else if (cfg_col_index != col->ind) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Column %s ordinal value mismatch, it's at"
- " %lu in the table and %lu in the tablespace"
- " meta-data file",
- col_name,
- (ulong) col->ind, (ulong) cfg_col_index);
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Column %s ordinal value mismatch, it's at %u"
+ " in the table and " ULINTPF
+ " in the tablespace meta-data file",
+ col_name, col->ind, cfg_col_index);
err = DB_ERROR;
} else {
@@ -1263,19 +1248,19 @@ row_import::match_schema(
{
/* Do some simple checks. */
- if (m_flags != m_table->flags) {
+ if ((m_table->flags ^ m_flags) & ~DICT_TF_MASK_DATA_DIR) {
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
- "Table flags don't match, server table has 0x%lx"
- " and the meta-data file has 0x%lx",
- (ulong) m_table->n_cols, (ulong) m_flags);
+ "Table flags don't match, server table has 0x%x"
+ " and the meta-data file has 0x" ULINTPFx,
+ m_table->flags, m_flags);
return(DB_ERROR);
} else if (m_table->n_cols != m_n_cols) {
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
- "Number of columns don't match, table has %lu"
- " columns but the tablespace meta-data file has"
- " %lu columns",
- (ulong) m_table->n_cols, (ulong) m_n_cols);
+ "Number of columns don't match, table has %u"
+ " columns but the tablespace meta-data file has "
+ ULINTPF " columns",
+ m_table->n_cols, m_n_cols);
return(DB_ERROR);
} else if (UT_LIST_GET_LEN(m_table->indexes) != m_n_indexes) {
@@ -1285,11 +1270,10 @@ row_import::match_schema(
table matching the IMPORT definition. */
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
- "Number of indexes don't match, table has %lu"
- " indexes but the tablespace meta-data file has"
- " %lu indexes",
- (ulong) UT_LIST_GET_LEN(m_table->indexes),
- (ulong) m_n_indexes);
+ "Number of indexes don't match, table has " ULINTPF
+ " indexes but the tablespace meta-data file has "
+ ULINTPF " indexes",
+ UT_LIST_GET_LEN(m_table->indexes), m_n_indexes);
return(DB_ERROR);
}
@@ -1590,9 +1574,10 @@ PageConverter::adjust_cluster_index_blob_column(
ib_errf(m_trx->mysql_thd, IB_LOG_LEVEL_ERROR,
ER_INNODB_INDEX_CORRUPT,
- "Externally stored column(%lu) has a reference"
- " length of %lu in the cluster index %s",
- (ulong) i, (ulong) len, m_cluster_index->name());
+ "Externally stored column(" ULINTPF
+ ") has a reference length of " ULINTPF
+ " in the cluster index %s",
+ i, len, m_cluster_index->name());
return(DB_CORRUPTION);
}
@@ -1831,12 +1816,28 @@ PageConverter::update_index_page(
btr_page_set_index_id(
page, m_page_zip_ptr, m_index->m_srv_index->id, 0);
- page_set_max_trx_id(block, m_page_zip_ptr, m_trx->id, 0);
+ if (dict_index_is_clust(m_index->m_srv_index)) {
+ if (page_is_root(page)) {
+ /* Preserve the PAGE_ROOT_AUTO_INC. */
+ } else {
+ /* Clear PAGE_MAX_TRX_ID so that it can be
+ used for other purposes in the future. IMPORT
+ in MySQL 5.6, 5.7 and MariaDB 10.0 and 10.1
+ would set the field to the transaction ID even
+ on clustered index pages. */
+ page_set_max_trx_id(block, m_page_zip_ptr, 0, NULL);
+ }
+ } else {
+ /* Set PAGE_MAX_TRX_ID on secondary index leaf pages,
+ and clear it on non-leaf pages. */
+ page_set_max_trx_id(block, m_page_zip_ptr,
+ page_is_leaf(page) ? m_trx->id : 0, NULL);
+ }
- if (page_is_empty(block->frame)) {
+ if (page_is_empty(page)) {
/* Only a root page can be empty. */
- if (!is_root_page(block->frame)) {
+ if (!page_is_root(page)) {
// TODO: We should relax this and skip secondary
// indexes. Mark them as corrupt because they can
// always be rebuilt.
@@ -2259,11 +2260,10 @@ row_import_adjust_root_pages_of_secondary_indexes(
ib_errf(trx->mysql_thd,
IB_LOG_LEVEL_WARN,
ER_INNODB_INDEX_CORRUPT,
- "Index %s contains %lu entries,"
- " should be %lu, you should recreate"
- " this index.", index->name(),
- (ulong) purge.get_n_rows(),
- (ulong) n_rows_in_table);
+ "Index '%s' contains " ULINTPF " entries, "
+ "should be " ULINTPF ", you should recreate "
+ "this index.", index->name(),
+ purge.get_n_rows(), n_rows_in_table);
index->type |= DICT_CORRUPT;
@@ -2564,10 +2564,10 @@ row_import_read_index_data(
char msg[BUFSIZ];
ut_snprintf(msg, sizeof(msg),
- "while reading index meta-data, expected"
- " to read %lu bytes but read only %lu"
- " bytes",
- (ulong) sizeof(row), (ulong) n_bytes);
+ "while reading index meta-data, expected "
+ "to read " ULINTPF
+ " bytes but read only " ULINTPF " bytes",
+ sizeof(row), n_bytes);
ib_senderrf(
thd, IB_LOG_LEVEL_ERROR, ER_IO_READ_ERROR,
@@ -2619,8 +2619,8 @@ row_import_read_index_data(
if (len > OS_FILE_MAX_PATH) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
ER_INNODB_INDEX_CORRUPT,
- "Index name length (%lu) is too long,"
- " the meta-data is corrupt", len);
+ "Index name length (" ULINTPF ") is too long, "
+ "the meta-data is corrupt", len);
return(DB_CORRUPTION);
}
@@ -2702,8 +2702,8 @@ row_import_read_indexes(
} else if (cfg->m_n_indexes > 1024) {
// FIXME: What is the upper limit? */
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_IO_READ_ERROR,
- "Number of indexes in meta-data file is too high: %lu",
- (ulong) cfg->m_n_indexes);
+ "Number of indexes in meta-data file is too high: "
+ ULINTPF, cfg->m_n_indexes);
cfg->m_n_indexes = 0;
return(DB_CORRUPTION);
@@ -2807,8 +2807,8 @@ row_import_read_columns(
if (len == 0 || len > 128) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
ER_IO_READ_ERROR,
- "Column name length %lu, is invalid",
- (ulong) len);
+ "Column name length " ULINTPF ", is invalid",
+ len);
return(DB_CORRUPTION);
}
@@ -3058,8 +3058,8 @@ row_import_read_meta_data(
return(row_import_read_v1(file, thd, &cfg));
default:
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_IO_READ_ERROR,
- "Unsupported meta-data version number (%lu),"
- " file ignored", (ulong) cfg.m_version);
+ "Unsupported meta-data version number (" ULINTPF "), "
+ "file ignored", cfg.m_version);
}
return(DB_ERROR);
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index f596f3d8f27..5152d499bad 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1596,6 +1596,10 @@ row_ins_check_foreign_constraint(
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
+ bool skip_gap_lock;
+
+ skip_gap_lock = (trx->isolation_level <= TRX_ISO_READ_COMMITTED);
+
DBUG_ENTER("row_ins_check_foreign_constraint");
rec_offs_init(offsets_);
@@ -1725,6 +1729,11 @@ row_ins_check_foreign_constraint(
if (page_rec_is_supremum(rec)) {
+ if (skip_gap_lock) {
+
+ continue;
+ }
+
err = row_ins_set_shared_rec_lock(LOCK_ORDINARY, block,
rec, check_index,
offsets, thr);
@@ -1740,10 +1749,17 @@ row_ins_check_foreign_constraint(
cmp = cmp_dtuple_rec(entry, rec, offsets);
if (cmp == 0) {
+
+ ulint lock_type;
+
+ lock_type = skip_gap_lock
+ ? LOCK_REC_NOT_GAP
+ : LOCK_ORDINARY;
+
if (rec_get_deleted_flag(rec,
rec_offs_comp(offsets))) {
err = row_ins_set_shared_rec_lock(
- LOCK_ORDINARY, block,
+ lock_type, block,
rec, check_index, offsets, thr);
switch (err) {
case DB_SUCCESS_LOCKED_REC:
@@ -1824,9 +1840,13 @@ row_ins_check_foreign_constraint(
} else {
ut_a(cmp < 0);
- err = row_ins_set_shared_rec_lock(
- LOCK_GAP, block,
- rec, check_index, offsets, thr);
+ err = DB_SUCCESS;
+
+ if (!skip_gap_lock) {
+ err = row_ins_set_shared_rec_lock(
+ LOCK_GAP, block,
+ rec, check_index, offsets, thr);
+ }
switch (err) {
case DB_SUCCESS_LOCKED_REC:
@@ -1878,6 +1898,8 @@ do_possible_lock_wait:
my_atomic_addlint(
&check_table->n_foreign_key_checks_running, 1);
+ trx_kill_blocking(trx);
+
lock_wait_suspend_thread(thr);
thr->lock_state = QUE_THR_LOCK_NOLOCK;
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 7e6975a67f1..36ad6cdd3d9 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -649,7 +649,7 @@ row_log_table_delete(
&old_pk_extra_size);
ut_ad(old_pk_extra_size < 0x100);
- mrec_size = 4 + old_pk_size;
+ mrec_size = 6 + old_pk_size;
/* Log enough prefix of the BLOB unless both the
old and new table are in COMPACT or REDUNDANT format,
@@ -686,8 +686,8 @@ row_log_table_delete(
*b++ = static_cast<byte>(old_pk_extra_size);
/* Log the size of external prefix we saved */
- mach_write_to_2(b, ext_size);
- b += 2;
+ mach_write_to_4(b, ext_size);
+ b += 4;
rec_convert_dtuple_to_temp(
b + old_pk_extra_size, new_index,
@@ -820,12 +820,9 @@ row_log_table_low_redundant(
mrec_size = ROW_LOG_HEADER_SIZE + size + (extra_size >= 0x80);
- if (ventry && ventry->n_v_fields > 0) {
- ulint v_extra = 0;
- mrec_size += rec_get_converted_size_temp(
- index, NULL, 0, ventry, &v_extra);
-
+ if (num_v) {
if (o_ventry) {
+ ulint v_extra = 0;
mrec_size += rec_get_converted_size_temp(
index, NULL, 0, o_ventry, &v_extra);
}
@@ -878,11 +875,7 @@ row_log_table_low_redundant(
ventry);
b += size;
- if (ventry && ventry->n_v_fields > 0) {
- rec_convert_dtuple_to_temp(
- b, new_index, NULL, 0, ventry);
- b += mach_read_from_2(b);
-
+ if (num_v) {
if (o_ventry) {
rec_convert_dtuple_to_temp(
b, new_index, NULL, 0, o_ventry);
@@ -943,6 +936,13 @@ row_log_table_low(
ut_ad(fil_page_get_type(page_align(rec)) == FIL_PAGE_INDEX);
ut_ad(page_is_leaf(page_align(rec)));
ut_ad(!page_is_comp(page_align(rec)) == !rec_offs_comp(offsets));
+ /* old_pk=row_log_table_get_pk() [not needed in INSERT] is a prefix
+ of the clustered index record (PRIMARY KEY,DB_TRX_ID,DB_ROLL_PTR),
+ with no information on virtual columns */
+ ut_ad(!old_pk || !insert);
+ ut_ad(!old_pk || old_pk->n_v_fields == 0);
+ ut_ad(!o_ventry || !insert);
+ ut_ad(!o_ventry || ventry);
if (dict_index_is_corrupted(index)
|| !dict_index_is_online_ddl(index)
@@ -996,7 +996,7 @@ row_log_table_low(
old_pk_size = rec_get_converted_size_temp(
new_index, old_pk->fields, old_pk->n_fields,
- old_pk, &old_pk_extra_size);
+ NULL, &old_pk_extra_size);
ut_ad(old_pk_extra_size < 0x100);
mrec_size += 1/*old_pk_extra_size*/ + old_pk_size;
}
@@ -2195,8 +2195,9 @@ func_exit_committed:
goto func_exit_committed;
}
- dtuple_t* entry = row_build_index_entry(
- row, NULL, index, heap);
+ /** It allows to create tuple with virtual column information. */
+ dtuple_t* entry = row_build_index_entry_low(
+ row, NULL, index, heap, ROW_BUILD_FOR_INSERT);
upd_t* update = row_upd_build_difference_binary(
index, entry, btr_pcur_get_rec(&pcur), cur_offsets,
false, NULL, heap, dup->table);
@@ -2441,14 +2442,14 @@ row_log_table_apply_op(
break;
case ROW_T_DELETE:
- /* 1 (extra_size) + 2 (ext_size) + at least 1 (payload) */
- if (mrec + 4 >= mrec_end) {
+ /* 1 (extra_size) + 4 (ext_size) + at least 1 (payload) */
+ if (mrec + 6 >= mrec_end) {
return(NULL);
}
extra_size = *mrec++;
- ext_size = mach_read_from_2(mrec);
- mrec += 2;
+ ext_size = mach_read_from_4(mrec);
+ mrec += 4;
ut_ad(mrec < mrec_end);
/* We assume extra_size < 0x100 for the PRIMARY KEY prefix.
@@ -2459,6 +2460,10 @@ row_log_table_apply_op(
rec_init_offsets_temp(mrec, new_index, offsets);
next_mrec = mrec + rec_offs_data_size(offsets) + ext_size;
if (log->table->n_v_cols) {
+ if (next_mrec + 2 >= mrec_end) {
+ return(NULL);
+ }
+
next_mrec += mach_read_from_2(next_mrec);
}
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 85f0ce2c9e6..aeff27c31eb 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2014, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -26,6 +26,7 @@ Completed by Sunny Bains and Marko Makela
*******************************************************/
#include <my_config.h>
#include <log.h>
+#include <sql_class.h>
#include <math.h>
@@ -3300,7 +3301,11 @@ row_merge_sort(
}
#endif /* UNIV_SOLARIS */
- sql_print_information("InnoDB: Online DDL : merge-sorting has estimated %lu runs", num_runs);
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information("InnoDB: Online DDL : merge-sorting"
+ " has estimated " ULINTPF " runs",
+ num_runs);
+ }
/* Merge the runs until we have one big run */
do {
@@ -4765,9 +4770,11 @@ row_merge_build_indexes(
duplicate keys. */
innobase_rec_reset(table);
- sql_print_information("InnoDB: Online DDL : Start");
- sql_print_information("InnoDB: Online DDL : Start reading clustered "
- "index of the table and create temporary files");
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information("InnoDB: Online DDL : Start reading"
+ " clustered index of the table"
+ " and create temporary files");
+ }
pct_cost = COST_READ_CLUSTERED_INDEX * 100 / (total_static_cost + total_dynamic_cost);
@@ -4795,8 +4802,11 @@ row_merge_build_indexes(
pct_progress += pct_cost;
- sql_print_information("InnoDB: Online DDL : End of reading "
- "clustered index of the table and create temporary files");
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information("InnoDB: Online DDL : End of reading "
+ "clustered index of the table"
+ " and create temporary files");
+ }
for (i = 0; i < n_indexes; i++) {
total_index_blocks += merge_files[i].offset;
@@ -4875,6 +4885,13 @@ wait_again:
" threads exited when creating"
" FTS index '"
<< indexes[i]->name << "'";
+ } else {
+ for (j = 0; j < FTS_NUM_AUX_INDEX;
+ j++) {
+
+ os_thread_join(merge_info[j]
+ .thread_hdl);
+ }
}
} else {
/* This cannot report duplicates; an
@@ -4888,8 +4905,7 @@ wait_again:
DEBUG_FTS_SORT_PRINT("FTS_SORT: Complete Insert\n");
#endif
} else if (merge_files[i].fd >= 0) {
- char buf[3 * NAME_LEN];
- char *bufend;
+ char buf[NAME_LEN + 1];
row_merge_dup_t dup = {
sort_idx, table, col_map, 0};
@@ -4898,17 +4914,24 @@ wait_again:
total_index_blocks)) /
(total_static_cost + total_dynamic_cost)
* PCT_COST_MERGESORT_INDEX * 100;
-
- bufend = innobase_convert_name(
+ char* bufend = innobase_convert_name(
buf, sizeof buf,
- indexes[i]->name, strlen(indexes[i]->name),
+ indexes[i]->name,
+ strlen(indexes[i]->name),
trx->mysql_thd);
-
buf[bufend - buf]='\0';
- sql_print_information("InnoDB: Online DDL : Start merge-sorting"
- " index %s (%lu / %lu), estimated cost : %2.4f",
- buf, (i+1), n_indexes, pct_cost);
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information("InnoDB: Online DDL :"
+ " Start merge-sorting"
+ " index %s"
+ " (" ULINTPF
+ " / " ULINTPF "),"
+ " estimated cost :"
+ " %2.4f",
+ buf, i + 1, n_indexes,
+ pct_cost);
+ }
error = row_merge_sort(
trx, &dup, &merge_files[i],
@@ -4918,9 +4941,14 @@ wait_again:
pct_progress += pct_cost;
- sql_print_information("InnoDB: Online DDL : End of "
- " merge-sorting index %s (%lu / %lu)",
- buf, (i+1), n_indexes);
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information("InnoDB: Online DDL :"
+ " End of "
+ " merge-sorting index %s"
+ " (" ULINTPF
+ " / " ULINTPF ")",
+ buf, i + 1, n_indexes);
+ }
DBUG_EXECUTE_IF(
"ib_merge_wait_after_sort",
@@ -4937,10 +4965,15 @@ wait_again:
(total_static_cost + total_dynamic_cost) *
PCT_COST_INSERT_INDEX * 100;
- sql_print_information("InnoDB: Online DDL : Start "
- "building index %s (%lu / %lu), estimated "
- "cost : %2.4f", buf, (i+1),
- n_indexes, pct_cost);
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information(
+ "InnoDB: Online DDL : Start "
+ "building index %s"
+ " (" ULINTPF
+ " / " ULINTPF "), estimated "
+ "cost : %2.4f", buf, i + 1,
+ n_indexes, pct_cost);
+ }
error = row_merge_insert_index_tuples(
trx->id, sort_idx, old_table,
@@ -4953,9 +4986,13 @@ wait_again:
pct_progress += pct_cost;
- sql_print_information("InnoDB: Online DDL : "
- "End of building index %s (%lu / %lu)",
- buf, (i+1), n_indexes);
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information(
+ "InnoDB: Online DDL : "
+ "End of building index %s"
+ " (" ULINTPF " / " ULINTPF ")",
+ buf, i + 1, n_indexes);
+ }
}
}
@@ -4973,19 +5010,19 @@ wait_again:
== ONLINE_INDEX_COMPLETE);
} else {
ut_ad(need_flush_observer);
- sql_print_information("InnoDB: Online DDL : Start applying row log");
-
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information(
+ "InnoDB: Online DDL : Applying"
+ " log to index");
+ }
flush_observer->flush();
row_merge_write_redo(indexes[i]);
DEBUG_SYNC_C("row_log_apply_before");
error = row_log_apply(trx, sort_idx, table, stage);
DEBUG_SYNC_C("row_log_apply_after");
- sql_print_information("InnoDB: Online DDL : End of applying row log");
}
- sql_print_information("InnoDB: Online DDL : Completed");
-
if (error != DB_SUCCESS) {
trx->error_key_num = key_numbers[i];
goto func_exit;
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 03d7ac628a7..aed59070396 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -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) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -1440,7 +1440,7 @@ row_insert_for_mysql(
return(DB_TABLESPACE_NOT_FOUND);
} else if (prebuilt->table->is_encrypted) {
ib_push_warning(trx, DB_DECRYPTION_FAILED,
- "Table %s in tablespace %lu encrypted."
+ "Table %s in tablespace " ULINTPF " encrypted."
"However key management plugin or used key_id is not found or"
" used encryption algorithm or method does not match.",
prebuilt->table->name, prebuilt->table->space);
@@ -1505,6 +1505,8 @@ run_again:
row_ins_step(thr);
+ DEBUG_SYNC_C("ib_after_row_insert_step");
+
err = trx->error_state;
if (err != DB_SUCCESS) {
@@ -1866,7 +1868,7 @@ row_update_for_mysql_using_upd_graph(
DBUG_RETURN(DB_ERROR);
} else if (prebuilt->table->is_encrypted) {
ib_push_warning(trx, DB_DECRYPTION_FAILED,
- "Table %s in tablespace %lu encrypted."
+ "Table %s in tablespace " ULINTPF " encrypted."
"However key management plugin or used key_id is not found or"
" used encryption algorithm or method does not match.",
prebuilt->table->name, prebuilt->table->space);
@@ -2888,6 +2890,10 @@ loop:
return(n_tables + n_tables_dropped);
}
+ DBUG_EXECUTE_IF("row_drop_tables_in_background_sleep",
+ os_thread_sleep(5000000);
+ );
+
table = dict_table_open_on_name(drop->table_name, FALSE, FALSE,
DICT_ERR_IGNORE_NONE);
@@ -2898,6 +2904,16 @@ loop:
goto already_dropped;
}
+ if (!table->to_be_dropped) {
+ /* There is a scenario: the old table is dropped
+ just after it's added into drop list, and new
+ table with the same name is created, then we try
+ to drop the new table in background. */
+ dict_table_close(table, FALSE, FALSE);
+
+ goto already_dropped;
+ }
+
ut_a(!table->can_be_evicted);
dict_table_close(table, FALSE, FALSE);
@@ -3766,6 +3782,13 @@ row_drop_table_for_mysql(
}
}
+
+ DBUG_EXECUTE_IF("row_drop_table_add_to_background",
+ row_add_table_to_background_drop_list(table->name.m_name);
+ err = DB_SUCCESS;
+ goto funct_exit;
+ );
+
/* TODO: could we replace the counter n_foreign_key_checks_running
with lock checks on the table? Acquire here an exclusive lock on the
table, and rewrite lock0lock.cc and the lock wait in srv0srv.cc so that
@@ -4272,6 +4295,19 @@ loop:
row_mysql_lock_data_dictionary(trx);
while ((table_name = dict_get_first_table_name_in_db(name))) {
+ /* Drop parent table if it is a fts aux table, to
+ avoid accessing dropped fts aux tables in information
+ scheam when parent table still exists.
+ Note: Drop parent table will drop fts aux tables. */
+ char* parent_table_name;
+ parent_table_name = fts_get_parent_table_name(
+ table_name, strlen(table_name));
+
+ if (parent_table_name != NULL) {
+ ut_free(table_name);
+ table_name = parent_table_name;
+ }
+
ut_a(memcmp(table_name, name, namelen) == 0);
table = dict_table_open_on_name(
@@ -5010,9 +5046,6 @@ row_scan_index_for_mysql(
row_prebuilt_t* prebuilt, /*!< in: prebuilt struct
in MySQL handle */
const dict_index_t* index, /*!< in: index */
- bool check_keys, /*!< in: true=check for mis-
- ordered or duplicate records,
- false=count the rows only */
ulint* n_rows) /*!< out: number of entries
seen in the consistent read */
{
@@ -5079,7 +5112,7 @@ loop:
goto func_exit;
default:
{
- const char* doing = check_keys? "CHECK TABLE" : "COUNT(*)";
+ const char* doing = "CHECK TABLE";
ib::warn() << doing << " on index " << index->name << " of"
" table " << index->table->name << " returned " << ret;
/* fall through (this error is ignored by CHECK TABLE) */
@@ -5095,9 +5128,6 @@ func_exit:
*n_rows = *n_rows + 1;
- if (!check_keys) {
- goto next_rec;
- }
/* else this code is doing handler::check() for CHECK TABLE */
/* row_search... returns the index record in buf, record origin offset
@@ -5179,7 +5209,6 @@ not_ok:
}
}
-next_rec:
ret = row_search_for_mysql(
buf, PAGE_CUR_G, prebuilt, 0, ROW_SEL_NEXT);
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index 2a13203b747..492d864ec96 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -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.
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
@@ -43,6 +43,7 @@ Created 3/14/1997 Heikki Tuuri
#include "srv0start.h"
#include "handler.h"
#include "ha_innodb.h"
+#include "fil0fil.h"
/*************************************************************************
IMPORTANT NOTE: Any operation that generates redo MUST check that there
@@ -852,8 +853,15 @@ try_again:
/* The table has been dropped: no need to do purge */
goto err_exit;
}
+
ut_ad(!dict_table_is_temporary(node->table));
+ if (!fil_table_accessible(node->table)) {
+ dict_table_close(node->table, FALSE, FALSE);
+ node->table = NULL;
+ goto err_exit;
+ }
+
if (node->table->n_v_cols && !node->table->vc_templ
&& dict_table_has_indexed_v_cols(node->table)) {
/* Need server fully up for virtual column computation */
@@ -872,16 +880,6 @@ try_again:
innobase_init_vc_templ(node->table);
}
- if (node->table->ibd_file_missing) {
- /* We skip purge of missing .ibd files */
-
- dict_table_close(node->table, FALSE, FALSE);
-
- node->table = NULL;
-
- goto err_exit;
- }
-
clust_index = dict_table_get_first_index(node->table);
if (clust_index == NULL
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index 46cff288059..1fc30e714f4 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2013, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -2000,9 +2000,22 @@ row_truncate_table_for_mysql(
}
if (is_file_per_table && fsp_flags != ULINT_UNDEFINED) {
- fil_reinit_space_header(
- table->space,
- table->indexes.count + FIL_IBD_FILE_INITIAL_SIZE + 1);
+ /* A single-table tablespace has initially
+ FIL_IBD_FILE_INITIAL_SIZE number of pages allocated and an
+ extra page is allocated for each of the indexes present. But in
+ the case of clust index 2 pages are allocated and as one is
+ covered in the calculation as part of table->indexes.count we
+ take care of the other page by adding 1. */
+ ulint space_size = table->indexes.count +
+ FIL_IBD_FILE_INITIAL_SIZE + 1;
+
+ if (has_internal_doc_id) {
+ /* Since aux tables are created for fts indexes and
+ they use seperate tablespaces. */
+ space_size -= ib_vector_size(table->fts->indexes);
+ }
+
+ fil_reinit_space_header(table->space, space_size, trx);
}
DBUG_EXECUTE_IF("ib_trunc_crash_with_intermediate_log_checkpoint",
diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc
index 25504e32087..9288adb21a4 100644
--- a/storage/innobase/row/row0uins.cc
+++ b/storage/innobase/row/row0uins.cc
@@ -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.
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
@@ -41,6 +41,7 @@ Created 2/25/1997 Heikki Tuuri
#include "que0que.h"
#include "ibuf0ibuf.h"
#include "log0log.h"
+#include "fil0fil.h"
/*************************************************************************
IMPORTANT NOTE: Any operation that generates redo MUST check that there
@@ -345,8 +346,20 @@ row_undo_ins_parse_undo_rec(
/* Skip the UNDO if we can't find the table or the .ibd file. */
if (UNIV_UNLIKELY(node->table == NULL)) {
- } else if (UNIV_UNLIKELY(node->table->ibd_file_missing)) {
+ return;
+ }
+
+ if (UNIV_UNLIKELY(!fil_table_accessible(node->table))) {
close_table:
+ /* Normally, tables should not disappear or become
+ unaccessible during ROLLBACK, because they should be
+ protected by InnoDB table locks. TRUNCATE TABLE
+ or table corruption could be valid exceptions.
+
+ FIXME: When running out of temporary tablespace, it
+ would probably be better to just drop all temporary
+ tables (and temporary undo log records) of the current
+ connection, instead of doing this rollback. */
dict_table_close(node->table, dict_locked, FALSE);
node->table = NULL;
} else {
@@ -357,6 +370,9 @@ close_table:
ptr, clust_index, &node->ref, node->heap);
if (!row_undo_search_clust_to_pcur(node)) {
+ /* An error probably occurred during
+ an insert into the clustered index,
+ after we wrote the undo log record. */
goto close_table;
}
if (node->table->n_v_cols) {
diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc
index 378cad00b93..ba072a72aa1 100644
--- a/storage/innobase/row/row0umod.cc
+++ b/storage/innobase/row/row0umod.cc
@@ -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.
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
@@ -1139,12 +1139,19 @@ row_undo_mod_parse_undo_rec(
return;
}
- if (node->table->ibd_file_missing) {
+ if (UNIV_UNLIKELY(!fil_table_accessible(node->table))) {
+close_table:
+ /* Normally, tables should not disappear or become
+ unaccessible during ROLLBACK, because they should be
+ protected by InnoDB table locks. TRUNCATE TABLE
+ or table corruption could be valid exceptions.
+
+ FIXME: When running out of temporary tablespace, it
+ would probably be better to just drop all temporary
+ tables (and temporary undo log records) of the current
+ connection, instead of doing this rollback. */
dict_table_close(node->table, dict_locked, FALSE);
-
- /* We skip undo operations to missing .ibd files */
node->table = NULL;
-
return;
}
@@ -1162,15 +1169,21 @@ row_undo_mod_parse_undo_rec(
node->new_trx_id = trx_id;
node->cmpl_info = cmpl_info;
- if (!row_undo_search_clust_to_pcur(node)) {
-
- dict_table_close(node->table, dict_locked, FALSE);
-
- node->table = NULL;
+ if (UNIV_UNLIKELY(!row_undo_search_clust_to_pcur(node))) {
+ /* This should never occur. As long as this
+ rolling-back transaction exists, the PRIMARY KEY value
+ pointed to by the undo log record must exist.
+ btr_cur_upd_lock_and_undo() only writes the undo log
+ record after successfully acquiring an exclusive lock
+ on the the clustered index record. That lock will not
+ be released before the transaction is committed or
+ fully rolled back. */
+ ut_ad(0);
+ goto close_table;
}
/* Extract indexed virtual columns from undo log */
- if (node->table && node->table->n_v_cols) {
+ if (node->table->n_v_cols) {
row_upd_replace_vcol(node->row, node->table,
node->update, false, node->undo_row,
(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)
diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc
index 5a3e1a2c930..f6c388f2dcf 100644
--- a/storage/innobase/srv/srv0mon.cc
+++ b/storage/innobase/srv/srv0mon.cc
@@ -2,7 +2,7 @@
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2016, MariaDB Corporation
+Copyright (c) 2013, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -739,11 +739,11 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_DEFAULT_START, MONITOR_OVLD_OS_FSYNC},
{"os_pending_reads", "os", "Number of reads pending",
- MONITOR_NONE,
+ MONITOR_DEFAULT_ON,
MONITOR_DEFAULT_START, MONITOR_OS_PENDING_READS},
{"os_pending_writes", "os", "Number of writes pending",
- MONITOR_NONE,
+ MONITOR_DEFAULT_ON,
MONITOR_DEFAULT_START, MONITOR_OS_PENDING_WRITES},
{"os_log_bytes_written", "os",
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index a05bb5300a3..6e010fadc6d 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -87,7 +87,7 @@ UNIV_INTERN ulong srv_fatal_semaphore_wait_threshold = DEFAULT_SRV_FATAL_SEMAPH
/* How much data manipulation language (DML) statements need to be delayed,
in microseconds, in order to reduce the lagging of the purge thread. */
-ulint srv_dml_needed_delay = 0;
+ulint srv_dml_needed_delay;
bool srv_monitor_active;
bool srv_error_monitor_active;
@@ -107,34 +107,34 @@ const char srv_mysql50_table_name_prefix[10] = "#mysql50#";
/* The following three are dir paths which are catenated before file
names, where the file name itself may also contain a path */
-char* srv_data_home = NULL;
+char* srv_data_home;
/** Rollback files directory, can be absolute. */
-char* srv_undo_dir = NULL;
+char* srv_undo_dir;
/** The number of tablespaces to use for rollback segments. */
-ulong srv_undo_tablespaces = 0;
+ulong srv_undo_tablespaces;
/** The number of UNDO tablespaces that are open and ready to use. */
-ulint srv_undo_tablespaces_open = 0;
+ulint srv_undo_tablespaces_open;
/** The number of UNDO tablespaces that are active (hosting some rollback
segment). It is quite possible that some of the tablespaces doesn't host
any of the rollback-segment based on configuration used. */
-ulint srv_undo_tablespaces_active = 0;
+ulint srv_undo_tablespaces_active;
/* The number of rollback segments to use */
-ulong srv_undo_logs = 1;
+ulong srv_undo_logs;
/** Rate at which UNDO records should be purged. */
-ulong srv_purge_rseg_truncate_frequency = 128;
+ulong srv_purge_rseg_truncate_frequency;
/** Enable or Disable Truncate of UNDO tablespace.
Note: If enabled then UNDO tablespace will be selected for truncate.
While Server waits for undo-tablespace to truncate if user disables
it, truncate action is completed but no new tablespace is marked
for truncate (action is never aborted). */
-my_bool srv_undo_log_truncate = FALSE;
+my_bool srv_undo_log_truncate;
/** Maximum size of undo tablespace. */
unsigned long long srv_max_undo_log_size;
@@ -151,7 +151,7 @@ my_bool srv_read_only_mode;
dictionary tables are in the system tablespace 0 */
my_bool srv_file_per_table;
/** The file format to use on new *.ibd files. */
-ulint srv_file_format = 0;
+ulint srv_file_format;
/** Whether to check file format during startup. A value of
UNIV_FORMAT_MAX + 1 means no checking ie. FALSE. The default is to
set it to the highest format we support. */
@@ -166,9 +166,9 @@ my_bool high_level_read_only;
/** Place locks to records only i.e. do not use next-key locking except
on duplicate key checking and foreign key checking */
-ibool srv_locks_unsafe_for_binlog = FALSE;
+ibool srv_locks_unsafe_for_binlog;
/** Sort buffer size in index creation */
-ulong srv_sort_buf_size = 1048576;
+ulong srv_sort_buf_size;
/** Maximum modification log file size for online index creation */
unsigned long long srv_online_max_size;
@@ -176,19 +176,19 @@ unsigned long long srv_online_max_size;
OS (provided we compiled Innobase with it in), otherwise we will
use simulated aio we build below with threads.
Currently we support native aio on windows and linux */
-my_bool srv_use_native_aio = TRUE;
-my_bool srv_numa_interleave = FALSE;
-/* If this flag is TRUE, then we will use fallocate(PUCH_HOLE)
-to the pages */
-UNIV_INTERN my_bool srv_use_trim;
-/* If this flag is TRUE, then we disable doublewrite buffer */
-UNIV_INTERN my_bool srv_use_atomic_writes = FALSE;
-/* If this flag IS TRUE, then we use this algorithm for page compressing the pages */
-UNIV_INTERN ulong innodb_compression_algorithm = PAGE_ZLIB_ALGORITHM;
-/* Number of threads used for multi-threaded flush */
-UNIV_INTERN long srv_mtflush_threads = MTFLUSH_DEFAULT_WORKER;
-/* If this flag is TRUE, then we will use multi threaded flush. */
-UNIV_INTERN my_bool srv_use_mtflush = FALSE;
+my_bool srv_use_native_aio;
+my_bool srv_numa_interleave;
+/** innodb_use_trim; whether to use fallocate(PUNCH_HOLE) with
+page_compression */
+my_bool srv_use_trim;
+/** copy of innodb_use_atomic_writes; @see innobase_init() */
+my_bool srv_use_atomic_writes;
+/** innodb_compression_algorithm; used with page compression */
+ulong innodb_compression_algorithm;
+/** innodb_mtflush_threads; number of threads used for multi-threaded flush */
+long srv_mtflush_threads;
+/** innodb_use_mtflush; whether to use multi threaded flush. */
+my_bool srv_use_mtflush;
#ifdef UNIV_DEBUG
/** Used by SET GLOBAL innodb_master_thread_disabled_debug = X. */
@@ -215,22 +215,27 @@ During startup, this is in bytes, and later converted to pages. */
ib_uint64_t srv_log_file_size;
/** The value of the startup parameter innodb_log_file_size */
ib_uint64_t srv_log_file_size_requested;
-/* size in database pages */
-ulint srv_log_buffer_size = ULINT_MAX;
-ulong srv_flush_log_at_trx_commit = 1;
-uint srv_flush_log_at_timeout = 1;
-ulong srv_page_size = UNIV_PAGE_SIZE_DEF;
-ulong srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_DEF;
-ulong srv_log_write_ahead_size = 0;
+/** copy of innodb_log_buffer_size, but in database pages */
+ulint srv_log_buffer_size;
+/** innodb_flush_log_at_trx_commit */
+ulong srv_flush_log_at_trx_commit;
+/** innodb_flush_log_at_timeout */
+uint srv_flush_log_at_timeout;
+/** innodb_page_size */
+ulong srv_page_size;
+/** log2 of innodb_page_size; @see innobase_init() */
+ulong srv_page_size_shift;
+/** innodb_log_write_ahead_size */
+ulong srv_log_write_ahead_size;
page_size_t univ_page_size(0, 0, false);
-/* Try to flush dirty pages so as to avoid IO bursts at
-the checkpoints. */
-char srv_adaptive_flushing = TRUE;
+/** innodb_adaptive_flushing; try to flush dirty pages so as to avoid
+IO bursts at the checkpoints. */
+my_bool srv_adaptive_flushing;
-/* Allow IO bursts at the checkpoints ignoring io_capacity setting. */
-my_bool srv_flush_sync = TRUE;
+/** innodb_flush_sync; whether to ignore io_capacity at log checkpoints */
+my_bool srv_flush_sync;
/** Maximum number of times allowed to conditionally acquire
mutex before switching to blocking wait on the mutex */
@@ -246,93 +251,100 @@ with mutex_enter(), which will wait until it gets the mutex. */
UNIV_INTERN os_event_t srv_allow_writes_event;
#endif /* WITH_INNODB_DISALLOW_WRITES */
-/** Requested size in bytes */
-ulint srv_buf_pool_size = ULINT_MAX;
+/** copy of innodb_buffer_pool_size */
+ulint srv_buf_pool_size;
const ulint srv_buf_pool_min_size = 5 * 1024 * 1024;
/** Default pool size in bytes */
const ulint srv_buf_pool_def_size = 128 * 1024 * 1024;
/** Requested buffer pool chunk size. Each buffer pool instance consists
of one or more chunks. */
ulong srv_buf_pool_chunk_unit;
-/** Requested number of buffer pool instances */
+/** innodb_buffer_pool_instances (0 is interpreted as 1) */
ulong srv_buf_pool_instances;
-/** Default number of buffer pool instances */
+/** Default value of innodb_buffer_pool_instances */
const ulong srv_buf_pool_instances_default = 0;
-/** Number of locks to protect buf_pool->page_hash */
+/** innodb_page_hash_locks (a debug-only parameter);
+number of locks to protect buf_pool->page_hash */
ulong srv_n_page_hash_locks = 16;
-/** Scan depth for LRU flush batch i.e.: number of blocks scanned*/
-ulong srv_LRU_scan_depth = 1024;
-/** Whether or not to flush neighbors of a block */
-ulong srv_flush_neighbors = 1;
+/** innodb_lru_scan_depth; number of blocks scanned in LRU flush batch */
+ulong srv_LRU_scan_depth;
+/** innodb_flush_neighbors; whether or not to flush neighbors of a block */
+ulong srv_flush_neighbors;
/** Previously requested size */
-ulint srv_buf_pool_old_size = 0;
+ulint srv_buf_pool_old_size;
/** Current size as scaling factor for the other components */
-ulint srv_buf_pool_base_size = 0;
+ulint srv_buf_pool_base_size;
/** Current size in bytes */
-ulint srv_buf_pool_curr_size = 0;
+ulint srv_buf_pool_curr_size;
/** Dump this % of each buffer pool during BP dump */
ulong srv_buf_pool_dump_pct;
/** Lock table size in bytes */
ulint srv_lock_table_size = ULINT_MAX;
-UNIV_INTERN ulong srv_idle_flush_pct = 100;
+/** innodb_idle_flush_pct */
+ulong srv_idle_flush_pct;
-/* This parameter is deprecated. Use srv_n_io_[read|write]_threads
-instead. */
-ulint srv_n_read_io_threads = ULINT_MAX;
-ulint srv_n_write_io_threads = ULINT_MAX;
+/** copy of innodb_read_io_threads */
+ulint srv_n_read_io_threads;
+/** copy of innodb_write_io_threads */
+ulint srv_n_write_io_threads;
-/* Switch to enable random read ahead. */
-my_bool srv_random_read_ahead = FALSE;
-/* User settable value of the number of pages that must be present
+/** innodb_random_read_ahead */
+my_bool srv_random_read_ahead;
+/** innodb_read_ahead_threshold; the number of pages that must be present
in the buffer cache and accessed sequentially for InnoDB to trigger a
readahead request. */
-ulong srv_read_ahead_threshold = 56;
+ulong srv_read_ahead_threshold;
-/** Maximum on-disk size of change buffer in terms of percentage
-of the buffer pool. */
-uint srv_change_buffer_max_size = CHANGE_BUFFER_DEFAULT_SIZE;
+/** innodb_change_buffer_max_size; maximum on-disk size of change
+buffer in terms of percentage of the buffer pool. */
+uint srv_change_buffer_max_size;
-char* srv_file_flush_method_str = NULL;
+char* srv_file_flush_method_str;
enum srv_flush_t srv_file_flush_method = IF_WIN(SRV_ALL_O_DIRECT_FSYNC,SRV_FSYNC);
-ulint srv_max_n_open_files = 300;
+/** copy of innodb_open_files, initialized by innobase_init() */
+ulint srv_max_n_open_files;
-/* Number of IO operations per second the server can do */
-ulong srv_io_capacity = 200;
-ulong srv_max_io_capacity = 400;
+/** innodb_io_capacity */
+ulong srv_io_capacity;
+/** innodb_io_capacity_max */
+ulong srv_max_io_capacity;
-/* The number of page cleaner threads to use.*/
-ulong srv_n_page_cleaners = 4;
+/** innodb_page_cleaners; the number of page cleaner threads */
+ulong srv_n_page_cleaners;
/* The InnoDB main thread tries to keep the ratio of modified pages
in the buffer pool to all database pages in the buffer pool smaller than
the following number. But it is not guaranteed that the value stays below
that during a time of heavy update/insert activity. */
-double srv_max_buf_pool_modified_pct = 75.0;
-double srv_max_dirty_pages_pct_lwm = 0.0;
+/** innodb_max_dirty_pages_pct */
+double srv_max_buf_pool_modified_pct;
+/** innodb_max_dirty_pages_pct_lwm */
+double srv_max_dirty_pages_pct_lwm;
-/* This is the percentage of log capacity at which adaptive flushing,
-if enabled, will kick in. */
-UNIV_INTERN double srv_adaptive_flushing_lwm = 10.0;
+/** innodb_adaptive_flushing_lwm; the percentage of log capacity at
+which adaptive flushing, if enabled, will kick in. */
+double srv_adaptive_flushing_lwm;
-/* Number of iterations over which adaptive flushing is averaged. */
-ulong srv_flushing_avg_loops = 30;
+/** innodb_flushing_avg_loops; number of iterations over which
+adaptive flushing is averaged */
+ulong srv_flushing_avg_loops;
-/* The number of purge threads to use.*/
-ulong srv_n_purge_threads = 4;
+/** innodb_purge_threads; the number of purge threads to use */
+ulong srv_n_purge_threads;
-/* the number of pages to purge in one batch */
-ulong srv_purge_batch_size = 20;
+/** innodb_purge_batch_size, in pages */
+ulong srv_purge_batch_size;
-/* Internal setting for "innodb_stats_method". Decides how InnoDB treats
+/** innodb_stats_method decides how InnoDB treats
NULL value when collecting statistics. By default, it is set to
SRV_STATS_NULLS_EQUAL(0), ie. all NULL value are treated equal */
-ulong srv_innodb_stats_method = SRV_STATS_NULLS_EQUAL;
+ulong srv_innodb_stats_method;
srv_stats_t srv_stats;
@@ -345,59 +357,67 @@ by SELECT or mysqldump. When this is nonzero, we do not allow any user
modifications to the data. */
ulong srv_force_recovery;
-/** Print all user-level transactions deadlocks to mysqld stderr */
+/** innodb_print_all_deadlocks; whether to print all user-level
+transactions deadlocks to the error log */
+my_bool srv_print_all_deadlocks;
-my_bool srv_print_all_deadlocks = FALSE;
+/** innodb_cmp_per_index_enabled; enable
+INFORMATION_SCHEMA.innodb_cmp_per_index */
+my_bool srv_cmp_per_index_enabled;
-/** Enable INFORMATION_SCHEMA.innodb_cmp_per_index */
-my_bool srv_cmp_per_index_enabled = FALSE;
-
-/* If the following is set to 1 then we do not run purge and insert buffer
+/** innodb_fast_shutdown; if 1 then we do not run purge and insert buffer
merge to completion before shutdown. If it is set to 2, do not even flush the
buffer pool to data files at the shutdown: we effectively 'crash'
InnoDB (but lose no committed transactions). */
uint srv_fast_shutdown;
-/* Generate a innodb_status.<pid> file */
-ibool srv_innodb_status = FALSE;
+/** copy of innodb_status_file; generate a innodb_status.<pid> file */
+ibool srv_innodb_status;
-/* Optimize prefix index queries to skip cluster index lookup when possible */
-/* Enables or disables this prefix optimization. Disabled by default. */
-UNIV_INTERN my_bool srv_prefix_index_cluster_optimization = 0;
+/** innodb_prefix_index_cluster_optimization; whether to optimize
+prefix index queries to skip cluster index lookup when possible */
+my_bool srv_prefix_index_cluster_optimization;
-/* When estimating number of different key values in an index, sample
+/** innodb_stats_transient_sample_pages;
+When estimating number of different key values in an index, sample
this many index pages, there are 2 ways to calculate statistics:
* persistent stats that are calculated by ANALYZE TABLE and saved
in the innodb database.
* quick transient stats, that are used if persistent stats for the given
table/index are not found in the innodb database */
-unsigned long long srv_stats_transient_sample_pages = 8;
-my_bool srv_stats_persistent = TRUE;
-unsigned long long srv_stats_persistent_sample_pages = 20;
-my_bool srv_stats_auto_recalc = TRUE;
-
-/* The number of rows modified before we calculate new statistics (default 0
-= current limits) */
-UNIV_INTERN unsigned long long srv_stats_modified_counter = 0;
-
-/* Enable traditional statistic calculation based on number of configured
-pages default true. */
-UNIV_INTERN my_bool srv_stats_sample_traditional = TRUE;
-
-ibool srv_use_doublewrite_buf = TRUE;
-
-/** doublewrite buffer is 1MB is size i.e.: it can hold 128 16K pages.
-The following parameter is the size of the buffer that is used for
-batch flushing i.e.: LRU flushing and flush_list flushing. The rest
-of the pages are used for single page flushing. */
-ulong srv_doublewrite_batch_size = 120;
-
-ulong srv_replication_delay = 0;
-
-/*-------------------------------------------*/
-UNIV_INTERN ulong srv_n_spin_wait_rounds = 15;
+unsigned long long srv_stats_transient_sample_pages;
+/** innodb_stats_persistent */
+my_bool srv_stats_persistent;
+/** innodb_stats_include_delete_marked */
+my_bool srv_stats_include_delete_marked;
+/** innodb_stats_persistent_sample_pages */
+unsigned long long srv_stats_persistent_sample_pages;
+/** innodb_stats_auto_recalc */
+my_bool srv_stats_auto_recalc;
+
+/** innodb_stats_modified_counter; The number of rows modified before
+we calculate new statistics (default 0 = current limits) */
+unsigned long long srv_stats_modified_counter;
+
+/** innodb_stats_traditional; enable traditional statistic calculation
+based on number of configured pages */
+my_bool srv_stats_sample_traditional;
+
+/** copy of innodb_doublewrite */
+ibool srv_use_doublewrite_buf;
+
+/** innodb_doublewrite_batch_size (a debug parameter) specifies the
+number of pages to use in LRU and flush_list batch flushing.
+The rest of the doublewrite buffer is used for single-page flushing. */
+ulong srv_doublewrite_batch_size = 120;
+
+/** innodb_replication_delay */
+ulong srv_replication_delay;
+
+/** innodb_sync_spin_loops */
+ulong srv_n_spin_wait_rounds;
+/** innodb_spin_wait_delay */
uint srv_spin_wait_delay;
-ibool srv_priority_boost = TRUE;
static ulint srv_n_rows_inserted_old;
static ulint srv_n_rows_updated_old;
@@ -424,23 +444,29 @@ UNIV_INTERN ib_uint64_t srv_index_page_decompressed;
/* Defragmentation */
UNIV_INTERN my_bool srv_defragment;
-UNIV_INTERN uint srv_defragment_n_pages = 7;
+/** innodb_defragment_n_pages */
+UNIV_INTERN uint srv_defragment_n_pages;
UNIV_INTERN uint srv_defragment_stats_accuracy;
-UNIV_INTERN uint srv_defragment_fill_factor_n_recs = 20;
-UNIV_INTERN double srv_defragment_fill_factor = 0.9;
-UNIV_INTERN uint srv_defragment_frequency =
- SRV_DEFRAGMENT_FREQUENCY_DEFAULT;
+/** innodb_defragment_fill_factor_n_recs */
+UNIV_INTERN uint srv_defragment_fill_factor_n_recs;
+/** innodb_defragment_fill_factor */
+UNIV_INTERN double srv_defragment_fill_factor;
+/** innodb_defragment_frequency */
+UNIV_INTERN uint srv_defragment_frequency;
+/** derived from innodb_defragment_frequency;
+@see innodb_defragment_frequency_update() */
UNIV_INTERN ulonglong srv_defragment_interval;
/* Set the following to 0 if you want InnoDB to write messages on
-stderr on startup/shutdown. */
-ibool srv_print_verbose_log = TRUE;
-my_bool srv_print_innodb_monitor = FALSE;
-my_bool srv_print_innodb_lock_monitor = FALSE;
-my_bool srv_print_innodb_tablespace_monitor = FALSE;
-my_bool srv_print_innodb_table_monitor = FALSE;
-/** If this flag is set tables without primary key are not allowed */
-my_bool srv_force_primary_key = FALSE;
+stderr on startup/shutdown. Not enabled on the embedded server. */
+ibool srv_print_verbose_log;
+my_bool srv_print_innodb_monitor;
+my_bool srv_print_innodb_lock_monitor;
+my_bool srv_print_innodb_tablespace_monitor;
+my_bool srv_print_innodb_table_monitor;
+/** innodb_force_primary_key; whether to disallow CREATE TABLE without
+PRIMARY KEY */
+my_bool srv_force_primary_key;
/* Array of English strings describing the current state of an
i/o handler thread */
@@ -473,19 +499,19 @@ ib_mutex_t srv_misc_tmpfile_mutex;
/** Temporary file for miscellanous diagnostic output */
FILE* srv_misc_tmpfile;
-static ulint srv_main_thread_process_no = 0;
-static ulint srv_main_thread_id = 0;
+static ulint srv_main_thread_process_no;
+static ulint srv_main_thread_id;
/* The following counts are used by the srv_master_thread. */
/** Iterations of the loop bounded by 'srv_active' label. */
-static ulint srv_main_active_loops = 0;
+static ulint srv_main_active_loops;
/** Iterations of the loop bounded by the 'srv_idle' label. */
-static ulint srv_main_idle_loops = 0;
+static ulint srv_main_idle_loops;
/** Iterations of the loop bounded by the 'srv_shutdown' label. */
-static ulint srv_main_shutdown_loops = 0;
+static ulint srv_main_shutdown_loops;
/** Log writes involving flush. */
-static ulint srv_log_writes_and_flush = 0;
+static ulint srv_log_writes_and_flush;
/* This is only ever touched by the master thread. It records the
time when the last flush of log file has happened. The master
@@ -506,10 +532,10 @@ current_time % 5 != 0. */
# define SRV_MASTER_DICT_LRU_INTERVAL (47)
/** Simulate compression failures. */
-UNIV_INTERN uint srv_simulate_comp_failures = 0;
+UNIV_INTERN uint srv_simulate_comp_failures;
/** Buffer pool dump status frequence in percentages */
-UNIV_INTERN ulong srv_buf_dump_status_frequency = 0;
+UNIV_INTERN ulong srv_buf_dump_status_frequency;
/** Acquire the system_mutex. */
#define srv_sys_mutex_enter() do { \
@@ -622,14 +648,16 @@ struct srv_sys_t{
ulint n_threads_active[SRV_MASTER + 1];
/*!< number of threads active
- in a thread class */
+ in a thread class; protected
+ by both my_atomic_addlint()
+ and mutex */
srv_stats_t::ulint_ctr_1_t
activity_count; /*!< For tracking server
activity */
};
-static srv_sys_t* srv_sys = NULL;
+static srv_sys_t* srv_sys;
/** Event to signal srv_monitor_thread. Not protected by a mutex.
Set after setting srv_print_innodb_monitor. */
@@ -709,13 +737,12 @@ srv_print_master_thread_info(
/*=========================*/
FILE *file) /* in: output stream */
{
- fprintf(file, "srv_master_thread loops: %lu srv_active,"
- " %lu srv_shutdown, %lu srv_idle\n",
+ fprintf(file, "srv_master_thread loops: " ULINTPF " srv_active, "
+ ULINTPF " srv_shutdown, " ULINTPF " srv_idle\n"
+ "srv_master_thread log flush and writes: " ULINTPF "\n",
srv_main_active_loops,
srv_main_shutdown_loops,
- srv_main_idle_loops);
- fprintf(file,
- "srv_master_thread log flush and writes: " ULINTPF "\n",
+ srv_main_idle_loops,
srv_log_writes_and_flush);
}
@@ -828,7 +855,7 @@ srv_reserve_slot(
ut_ad(srv_slot_get_type(slot) == type);
- ++srv_sys->n_threads_active[type];
+ my_atomic_addlint(&srv_sys->n_threads_active[type], 1);
srv_sys_mutex_exit();
@@ -869,16 +896,15 @@ srv_suspend_thread_low(
case SRV_WORKER:
ut_a(srv_n_purge_threads > 1);
- ut_a(srv_sys->n_threads_active[type] > 0);
break;
}
ut_a(!slot->suspended);
slot->suspended = TRUE;
- ut_a(srv_sys->n_threads_active[type] > 0);
-
- srv_sys->n_threads_active[type]--;
+ if (my_atomic_addlint(&srv_sys->n_threads_active[type], -1) < 0) {
+ ut_error;
+ }
return(os_event_reset(slot->event));
}
@@ -933,7 +959,7 @@ srv_resume_thread(srv_slot_t* slot, int64_t sig_count = 0, bool wait = true,
ut_ad(slot->suspended);
slot->suspended = FALSE;
- ++srv_sys->n_threads_active[slot->type];
+ my_atomic_addlint(&srv_sys->n_threads_active[slot->type], 1);
srv_sys_mutex_exit();
return(timeout);
}
@@ -1384,13 +1410,13 @@ srv_printf_innodb_monitor(
srv_conc_get_waiting_threads());
/* This is a dirty read, without holding trx_sys->mutex. */
- fprintf(file, "%lu read views open inside InnoDB\n",
+ fprintf(file, ULINTPF " read views open inside InnoDB\n",
trx_sys->mvcc->size());
n_reserved = fil_space_get_n_reserved_extents(0);
if (n_reserved > 0) {
fprintf(file,
- "%lu tablespace extents now reserved for"
+ ULINTPF " tablespace extents now reserved for"
" B-tree split operations\n",
n_reserved);
}
@@ -1482,10 +1508,10 @@ srv_export_innodb_status(void)
mutex_enter(&srv_innodb_monitor_mutex);
export_vars.innodb_data_pending_reads =
- os_n_pending_reads;
+ ulint(MONITOR_VALUE(MONITOR_OS_PENDING_READS));
export_vars.innodb_data_pending_writes =
- os_n_pending_writes;
+ ulint(MONITOR_VALUE(MONITOR_OS_PENDING_WRITES));
export_vars.innodb_data_pending_fsyncs =
fil_n_pending_log_flushes
@@ -1948,8 +1974,8 @@ loop:
"WSREP: avoiding InnoDB self crash due to long "
"semaphore wait of > %lu seconds\n"
"Server is processing SST donor operation, "
- "fatal_cnt now: %lu",
- (ulong) srv_fatal_semaphore_wait_threshold, fatal_cnt);
+ "fatal_cnt now: " ULINTPF,
+ srv_fatal_semaphore_wait_threshold, fatal_cnt);
}
#endif /* WITH_WSREP */
if (fatal_cnt > 10) {
@@ -2041,22 +2067,16 @@ srv_get_active_thread_type(void)
return(ret);
}
-/*******************************************************************//**
-Tells the InnoDB server that there has been activity in the database
-and wakes up the master thread if it is suspended (not sleeping). Used
-in the MySQL interface. Note that there is a small chance that the master
-thread stays suspended (we do not protect our operation with the
-srv_sys_t->mutex, for performance reasons). */
+/** Wake up the InnoDB master thread if it was suspended (not sleeping). */
void
srv_active_wake_master_thread_low()
-/*===============================*/
{
ut_ad(!srv_read_only_mode);
ut_ad(!srv_sys_mutex_own());
srv_inc_activity_count();
- if (srv_sys->n_threads_active[SRV_MASTER] == 0) {
+ if (my_atomic_loadlint(&srv_sys->n_threads_active[SRV_MASTER]) == 0) {
srv_slot_t* slot;
srv_sys_mutex_enter();
@@ -2074,35 +2094,25 @@ srv_active_wake_master_thread_low()
}
}
-/*******************************************************************//**
-Tells the purge thread that there has been activity in the database
-and wakes up the purge thread if it is suspended (not sleeping). Note
-that there is a small chance that the purge thread stays suspended
-(we do not protect our check with the srv_sys_t:mutex and the
-purge_sys->latch, for performance reasons). */
+/** Wake up the purge threads if there is work to do. */
void
-srv_wake_purge_thread_if_not_active(void)
-/*=====================================*/
+srv_wake_purge_thread_if_not_active()
{
ut_ad(!srv_sys_mutex_own());
if (purge_sys->state == PURGE_STATE_RUN
- && srv_sys->n_threads_active[SRV_PURGE] == 0) {
+ && !my_atomic_loadlint(&srv_sys->n_threads_active[SRV_PURGE])
+ && my_atomic_loadlint(&trx_sys->rseg_history_len)) {
srv_release_threads(SRV_PURGE, 1);
}
}
-/*******************************************************************//**
-Wakes up the master thread if it is suspended or being suspended. */
+/** Wake up the master thread if it is suspended or being suspended. */
void
-srv_wake_master_thread(void)
-/*========================*/
+srv_wake_master_thread()
{
- ut_ad(!srv_sys_mutex_own());
-
srv_inc_activity_count();
-
srv_release_threads(SRV_MASTER, 1);
}
@@ -2688,12 +2698,8 @@ DECLARE_THREAD(srv_worker_thread)(
slot = srv_reserve_slot(SRV_WORKER);
ut_a(srv_n_purge_threads > 1);
-
- srv_sys_mutex_enter();
-
- ut_a(srv_sys->n_threads_active[SRV_WORKER] < srv_n_purge_threads);
-
- srv_sys_mutex_exit();
+ ut_a(my_atomic_loadlint(&srv_sys->n_threads_active[SRV_WORKER])
+ < static_cast<lint>(srv_n_purge_threads));
/* We need to ensure that the worker threads exit after the
purge coordinator thread. Otherwise the purge coordinator can
@@ -2966,14 +2972,9 @@ DECLARE_THREAD(srv_purge_coordinator_thread)(
ut_a(srv_purge_should_exit(thd, n_total_purged));
- ulint n_pages_purged = ULINT_MAX;
-
- /* Ensure that all records are purged if it is not a fast shutdown.
- This covers the case where a record can be added after we exit the
- loop above. */
- while (srv_fast_shutdown == 0 && n_pages_purged > 0) {
- n_pages_purged = trx_purge(1, srv_purge_batch_size, false);
- }
+ /* Ensure that all records are purged on slow shutdown. */
+ while (srv_fast_shutdown == 0
+ && trx_purge(1, srv_purge_batch_size, false));
#ifdef UNIV_DEBUG
if (srv_fast_shutdown == 0) {
@@ -2987,12 +2988,10 @@ DECLARE_THREAD(srv_purge_coordinator_thread)(
delay in shutdown ,so reducing the batch size to magic number 20
(which was default in 5.5), which we hope will be sufficient to
remove all the undo records */
- const uint temp_batch_size = 20;
- n_pages_purged = trx_purge(1, srv_purge_batch_size <= temp_batch_size
- ? srv_purge_batch_size : temp_batch_size,
- true);
- ut_a(n_pages_purged == 0 || srv_fast_shutdown != 0);
+ if (trx_purge(1, std::min(srv_purge_batch_size, 20UL), true)) {
+ ut_a(srv_fast_shutdown);
+ }
/* The task queue should always be empty, independent of fast
shutdown state. */
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index bcb52fc5bfb..6d153ff1bc6 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -121,22 +121,22 @@ lsn_t srv_start_lsn;
lsn_t srv_shutdown_lsn;
/** TRUE if a raw partition is in use */
-ibool srv_start_raw_disk_in_use = FALSE;
+ibool srv_start_raw_disk_in_use;
/** Number of IO threads to use */
-ulint srv_n_file_io_threads = 0;
+ulint srv_n_file_io_threads;
/** TRUE if the server is being started, before rolling back any
incomplete transactions */
-bool srv_startup_is_before_trx_rollback_phase = false;
+bool srv_startup_is_before_trx_rollback_phase;
/** TRUE if the server is being started */
-bool srv_is_being_started = false;
+bool srv_is_being_started;
/** TRUE if SYS_TABLESPACES is available for lookups */
-bool srv_sys_tablespaces_open = false;
+bool srv_sys_tablespaces_open;
/** TRUE if the server was successfully started */
-ibool srv_was_started = FALSE;
+bool srv_was_started;
/** TRUE if innobase_start_or_create_for_mysql() has been called */
-static ibool srv_start_has_been_called = FALSE;
+static bool srv_start_has_been_called;
#ifdef UNIV_DEBUG
/** InnoDB system tablespace to set during recovery */
UNIV_INTERN uint srv_sys_space_size_debug;
@@ -743,7 +743,7 @@ srv_check_undo_redo_logs_exists()
ut_snprintf(
name, sizeof(name),
- "%s%cundo%03lu",
+ "%s%cundo%03zu",
srv_undo_dir, OS_PATH_SEPARATOR,
i);
@@ -836,7 +836,7 @@ srv_undo_tablespaces_init(bool create_new_db)
ut_snprintf(
name, sizeof(name),
- "%s%cundo%03lu",
+ "%s%cundo%03zu",
srv_undo_dir, OS_PATH_SEPARATOR, i + 1);
/* Undo space ids start from 1. */
@@ -872,7 +872,7 @@ srv_undo_tablespaces_init(bool create_new_db)
char name[OS_FILE_MAX_PATH];
ut_snprintf(name, sizeof(name),
- "%s%cundo%03lu",
+ "%s%cundo%03zu",
srv_undo_dir, OS_PATH_SEPARATOR,
undo_tablespace_ids[i]);
@@ -894,6 +894,7 @@ srv_undo_tablespaces_init(bool create_new_db)
}
}
} else {
+ srv_undo_tablespaces_active = srv_undo_tablespaces;
n_undo_tablespaces = srv_undo_tablespaces;
for (i = 1; i <= n_undo_tablespaces; ++i) {
@@ -913,7 +914,7 @@ srv_undo_tablespaces_init(bool create_new_db)
ut_snprintf(
name, sizeof(name),
- "%s%cundo%03lu",
+ "%s%cundo%03zu",
srv_undo_dir, OS_PATH_SEPARATOR,
undo_tablespace_ids[i]);
@@ -949,7 +950,7 @@ srv_undo_tablespaces_init(bool create_new_db)
ut_snprintf(
name, sizeof(name),
- "%s%cundo%03lu", srv_undo_dir, OS_PATH_SEPARATOR, i);
+ "%s%cundo%03zu", srv_undo_dir, OS_PATH_SEPARATOR, i);
/* Undo space ids start from 1. */
err = srv_undo_tablespace_open(name, i);
@@ -975,12 +976,10 @@ srv_undo_tablespaces_init(bool create_new_db)
return(err != DB_SUCCESS ? err : DB_ERROR);
- } else if (n_undo_tablespaces > 0) {
+ } else if (n_undo_tablespaces > 0) {
ib::info() << "Opened " << n_undo_tablespaces
- << " undo tablespaces ("
- << srv_undo_tablespaces_active
- << " active)";
+ << " undo tablespaces";
if (srv_undo_tablespaces == 0) {
ib::warn() << "innodb_undo_tablespaces=0 disables"
@@ -1443,6 +1442,10 @@ innobase_start_or_create_for_mysql(void)
size_t dirnamelen;
unsigned i = 0;
+ if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) {
+ srv_read_only_mode = true;
+ }
+
high_level_read_only = srv_read_only_mode
|| srv_force_recovery > SRV_FORCE_NO_TRX_UNDO;
@@ -1519,7 +1522,7 @@ innobase_start_or_create_for_mysql(void)
" once during the process lifetime.";
}
- srv_start_has_been_called = TRUE;
+ srv_start_has_been_called = true;
srv_is_being_started = true;
@@ -2756,9 +2759,9 @@ innodb_shutdown()
logs_empty_and_mark_files_at_shutdown();
- if (srv_conc_get_active_threads() != 0) {
+ if (ulint n_threads = srv_conc_get_active_threads()) {
ib::warn() << "Query counter shows "
- << srv_conc_get_active_threads() << " queries still"
+ << n_threads << " queries still"
" inside InnoDB at shutdown";
}
@@ -2889,8 +2892,8 @@ innodb_shutdown()
}
srv_start_state = SRV_START_STATE_NONE;
- srv_was_started = FALSE;
- srv_start_has_been_called = FALSE;
+ srv_was_started = false;
+ srv_start_has_been_called = false;
}
#if 0 // TODO: Enable this in WL#6608
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc
index 49a8d6db35a..75919043731 100644
--- a/storage/innobase/sync/sync0arr.cc
+++ b/storage/innobase/sync/sync0arr.cc
@@ -514,17 +514,17 @@ sync_array_cell_print(
if (mutex) {
fprintf(file,
- "Mutex at %p, %s, lock var %lu\n"
+ "Mutex at %p, %s, lock var %x\n"
#ifdef UNIV_DEBUG
- "Last time reserved in file %s line %lu"
+ "Last time reserved in file %s line %u"
#endif /* UNIV_DEBUG */
"\n",
(void*) mutex,
policy.to_string().c_str(),
- (ulong) mutex->state()
+ mutex->state()
#ifdef UNIV_DEBUG
,name,
- (ulong) policy.get_enter_line()
+ policy.get_enter_line()
#endif /* UNIV_DEBUG */
);
}
@@ -569,42 +569,47 @@ sync_array_cell_print(
if (rwlock) {
fprintf(file,
- " RW-latch at %p created in file %s line %lu\n",
+ " RW-latch at %p created in file %s line %u\n",
(void*) rwlock, innobase_basename(rwlock->cfile_name),
- (ulong) rwlock->cline);
+ rwlock->cline);
writer = rw_lock_get_writer(rwlock);
if (writer != RW_LOCK_NOT_LOCKED) {
fprintf(file,
- "a writer (thread id %lu) has"
+ "a writer (thread id " ULINTPF ") has"
" reserved it in mode %s",
- (ulong) os_thread_pf(rwlock->writer_thread),
+ os_thread_pf(rwlock->writer_thread),
writer == RW_LOCK_X ? " exclusive\n"
: writer == RW_LOCK_SX ? " SX\n"
: " wait exclusive\n");
}
fprintf(file,
- "number of readers %lu, waiters flag %lu,"
- " lock_word: %lx\n"
+ "number of readers " ULINTPF
+ ", waiters flag %u, "
+ "lock_word: " ULINTPFx "\n"
"Last time read locked in file %s line %u\n"
- "Last time write locked in file %s line %u\n",
- (ulint) rw_lock_get_reader_count(rwlock),
- (ulint) rwlock->waiters,
+ "Last time write locked in file %s line %u"
+#if 0 /* JAN: TODO: FIX LATER */
+ "\nHolder thread " ULINTPF
+ " file %s line " ULINTPF
+#endif
+ "\n",
+ rw_lock_get_reader_count(rwlock),
+ rwlock->waiters,
rwlock->lock_word,
innobase_basename(rwlock->last_s_file_name),
rwlock->last_s_line,
- rwlock->last_x_file_name,
- rwlock->last_x_line);
-
- /* JAN: TODO: FIX LATER
- fprintf(file,
- "Holder thread %lu file %s line %lu\n",
- rwlock->thread_id, rwlock->file_name,
- rwlock->line);
- */
+ innobase_basename(rwlock->last_x_file_name),
+ rwlock->last_x_line
+#if 0 /* JAN: TODO: FIX LATER */
+ , os_thread_pf(rwlock->thread_id),
+ innobase_basename(rwlock->file_name),
+ rwlock->line
+#endif
+ );
}
} else {
@@ -1093,9 +1098,10 @@ sync_array_print_long_waits(
now the values of pending calls of these. */
fprintf(stderr,
- "InnoDB: Pending preads %lu, pwrites %lu\n",
- (ulong) os_n_pending_reads,
- (ulong) os_n_pending_writes);
+ "InnoDB: Pending reads " UINT64PF
+ ", writes " UINT64PF "\n",
+ MONITOR_VALUE(MONITOR_OS_PENDING_READS),
+ MONITOR_VALUE(MONITOR_OS_PENDING_WRITES));
srv_print_innodb_monitor = TRUE;
diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc
index 135c84ad0d8..4fff24a77f1 100644
--- a/storage/innobase/sync/sync0debug.cc
+++ b/storage/innobase/sync/sync0debug.cc
@@ -130,7 +130,7 @@ struct LatchDebug {
os_thread_id_t,
Latches*,
os_thread_id_less,
- ut_allocator<std::pair<const std::string, latch_meta_t> > >
+ ut_allocator<std::pair<const os_thread_id_t, Latches*> > >
ThreadMap;
/** Constructor */
@@ -425,7 +425,7 @@ private:
latch_level_t,
std::string,
latch_level_less,
- ut_allocator<std::pair<latch_level_t, std::string> > >
+ ut_allocator<std::pair<const latch_level_t, std::string> > >
Levels;
/** Mutex protecting the deadlock detector data structures. */
@@ -1342,219 +1342,249 @@ sync_latch_meta_init()
/* The latches should be ordered on latch_id_t. So that we can
index directly into the vector to update and fetch meta-data. */
- LATCH_ADD(AUTOINC, SYNC_DICT_AUTOINC_MUTEX, autoinc_mutex_key);
+ LATCH_ADD_MUTEX(AUTOINC, SYNC_DICT_AUTOINC_MUTEX, autoinc_mutex_key);
#if defined PFS_SKIP_BUFFER_MUTEX_RWLOCK || defined PFS_GROUP_BUFFER_SYNC
- LATCH_ADD(BUF_BLOCK_MUTEX, SYNC_BUF_BLOCK, PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(BUF_BLOCK_MUTEX, SYNC_BUF_BLOCK, PFS_NOT_INSTRUMENTED);
#else
- LATCH_ADD(BUF_BLOCK_MUTEX, SYNC_BUF_BLOCK, buffer_block_mutex_key);
+ LATCH_ADD_MUTEX(BUF_BLOCK_MUTEX, SYNC_BUF_BLOCK,
+ buffer_block_mutex_key);
#endif /* PFS_SKIP_BUFFER_MUTEX_RWLOCK || PFS_GROUP_BUFFER_SYNC */
- LATCH_ADD(BUF_POOL, SYNC_BUF_POOL, buf_pool_mutex_key);
+ LATCH_ADD_MUTEX(BUF_POOL, SYNC_BUF_POOL, buf_pool_mutex_key);
- LATCH_ADD(BUF_POOL_ZIP, SYNC_BUF_BLOCK, buf_pool_zip_mutex_key);
+ LATCH_ADD_MUTEX(BUF_POOL_ZIP, SYNC_BUF_BLOCK, buf_pool_zip_mutex_key);
- LATCH_ADD(CACHE_LAST_READ, SYNC_TRX_I_S_LAST_READ,
- cache_last_read_mutex_key);
+ LATCH_ADD_MUTEX(CACHE_LAST_READ, SYNC_TRX_I_S_LAST_READ,
+ cache_last_read_mutex_key);
- LATCH_ADD(DICT_FOREIGN_ERR, SYNC_NO_ORDER_CHECK,
- dict_foreign_err_mutex_key);
+ LATCH_ADD_MUTEX(DICT_FOREIGN_ERR, SYNC_NO_ORDER_CHECK,
+ dict_foreign_err_mutex_key);
- LATCH_ADD(DICT_SYS, SYNC_DICT, dict_sys_mutex_key);
+ LATCH_ADD_MUTEX(DICT_SYS, SYNC_DICT, dict_sys_mutex_key);
- LATCH_ADD(FILE_FORMAT_MAX, SYNC_FILE_FORMAT_TAG,
- file_format_max_mutex_key);
+ LATCH_ADD_MUTEX(FILE_FORMAT_MAX, SYNC_FILE_FORMAT_TAG,
+ file_format_max_mutex_key);
- LATCH_ADD(FIL_SYSTEM, SYNC_ANY_LATCH, fil_system_mutex_key);
+ LATCH_ADD_MUTEX(FIL_SYSTEM, SYNC_ANY_LATCH, fil_system_mutex_key);
- LATCH_ADD(FLUSH_LIST, SYNC_BUF_FLUSH_LIST, flush_list_mutex_key);
+ LATCH_ADD_MUTEX(FLUSH_LIST, SYNC_BUF_FLUSH_LIST, flush_list_mutex_key);
- LATCH_ADD(FTS_BG_THREADS, SYNC_FTS_BG_THREADS,
- fts_bg_threads_mutex_key);
+ LATCH_ADD_MUTEX(FTS_BG_THREADS, SYNC_FTS_BG_THREADS,
+ fts_bg_threads_mutex_key);
- LATCH_ADD(FTS_DELETE, SYNC_FTS_OPTIMIZE, fts_delete_mutex_key);
+ LATCH_ADD_MUTEX(FTS_DELETE, SYNC_FTS_OPTIMIZE, fts_delete_mutex_key);
- LATCH_ADD(FTS_OPTIMIZE, SYNC_FTS_OPTIMIZE, fts_optimize_mutex_key);
+ LATCH_ADD_MUTEX(FTS_OPTIMIZE, SYNC_FTS_OPTIMIZE,
+ fts_optimize_mutex_key);
- LATCH_ADD(FTS_DOC_ID, SYNC_FTS_OPTIMIZE, fts_doc_id_mutex_key);
+ LATCH_ADD_MUTEX(FTS_DOC_ID, SYNC_FTS_OPTIMIZE, fts_doc_id_mutex_key);
- LATCH_ADD(FTS_PLL_TOKENIZE, SYNC_FTS_TOKENIZE,
- fts_pll_tokenize_mutex_key);
+ LATCH_ADD_MUTEX(FTS_PLL_TOKENIZE, SYNC_FTS_TOKENIZE,
+ fts_pll_tokenize_mutex_key);
- LATCH_ADD(HASH_TABLE_MUTEX, SYNC_BUF_PAGE_HASH, hash_table_mutex_key);
+ LATCH_ADD_MUTEX(HASH_TABLE_MUTEX, SYNC_BUF_PAGE_HASH,
+ hash_table_mutex_key);
- LATCH_ADD(IBUF_BITMAP, SYNC_IBUF_BITMAP_MUTEX, ibuf_bitmap_mutex_key);
+ LATCH_ADD_MUTEX(IBUF_BITMAP, SYNC_IBUF_BITMAP_MUTEX,
+ ibuf_bitmap_mutex_key);
- LATCH_ADD(IBUF, SYNC_IBUF_MUTEX, ibuf_mutex_key);
+ LATCH_ADD_MUTEX(IBUF, SYNC_IBUF_MUTEX, ibuf_mutex_key);
- LATCH_ADD(IBUF_PESSIMISTIC_INSERT, SYNC_IBUF_PESS_INSERT_MUTEX,
- ibuf_pessimistic_insert_mutex_key);
+ LATCH_ADD_MUTEX(IBUF_PESSIMISTIC_INSERT, SYNC_IBUF_PESS_INSERT_MUTEX,
+ ibuf_pessimistic_insert_mutex_key);
- LATCH_ADD(LOG_SYS, SYNC_LOG, log_sys_mutex_key);
+ LATCH_ADD_MUTEX(LOG_SYS, SYNC_LOG, log_sys_mutex_key);
- LATCH_ADD(LOG_WRITE, SYNC_LOG_WRITE, log_sys_write_mutex_key);
+ LATCH_ADD_MUTEX(LOG_WRITE, SYNC_LOG_WRITE, log_sys_write_mutex_key);
- LATCH_ADD(LOG_FLUSH_ORDER, SYNC_LOG_FLUSH_ORDER,
- log_flush_order_mutex_key);
+ LATCH_ADD_MUTEX(LOG_FLUSH_ORDER, SYNC_LOG_FLUSH_ORDER,
+ log_flush_order_mutex_key);
- LATCH_ADD(MUTEX_LIST, SYNC_NO_ORDER_CHECK, mutex_list_mutex_key);
+ LATCH_ADD_MUTEX(MUTEX_LIST, SYNC_NO_ORDER_CHECK, mutex_list_mutex_key);
- LATCH_ADD(PAGE_CLEANER, SYNC_PAGE_CLEANER, page_cleaner_mutex_key);
+ LATCH_ADD_MUTEX(PAGE_CLEANER, SYNC_PAGE_CLEANER,
+ page_cleaner_mutex_key);
- LATCH_ADD(PURGE_SYS_PQ, SYNC_PURGE_QUEUE, purge_sys_pq_mutex_key);
+ LATCH_ADD_MUTEX(PURGE_SYS_PQ, SYNC_PURGE_QUEUE,
+ purge_sys_pq_mutex_key);
- LATCH_ADD(RECALC_POOL, SYNC_STATS_AUTO_RECALC,
- recalc_pool_mutex_key);
+ LATCH_ADD_MUTEX(RECALC_POOL, SYNC_STATS_AUTO_RECALC,
+ recalc_pool_mutex_key);
- LATCH_ADD(RECV_SYS, SYNC_RECV, recv_sys_mutex_key);
+ LATCH_ADD_MUTEX(RECV_SYS, SYNC_RECV, recv_sys_mutex_key);
- LATCH_ADD(RECV_WRITER, SYNC_RECV_WRITER, recv_writer_mutex_key);
+ LATCH_ADD_MUTEX(RECV_WRITER, SYNC_RECV_WRITER, recv_writer_mutex_key);
- LATCH_ADD(REDO_RSEG, SYNC_REDO_RSEG, redo_rseg_mutex_key);
+ LATCH_ADD_MUTEX(REDO_RSEG, SYNC_REDO_RSEG, redo_rseg_mutex_key);
- LATCH_ADD(NOREDO_RSEG, SYNC_NOREDO_RSEG, noredo_rseg_mutex_key);
+ LATCH_ADD_MUTEX(NOREDO_RSEG, SYNC_NOREDO_RSEG, noredo_rseg_mutex_key);
#ifdef UNIV_DEBUG
/* Mutex names starting with '.' are not tracked. They are assumed
to be diagnostic mutexes used in debugging. */
latch_meta[LATCH_ID_RW_LOCK_DEBUG] =
- LATCH_ADD(RW_LOCK_DEBUG,
+ LATCH_ADD_MUTEX(RW_LOCK_DEBUG,
SYNC_NO_ORDER_CHECK,
rw_lock_debug_mutex_key);
#endif /* UNIV_DEBUG */
- LATCH_ADD(RTR_SSN_MUTEX, SYNC_ANY_LATCH, rtr_ssn_mutex_key);
+ LATCH_ADD_MUTEX(RTR_SSN_MUTEX, SYNC_ANY_LATCH, rtr_ssn_mutex_key);
- LATCH_ADD(RTR_ACTIVE_MUTEX, SYNC_ANY_LATCH, rtr_active_mutex_key);
+ LATCH_ADD_MUTEX(RTR_ACTIVE_MUTEX, SYNC_ANY_LATCH,
+ rtr_active_mutex_key);
- LATCH_ADD(RTR_MATCH_MUTEX, SYNC_ANY_LATCH, rtr_match_mutex_key);
+ LATCH_ADD_MUTEX(RTR_MATCH_MUTEX, SYNC_ANY_LATCH, rtr_match_mutex_key);
- LATCH_ADD(RTR_PATH_MUTEX, SYNC_ANY_LATCH, rtr_path_mutex_key);
+ LATCH_ADD_MUTEX(RTR_PATH_MUTEX, SYNC_ANY_LATCH, rtr_path_mutex_key);
- LATCH_ADD(RW_LOCK_LIST, SYNC_NO_ORDER_CHECK, rw_lock_list_mutex_key);
+ LATCH_ADD_MUTEX(RW_LOCK_LIST, SYNC_NO_ORDER_CHECK,
+ rw_lock_list_mutex_key);
- LATCH_ADD(RW_LOCK_MUTEX, SYNC_NO_ORDER_CHECK, rw_lock_mutex_key);
+ LATCH_ADD_MUTEX(RW_LOCK_MUTEX, SYNC_NO_ORDER_CHECK, rw_lock_mutex_key);
- LATCH_ADD(SRV_DICT_TMPFILE, SYNC_DICT_OPERATION,
- srv_dict_tmpfile_mutex_key);
+ LATCH_ADD_MUTEX(SRV_DICT_TMPFILE, SYNC_DICT_OPERATION,
+ srv_dict_tmpfile_mutex_key);
- LATCH_ADD(SRV_INNODB_MONITOR, SYNC_NO_ORDER_CHECK,
- srv_innodb_monitor_mutex_key);
+ LATCH_ADD_MUTEX(SRV_INNODB_MONITOR, SYNC_NO_ORDER_CHECK,
+ srv_innodb_monitor_mutex_key);
- LATCH_ADD(SRV_MISC_TMPFILE, SYNC_ANY_LATCH,
- srv_misc_tmpfile_mutex_key);
+ LATCH_ADD_MUTEX(SRV_MISC_TMPFILE, SYNC_ANY_LATCH,
+ srv_misc_tmpfile_mutex_key);
- LATCH_ADD(SRV_MONITOR_FILE, SYNC_NO_ORDER_CHECK,
- srv_monitor_file_mutex_key);
+ LATCH_ADD_MUTEX(SRV_MONITOR_FILE, SYNC_NO_ORDER_CHECK,
+ srv_monitor_file_mutex_key);
#ifdef UNIV_DEBUG
- LATCH_ADD(SYNC_THREAD, SYNC_NO_ORDER_CHECK, sync_thread_mutex_key);
+ LATCH_ADD_MUTEX(SYNC_THREAD, SYNC_NO_ORDER_CHECK,
+ sync_thread_mutex_key);
#endif /* UNIV_DEBUG */
- LATCH_ADD(BUF_DBLWR, SYNC_DOUBLEWRITE, buf_dblwr_mutex_key);
+ LATCH_ADD_MUTEX(BUF_DBLWR, SYNC_DOUBLEWRITE, buf_dblwr_mutex_key);
- LATCH_ADD(TRX_UNDO, SYNC_TRX_UNDO, trx_undo_mutex_key);
+ LATCH_ADD_MUTEX(TRX_UNDO, SYNC_TRX_UNDO, trx_undo_mutex_key);
- LATCH_ADD(TRX_POOL, SYNC_POOL, trx_pool_mutex_key);
+ LATCH_ADD_MUTEX(TRX_POOL, SYNC_POOL, trx_pool_mutex_key);
- LATCH_ADD(TRX_POOL_MANAGER, SYNC_POOL_MANAGER,
- trx_pool_manager_mutex_key);
+ LATCH_ADD_MUTEX(TRX_POOL_MANAGER, SYNC_POOL_MANAGER,
+ trx_pool_manager_mutex_key);
- LATCH_ADD(TRX, SYNC_TRX, trx_mutex_key);
+ LATCH_ADD_MUTEX(TRX, SYNC_TRX, trx_mutex_key);
- LATCH_ADD(LOCK_SYS, SYNC_LOCK_SYS, lock_mutex_key);
+ LATCH_ADD_MUTEX(LOCK_SYS, SYNC_LOCK_SYS, lock_mutex_key);
- LATCH_ADD(LOCK_SYS_WAIT, SYNC_LOCK_WAIT_SYS, lock_wait_mutex_key);
+ LATCH_ADD_MUTEX(LOCK_SYS_WAIT, SYNC_LOCK_WAIT_SYS,
+ lock_wait_mutex_key);
- LATCH_ADD(TRX_SYS, SYNC_TRX_SYS, trx_sys_mutex_key);
+ LATCH_ADD_MUTEX(TRX_SYS, SYNC_TRX_SYS, trx_sys_mutex_key);
- LATCH_ADD(SRV_SYS, SYNC_THREADS, srv_sys_mutex_key);
+ LATCH_ADD_MUTEX(SRV_SYS, SYNC_THREADS, srv_sys_mutex_key);
- LATCH_ADD(SRV_SYS_TASKS, SYNC_ANY_LATCH, srv_threads_mutex_key);
+ LATCH_ADD_MUTEX(SRV_SYS_TASKS, SYNC_ANY_LATCH, srv_threads_mutex_key);
- LATCH_ADD(PAGE_ZIP_STAT_PER_INDEX, SYNC_ANY_LATCH,
- page_zip_stat_per_index_mutex_key);
+ LATCH_ADD_MUTEX(PAGE_ZIP_STAT_PER_INDEX, SYNC_ANY_LATCH,
+ page_zip_stat_per_index_mutex_key);
#ifndef PFS_SKIP_EVENT_MUTEX
- LATCH_ADD(EVENT_MANAGER, SYNC_NO_ORDER_CHECK, event_manager_mutex_key);
+ LATCH_ADD_MUTEX(EVENT_MANAGER, SYNC_NO_ORDER_CHECK,
+ event_manager_mutex_key);
#else
- LATCH_ADD(EVENT_MANAGER, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(EVENT_MANAGER, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
#endif /* !PFS_SKIP_EVENT_MUTEX */
- LATCH_ADD(EVENT_MUTEX, SYNC_NO_ORDER_CHECK, event_mutex_key);
+ LATCH_ADD_MUTEX(EVENT_MUTEX, SYNC_NO_ORDER_CHECK, event_mutex_key);
- LATCH_ADD(SYNC_ARRAY_MUTEX, SYNC_NO_ORDER_CHECK,
- sync_array_mutex_key);
+ LATCH_ADD_MUTEX(SYNC_ARRAY_MUTEX, SYNC_NO_ORDER_CHECK,
+ sync_array_mutex_key);
- LATCH_ADD(THREAD_MUTEX, SYNC_NO_ORDER_CHECK, thread_mutex_key);
+ LATCH_ADD_MUTEX(THREAD_MUTEX, SYNC_NO_ORDER_CHECK, thread_mutex_key);
- LATCH_ADD(ZIP_PAD_MUTEX, SYNC_NO_ORDER_CHECK, zip_pad_mutex_key);
+ LATCH_ADD_MUTEX(ZIP_PAD_MUTEX, SYNC_NO_ORDER_CHECK, zip_pad_mutex_key);
- LATCH_ADD(OS_AIO_READ_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(OS_AIO_READ_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
- LATCH_ADD(OS_AIO_WRITE_MUTEX, SYNC_NO_ORDER_CHECK,
- PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(OS_AIO_WRITE_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
- LATCH_ADD(OS_AIO_LOG_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(OS_AIO_LOG_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
- LATCH_ADD(OS_AIO_IBUF_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(OS_AIO_IBUF_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
- LATCH_ADD(OS_AIO_SYNC_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(OS_AIO_SYNC_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
- LATCH_ADD(ROW_DROP_LIST, SYNC_NO_ORDER_CHECK, row_drop_list_mutex_key);
+ LATCH_ADD_MUTEX(ROW_DROP_LIST, SYNC_NO_ORDER_CHECK,
+ row_drop_list_mutex_key);
- LATCH_ADD(INDEX_ONLINE_LOG, SYNC_INDEX_ONLINE_LOG,
- index_online_log_key);
+ LATCH_ADD_MUTEX(INDEX_ONLINE_LOG, SYNC_INDEX_ONLINE_LOG,
+ index_online_log_key);
- LATCH_ADD(WORK_QUEUE, SYNC_WORK_QUEUE, PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(WORK_QUEUE, SYNC_WORK_QUEUE, PFS_NOT_INSTRUMENTED);
// Add the RW locks
- LATCH_ADD(BTR_SEARCH, SYNC_SEARCH_SYS, btr_search_latch_key);
+ LATCH_ADD_RWLOCK(BTR_SEARCH, SYNC_SEARCH_SYS, btr_search_latch_key);
- LATCH_ADD(BUF_BLOCK_LOCK, SYNC_LEVEL_VARYING, buf_block_lock_key);
+ LATCH_ADD_RWLOCK(BUF_BLOCK_LOCK, SYNC_LEVEL_VARYING,
+ buf_block_lock_key);
#ifdef UNIV_DEBUG
- LATCH_ADD(BUF_BLOCK_DEBUG, SYNC_NO_ORDER_CHECK,
- buf_block_debug_latch_key);
+ LATCH_ADD_RWLOCK(BUF_BLOCK_DEBUG, SYNC_NO_ORDER_CHECK,
+ buf_block_debug_latch_key);
#endif /* UNIV_DEBUG */
- LATCH_ADD(DICT_OPERATION, SYNC_DICT, dict_operation_lock_key);
+ LATCH_ADD_RWLOCK(DICT_OPERATION, SYNC_DICT, dict_operation_lock_key);
- LATCH_ADD(CHECKPOINT, SYNC_NO_ORDER_CHECK, checkpoint_lock_key);
+ LATCH_ADD_RWLOCK(CHECKPOINT, SYNC_NO_ORDER_CHECK, checkpoint_lock_key);
- LATCH_ADD(FIL_SPACE, SYNC_FSP, fil_space_latch_key);
+ LATCH_ADD_RWLOCK(FIL_SPACE, SYNC_FSP, fil_space_latch_key);
- LATCH_ADD(FTS_CACHE, SYNC_FTS_CACHE, fts_cache_rw_lock_key);
+ LATCH_ADD_RWLOCK(FTS_CACHE, SYNC_FTS_CACHE, fts_cache_rw_lock_key);
- LATCH_ADD(FTS_CACHE_INIT, SYNC_FTS_CACHE_INIT,
- fts_cache_init_rw_lock_key);
+ LATCH_ADD_RWLOCK(FTS_CACHE_INIT, SYNC_FTS_CACHE_INIT,
+ fts_cache_init_rw_lock_key);
- LATCH_ADD(TRX_I_S_CACHE, SYNC_TRX_I_S_RWLOCK, trx_i_s_cache_lock_key);
+ LATCH_ADD_RWLOCK(TRX_I_S_CACHE, SYNC_TRX_I_S_RWLOCK,
+ trx_i_s_cache_lock_key);
- LATCH_ADD(TRX_PURGE, SYNC_PURGE_LATCH, trx_purge_latch_key);
+ LATCH_ADD_RWLOCK(TRX_PURGE, SYNC_PURGE_LATCH, trx_purge_latch_key);
- LATCH_ADD(IBUF_INDEX_TREE, SYNC_IBUF_INDEX_TREE,
- index_tree_rw_lock_key);
+ LATCH_ADD_RWLOCK(IBUF_INDEX_TREE, SYNC_IBUF_INDEX_TREE,
+ index_tree_rw_lock_key);
- LATCH_ADD(INDEX_TREE, SYNC_INDEX_TREE, index_tree_rw_lock_key);
+ LATCH_ADD_RWLOCK(INDEX_TREE, SYNC_INDEX_TREE, index_tree_rw_lock_key);
- LATCH_ADD(DICT_TABLE_STATS, SYNC_INDEX_TREE, dict_table_stats_key);
+ LATCH_ADD_RWLOCK(DICT_TABLE_STATS, SYNC_INDEX_TREE,
+ dict_table_stats_key);
- LATCH_ADD(HASH_TABLE_RW_LOCK, SYNC_BUF_PAGE_HASH,
+ LATCH_ADD_RWLOCK(HASH_TABLE_RW_LOCK, SYNC_BUF_PAGE_HASH,
hash_table_locks_key);
- LATCH_ADD(SYNC_DEBUG_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(SYNC_DEBUG_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
/* JAN: TODO: Add PFS instrumentation */
- LATCH_ADD(SCRUB_STAT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
- LATCH_ADD(DEFRAGMENT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
- LATCH_ADD(BTR_DEFRAGMENT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
- LATCH_ADD(MTFLUSH_THREAD_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
- LATCH_ADD(MTFLUSH_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
- LATCH_ADD(FIL_CRYPT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
- LATCH_ADD(FIL_CRYPT_STAT_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
- LATCH_ADD(FIL_CRYPT_DATA_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
- LATCH_ADD(FIL_CRYPT_THREADS_MUTEX, SYNC_NO_ORDER_CHECK, PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(SCRUB_STAT_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(DEFRAGMENT_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(BTR_DEFRAGMENT_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(MTFLUSH_THREAD_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(MTFLUSH_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(FIL_CRYPT_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(FIL_CRYPT_STAT_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(FIL_CRYPT_DATA_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
+ LATCH_ADD_MUTEX(FIL_CRYPT_THREADS_MUTEX, SYNC_NO_ORDER_CHECK,
+ PFS_NOT_INSTRUMENTED);
latch_id_t id = LATCH_ID_NONE;
@@ -1717,7 +1747,7 @@ private:
const void*,
File,
std::less<const void*>,
- ut_allocator<std::pair<const void*, File> > >
+ ut_allocator<std::pair<const void* const, File> > >
Files;
typedef OSMutex Mutex;
diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc
index 9c5ae4d02da..fcc50b8c76d 100644
--- a/storage/innobase/trx/trx0i_s.cc
+++ b/storage/innobase/trx/trx0i_s.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1612,7 +1613,8 @@ trx_i_s_create_lock_id(
if (row->lock_space != ULINT_UNDEFINED) {
/* record lock */
res_len = ut_snprintf(lock_id, lock_id_size,
- TRX_ID_FMT ":%lu:%lu:%lu",
+ TRX_ID_FMT
+ ":" ULINTPF ":" ULINTPF ":" ULINTPF,
row->lock_trx_id, row->lock_space,
row->lock_page, row->lock_rec);
} else {
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index f83d9377852..b21ec75c3a6 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -291,7 +291,6 @@ trx_purge_add_update_undo_to_history(
undo_header + TRX_UNDO_HISTORY_NODE, mtr);
my_atomic_addlint(&trx_sys->rseg_history_len, 1);
- srv_wake_purge_thread_if_not_active();
/* Write the trx number to the undo log header */
mlog_write_ull(undo_header + TRX_UNDO_TRX_NO, trx->no, mtr);
@@ -987,27 +986,20 @@ trx_purge_initiate_truncate(
initiate truncate.
d. Execute actual truncate
e. Remove the DDL log. */
- DBUG_EXECUTE_IF("ib_undo_trunc_before_checkpoint",
- ib::info() << "ib_undo_trunc_before_checkpoint";
- DBUG_SUICIDE(););
/* After truncate if server crashes then redo logging done for this
undo tablespace might not stand valid as tablespace has been
truncated. */
log_make_checkpoint_at(LSN_MAX, TRUE);
- ib::info() << "Truncating UNDO tablespace with space identifier "
- << undo_trunc->get_marked_space_id();
+ const ulint space_id = undo_trunc->get_marked_space_id();
- DBUG_EXECUTE_IF("ib_undo_trunc_before_ddl_log_start",
- ib::info() << "ib_undo_trunc_before_ddl_log_start";
- DBUG_SUICIDE(););
+ ib::info() << "Truncating UNDO tablespace " << space_id;
#ifdef UNIV_DEBUG
dberr_t err =
#endif /* UNIV_DEBUG */
- undo_trunc->start_logging(
- undo_trunc->get_marked_space_id());
+ undo_trunc->start_logging(space_id);
ut_ad(err == DB_SUCCESS);
DBUG_EXECUTE_IF("ib_undo_trunc_before_truncate",
@@ -1016,14 +1008,12 @@ trx_purge_initiate_truncate(
trx_purge_cleanse_purge_queue(undo_trunc);
- bool success = trx_undo_truncate_tablespace(undo_trunc);
- if (!success) {
+ if (!trx_undo_truncate_tablespace(undo_trunc)) {
/* Note: In case of error we don't enable the rsegs
and neither unmark the tablespace so the tablespace
continue to remain inactive. */
- ib::error() << "Failed to truncate UNDO tablespace with"
- " space identifier "
- << undo_trunc->get_marked_space_id();
+ ib::error() << "Failed to truncate UNDO tablespace "
+ << space_id;
return;
}
@@ -1046,7 +1036,7 @@ trx_purge_initiate_truncate(
log_make_checkpoint_at(LSN_MAX, TRUE);
- undo_trunc->done_logging(undo_trunc->get_marked_space_id());
+ undo_trunc->done_logging(space_id);
/* Completed truncate. Now it is safe to re-use the tablespace. */
for (ulint i = 0; i < undo_trunc->rsegs_size(); ++i) {
@@ -1054,8 +1044,7 @@ trx_purge_initiate_truncate(
rseg->skip_allocation = false;
}
- ib::info() << "Completed truncate of UNDO tablespace with space"
- " identifier " << undo_trunc->get_marked_space_id();
+ ib::info() << "Truncated UNDO tablespace " << space_id;
undo_trunc->reset();
undo::Truncate::clear_trunc_list();
@@ -1075,7 +1064,7 @@ trx_purge_truncate_history(
purge_iter_t* limit, /*!< in: truncate limit */
const ReadView* view) /*!< in: purge view */
{
- ulint i;
+ ut_ad(trx_purge_check_limit());
/* We play safe and set the truncate limit at most to the purge view
low_limit number, though this is not necessary */
@@ -1088,7 +1077,7 @@ trx_purge_truncate_history(
ut_ad(limit->trx_no <= purge_sys->view.low_limit_no());
- for (i = 0; i < TRX_SYS_N_RSEGS; ++i) {
+ for (ulint i = 0; i < TRX_SYS_N_RSEGS; ++i) {
trx_rseg_t* rseg = trx_sys->rseg_array[i];
if (rseg != NULL) {
@@ -1100,8 +1089,7 @@ trx_purge_truncate_history(
/* UNDO tablespace truncate. We will try to truncate as much as we
can (greedy approach). This will ensure when the server is idle we
try and truncate all the UNDO tablespaces. */
- ulint nchances = srv_undo_tablespaces_active;
- for (i = 0; i < nchances; i++) {
+ for (ulint i = srv_undo_tablespaces_active; i--; ) {
trx_purge_mark_undo_for_truncate(&purge_sys->undo_trunc);
trx_purge_initiate_truncate(limit, &purge_sys->undo_trunc);
}
@@ -1638,22 +1626,6 @@ trx_purge_wait_for_workers_to_complete(
ut_a(srv_get_task_queue_length() == 0);
}
-/******************************************************************//**
-Remove old historical changes from the rollback segments. */
-static
-void
-trx_purge_truncate(void)
-/*====================*/
-{
- ut_ad(trx_purge_check_limit());
-
- if (purge_sys->limit.trx_no == 0) {
- trx_purge_truncate_history(&purge_sys->iter, &purge_sys->view);
- } else {
- trx_purge_truncate_history(&purge_sys->limit, &purge_sys->view);
- }
-}
-
/*******************************************************************//**
This function runs a purge batch.
@return number of undo log pages handled in the batch */
@@ -1742,7 +1714,11 @@ run_synchronously:
#endif /* UNIV_DEBUG */
if (truncate) {
- trx_purge_truncate();
+ trx_purge_truncate_history(
+ purge_sys->limit.trx_no
+ ? &purge_sys->limit
+ : &purge_sys->iter,
+ &purge_sys->view);
}
MONITOR_INC_VALUE(MONITOR_PURGE_INVOKED, 1);
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index ec723375fe9..69f01e64b59 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -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) 2016, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -868,6 +868,8 @@ 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
@@ -878,6 +880,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. */
diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc
index 3393a0464a8..663566cf26f 100644
--- a/storage/innobase/trx/trx0rseg.cc
+++ b/storage/innobase/trx/trx0rseg.cc
@@ -204,7 +204,7 @@ trx_rseg_mem_restore(trx_rseg_t* rseg, mtr_t* mtr)
len = flst_get_len(rseg_header + TRX_RSEG_HISTORY);
if (len > 0) {
- trx_sys->rseg_history_len += len;
+ my_atomic_addlint(&trx_sys->rseg_history_len, len);
node_addr = trx_purge_get_log_from_hist(
flst_get_last(rseg_header + TRX_RSEG_HISTORY, mtr));
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index 24983dcc2a3..47f30138ceb 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -258,8 +258,8 @@ trx_sys_print_mysql_binlog_offset(void)
+ TRX_SYS_MYSQL_LOG_OFFSET_LOW);
fprintf(stderr,
- "InnoDB: Last MySQL binlog file position %lu %lu,"
- " file name %s\n",
+ "InnoDB: Last MySQL binlog file position " ULINTPF " " ULINTPF
+ ", file name %s\n",
trx_sys_mysql_bin_log_pos_high, trx_sys_mysql_bin_log_pos_low,
sys_header + TRX_SYS_MYSQL_LOG_INFO
+ TRX_SYS_MYSQL_LOG_NAME);
@@ -446,7 +446,6 @@ trx_sysf_create(
page_t* page;
ulint page_no;
byte* ptr;
- ulint len;
ut_ad(mtr);
@@ -481,13 +480,12 @@ trx_sysf_create(
mach_write_to_8(sys_header + TRX_SYS_TRX_ID_STORE, 1);
/* Reset the rollback segment slots. Old versions of InnoDB
- define TRX_SYS_N_RSEGS as 256 (TRX_SYS_OLD_N_RSEGS) and expect
+ (before MySQL 5.5) define TRX_SYS_N_RSEGS as 256 and expect
that the whole array is initialized. */
ptr = TRX_SYS_RSEGS + sys_header;
- len = ut_max(TRX_SYS_OLD_N_RSEGS, TRX_SYS_N_RSEGS)
- * TRX_SYS_RSEG_SLOT_SIZE;
- memset(ptr, 0xff, len);
- ptr += len;
+ compile_time_assert(256 >= TRX_SYS_N_RSEGS);
+ memset(ptr, 0xff, 256 * TRX_SYS_RSEG_SLOT_SIZE);
+ ptr += 256 * TRX_SYS_RSEG_SLOT_SIZE;
ut_a(ptr <= page + (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END));
/* Initialize all of the page. This part used to be uninitialized. */
@@ -881,7 +879,7 @@ trx_sys_create_rsegs()
srv_undo_logs determines how many of the
srv_available_undo_logs rollback segments may be used for
logging new transactions. */
- ut_ad(srv_undo_tablespaces < TRX_SYS_N_RSEGS);
+ ut_ad(srv_undo_tablespaces <= TRX_SYS_MAX_UNDO_SPACES);
ut_ad(srv_undo_logs <= TRX_SYS_N_RSEGS);
if (srv_read_only_mode) {
@@ -923,13 +921,28 @@ trx_sys_create_rsegs()
" requested innodb_undo_logs";
return(false);
}
+
+ /* Increase the number of active undo
+ tablespace in case new rollback segment
+ assigned to new undo tablespace. */
+ if (space > srv_undo_tablespaces_active) {
+ srv_undo_tablespaces_active++;
+
+ ut_ad(srv_undo_tablespaces_active == space);
+ }
}
}
ut_ad(srv_undo_logs <= srv_available_undo_logs);
- ib::info() << srv_undo_logs << " out of " << srv_available_undo_logs
- << " rollback segments are active.";
+ ib::info info;
+ info << srv_undo_logs << " out of " << srv_available_undo_logs;
+ if (srv_undo_tablespaces_active) {
+ info << " rollback segments in " << srv_undo_tablespaces_active
+ << " undo tablespaces are active.";
+ } else {
+ info << " rollback segments are active.";
+ }
return(true);
}
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 36324c43970..a6cfcf0910b 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1908,6 +1908,7 @@ trx_commit_in_memory(
trx_mutex_exit(trx);
ut_a(trx->error_state == DB_SUCCESS);
+ srv_wake_purge_thread_if_not_active();
}
/****************************************************************//**
@@ -2455,6 +2456,121 @@ trx_print_latched(
mem_heap_get_size(trx->lock.lock_heap));
}
+#ifdef WITH_WSREP
+/**********************************************************************//**
+Prints info about a transaction.
+Transaction information may be retrieved without having trx_sys->mutex acquired
+so it may not be completely accurate. The caller must own lock_sys->mutex
+and the trx must have some locks to make sure that it does not escape
+without locking lock_sys->mutex. */
+UNIV_INTERN
+void
+wsrep_trx_print_locking(
+ FILE* f,
+ /*!< in: output stream */
+ const trx_t* trx,
+ /*!< in: transaction */
+ ulint max_query_len)
+ /*!< in: max query length to print,
+ or 0 to use the default max length */
+{
+ ibool newline;
+ const char* op_info;
+
+ ut_ad(lock_mutex_own());
+ ut_ad(trx->lock.trx_locks.count > 0);
+
+ fprintf(f, "TRANSACTION " TRX_ID_FMT, trx->id);
+
+ /* trx->state may change since trx_sys->mutex is not required */
+ switch (trx->state) {
+ case TRX_STATE_NOT_STARTED:
+ fputs(", not started", f);
+ goto state_ok;
+ case TRX_STATE_ACTIVE:
+ fprintf(f, ", ACTIVE %lu sec",
+ (ulong) difftime(time(NULL), trx->start_time));
+ goto state_ok;
+ case TRX_STATE_FORCED_ROLLBACK:
+ fprintf(f, ", FORCED ROLLBACK, %lu sec",
+ (ulong) difftime(time(NULL), trx->start_time));
+ goto state_ok;
+ case TRX_STATE_PREPARED:
+ fprintf(f, ", ACTIVE (PREPARED) %lu sec",
+ (ulong) difftime(time(NULL), trx->start_time));
+ goto state_ok;
+ case TRX_STATE_COMMITTED_IN_MEMORY:
+ fputs(", COMMITTED IN MEMORY", f);
+ goto state_ok;
+ }
+ fprintf(f, ", state %lu", (ulong) trx->state);
+ ut_ad(0);
+state_ok:
+
+ /* prevent a race condition */
+ op_info = trx->op_info;
+
+ if (*op_info) {
+ putc(' ', f);
+ fputs(op_info, f);
+ }
+
+ if (trx->is_recovered) {
+ fputs(" recovered trx", f);
+ }
+
+ if (trx->declared_to_be_inside_innodb) {
+ fprintf(f, ", thread declared inside InnoDB %lu",
+ (ulong) trx->n_tickets_to_enter_innodb);
+ }
+
+ putc('\n', f);
+
+ if (trx->n_mysql_tables_in_use > 0 || trx->mysql_n_tables_locked > 0) {
+ fprintf(f, "mysql tables in use %lu, locked %lu\n",
+ (ulong) trx->n_mysql_tables_in_use,
+ (ulong) trx->mysql_n_tables_locked);
+ }
+
+ newline = TRUE;
+
+ /* trx->lock.que_state of an ACTIVE transaction may change
+ while we are not holding trx->mutex. We perform a dirty read
+ for performance reasons. */
+
+ switch (trx->lock.que_state) {
+ case TRX_QUE_RUNNING:
+ newline = FALSE; break;
+ case TRX_QUE_LOCK_WAIT:
+ fputs("LOCK WAIT ", f); break;
+ case TRX_QUE_ROLLING_BACK:
+ fputs("ROLLING BACK ", f); break;
+ case TRX_QUE_COMMITTING:
+ fputs("COMMITTING ", f); break;
+ default:
+ fprintf(f, "que state %lu ", (ulong) trx->lock.que_state);
+ }
+
+ if (trx->has_search_latch) {
+ newline = TRUE;
+ fputs(", holds adaptive hash latch", f);
+ }
+
+ if (trx->undo_no != 0) {
+ newline = TRUE;
+ fprintf(f, ", undo log entries " TRX_ID_FMT, trx->undo_no);
+ }
+
+ if (newline) {
+ putc('\n', f);
+ }
+
+ if (trx->mysql_thd != NULL) {
+ innobase_mysql_print_thd(
+ f, trx->mysql_thd, static_cast<uint>(max_query_len));
+ }
+}
+#endif /* WITH_WSREP */
/**********************************************************************//**
Prints info about a transaction.
Acquires and releases lock_sys->mutex and trx_sys->mutex. */
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index c352323eca9..2cae865cff2 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -214,14 +215,14 @@ ut_print_timestamp(
GetLocalTime(&cal_tm);
- fprintf(file, "%d-%02d-%02d %02d:%02d:%02d %#llx",
+ fprintf(file, "%d-%02d-%02d %02d:%02d:%02d %#zx",
(int) cal_tm.wYear,
(int) cal_tm.wMonth,
(int) cal_tm.wDay,
(int) cal_tm.wHour,
(int) cal_tm.wMinute,
(int) cal_tm.wSecond,
- static_cast<ulonglong>(thread_id));
+ thread_id);
#else
struct tm* cal_tm_ptr;
time_t tm;
@@ -230,7 +231,7 @@ ut_print_timestamp(
time(&tm);
localtime_r(&tm, &cal_tm);
cal_tm_ptr = &cal_tm;
- fprintf(file, "%d-%02d-%02d %02d:%02d:%02d %#lx",
+ fprintf(file, "%d-%02d-%02d %02d:%02d:%02d %#zx",
cal_tm_ptr->tm_year + 1900,
cal_tm_ptr->tm_mon + 1,
cal_tm_ptr->tm_mday,
@@ -323,7 +324,7 @@ ut_print_buf(
fprintf(file, " len " ULINTPF "; hex ", len);
for (data = (const byte*) buf, i = 0; i < len; i++) {
- fprintf(file, "%02lx", static_cast<ulong>(*data++));
+ fprintf(file, "%02x", *data++);
}
fputs("; asc ", file);
diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt
index 3223e084709..d72b4e54e43 100644
--- a/storage/rocksdb/CMakeLists.txt
+++ b/storage/rocksdb/CMakeLists.txt
@@ -22,6 +22,13 @@ IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i[36]86")
SKIP_ROCKSDB_PLUGIN("Intel 32 bit not supported.")
ENDIF()
+# Due to retrieved data being incorrect endian
+include(TestBigEndian)
+test_big_endian(BIG_ENDIAN)
+if(BIG_ENDIAN)
+ SKIP_ROCKSDB_PLUGIN("Big Endian not supported.")
+endif()
+
#
# Also, disable building on 32-bit Windows
#
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index a87abfb8073..7ed8661cc74 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -2109,6 +2109,7 @@ int ha_spider::index_read_map_internal(
result_list.desc_flg = FALSE;
result_list.sorted = TRUE;
result_list.key_info = &table->key_info[active_index];
+ check_distinct_key_query();
result_list.limit_num =
result_list.internal_limit >= result_list.split_read ?
result_list.split_read : result_list.internal_limit;
@@ -2624,6 +2625,7 @@ int ha_spider::index_read_last_map_internal(
result_list.desc_flg = TRUE;
result_list.sorted = TRUE;
result_list.key_info = &table->key_info[active_index];
+ check_distinct_key_query();
result_list.limit_num =
result_list.internal_limit >= result_list.split_read ?
result_list.split_read : result_list.internal_limit;
@@ -3089,6 +3091,7 @@ int ha_spider::index_first_internal(
result_list.sorted = TRUE;
result_list.key_info = &table->key_info[active_index];
result_list.key_order = 0;
+ check_distinct_key_query();
result_list.limit_num =
result_list.internal_limit >= result_list.split_read ?
result_list.split_read : result_list.internal_limit;
@@ -3472,6 +3475,7 @@ int ha_spider::index_last_internal(
result_list.sorted = TRUE;
result_list.key_info = &table->key_info[active_index];
result_list.key_order = 0;
+ check_distinct_key_query();
result_list.limit_num =
result_list.internal_limit >= result_list.split_read ?
result_list.split_read : result_list.internal_limit;
@@ -3914,6 +3918,7 @@ int ha_spider::read_range_first_internal(
result_list.desc_flg = FALSE;
result_list.sorted = sorted;
result_list.key_info = &table->key_info[active_index];
+ check_distinct_key_query();
result_list.limit_num =
result_list.internal_limit >= result_list.split_read ?
result_list.split_read : result_list.internal_limit;
@@ -12078,6 +12083,81 @@ void ha_spider::check_direct_order_limit()
DBUG_VOID_RETURN;
}
+/********************************************************************
+ * Check whether the current query is a SELECT DISTINCT using an
+ * index in a non-partitioned Spider configuration, with a
+ * projection list that consists solely of the first key prefix
+ * column.
+ *
+ * For a SELECT DISTINCT query using an index in a non-partitioned
+ * Spider configuration, with a projection list that consists
+ * solely of the first key prefix, set the internal row retrieval
+ * limit to avoid visiting each row multiple times.
+ ********************************************************************/
+void ha_spider::check_distinct_key_query()
+{
+ DBUG_ENTER( "ha_spider::check_distinct_key_query" );
+
+ if ( result_list.direct_distinct && !partition_handler_share->handlers &&
+ result_list.keyread && result_list.check_direct_order_limit )
+ {
+ // SELECT DISTINCT query using an index in a non-partitioned configuration
+ KEY_PART_INFO* key_part = result_list.key_info->key_part;
+ Field* key_field = key_part->field;
+
+ if ( is_sole_projection_field( key_field->field_index ) )
+ {
+ // Projection list consists solely of the first key prefix column
+
+ // Set the internal row retrieval limit to avoid visiting each row
+ // multiple times. This fixes a Spider performance bug that
+ // caused each row to be visited multiple times.
+ result_list.internal_limit = 1;
+ }
+ }
+
+ DBUG_VOID_RETURN;
+}
+
+/********************************************************************
+ * Determine whether the current query's projection list
+ * consists solely of the specified column.
+ *
+ * Params IN - field_index:
+ * Field index of the column of interest within
+ * its table.
+ *
+ * Returns TRUE - if the query's projection list consists
+ * solely of the specified column.
+ * FALSE - otherwise.
+ ********************************************************************/
+bool ha_spider::is_sole_projection_field( uint16 field_index )
+{
+ // NOTE: It is assumed that spider_db_append_select_columns() has already been called
+ // to build the bitmap of projection fields
+ bool is_ha_sole_projection_field;
+ uint loop_index, dbton_id;
+ spider_db_handler* dbton_hdl;
+ DBUG_ENTER( "ha_spider::is_sole_projection_field" );
+
+ for ( loop_index = 0; loop_index < share->use_sql_dbton_count; loop_index++ )
+ {
+ dbton_id = share->use_sql_dbton_ids[ loop_index ];
+ dbton_hdl = dbton_handler[ dbton_id ];
+
+ if ( dbton_hdl->first_link_idx >= 0 )
+ {
+ is_ha_sole_projection_field = dbton_hdl->is_sole_projection_field( field_index );
+ if ( !is_ha_sole_projection_field )
+ {
+ DBUG_RETURN( FALSE );
+ }
+ }
+ }
+
+ DBUG_RETURN( TRUE );
+}
+
int ha_spider::check_ha_range_eof()
{
DBUG_ENTER("ha_spider::check_ha_range_eof");
diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h
index bd02e34043d..87c6afaa89f 100644
--- a/storage/spider/ha_spider.h
+++ b/storage/spider/ha_spider.h
@@ -751,6 +751,8 @@ public:
);
uint check_partitioned();
void check_direct_order_limit();
+ void check_distinct_key_query();
+ bool is_sole_projection_field( uint16 field_index );
int check_ha_range_eof();
int drop_tmp_tables();
bool handler_opened(
diff --git a/storage/spider/spd_db_handlersocket.cc b/storage/spider/spd_db_handlersocket.cc
index 8f031acdbde..51b1d1f1752 100644
--- a/storage/spider/spd_db_handlersocket.cc
+++ b/storage/spider/spd_db_handlersocket.cc
@@ -4994,6 +4994,15 @@ int spider_handlersocket_handler::append_explain_select_part(
DBUG_RETURN(0);
}
+int spider_handlersocket_handler::is_sole_projection_field(
+ uint16 field_index
+) {
+ DBUG_ENTER("spider_handlersocket_handler::is_sole_projection_field");
+ DBUG_PRINT("info", ("spider this=%p", this));
+ DBUG_ASSERT(0);
+ DBUG_RETURN(0);
+}
+
bool spider_handlersocket_handler::is_bulk_insert_exec_period(
bool bulk_end
) {
diff --git a/storage/spider/spd_db_handlersocket.h b/storage/spider/spd_db_handlersocket.h
index d3fdf5564b7..a3955aea044 100644
--- a/storage/spider/spd_db_handlersocket.h
+++ b/storage/spider/spd_db_handlersocket.h
@@ -776,6 +776,9 @@ public:
ulong sql_type,
int link_idx
);
+ bool is_sole_projection_field(
+ uint16 field_index
+ );
bool is_bulk_insert_exec_period(
bool bulk_end
);
diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h
index 936951d3860..56bc2ccad42 100644
--- a/storage/spider/spd_db_include.h
+++ b/storage/spider/spd_db_include.h
@@ -1279,6 +1279,9 @@ public:
ulong sql_type,
int link_idx
) = 0;
+ virtual bool is_sole_projection_field(
+ uint16 field_index
+ ) = 0;
virtual bool is_bulk_insert_exec_period(
bool bulk_end
) = 0;
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index f902508e9c4..385b122c274 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -9516,6 +9516,65 @@ int spider_mysql_handler::append_explain_select(
DBUG_RETURN(0);
}
+/********************************************************************
+ * Determine whether the current query's projection list
+ * consists solely of the specified column.
+ *
+ * Params IN - field_index:
+ * Field index of the column of interest within
+ * its table.
+ *
+ * Returns TRUE - if the query's projection list consists
+ * solely of the specified column.
+ * FALSE - otherwise.
+ ********************************************************************/
+bool spider_mysql_handler::is_sole_projection_field( uint16 field_index )
+{
+ // Determine whether the projection list consists solely of the field of interest
+ bool is_field_in_projection_list = FALSE;
+ TABLE* table = spider->get_table();
+ uint16 projection_field_count = 0;
+ uint16 projection_field_index;
+ Field** field;
+ DBUG_ENTER( "spider_mysql_handler::is_sole_projection_field" );
+
+ for ( field = table->field; *field ; field++ )
+ {
+ projection_field_index = ( *field )->field_index;
+
+ if ( !( minimum_select_bit_is_set( projection_field_index ) ) )
+ {
+ // Current field is not in the projection list
+ continue;
+ }
+
+ projection_field_count++;
+
+ if ( !is_field_in_projection_list )
+ {
+ if ( field_index == projection_field_index )
+ {
+ // Field of interest is in the projection list
+ is_field_in_projection_list = TRUE;
+ }
+ }
+
+ if ( is_field_in_projection_list && ( projection_field_count != 1 ) )
+ {
+ // Field of interest is not the sole column in the projection list
+ DBUG_RETURN( FALSE );
+ }
+ }
+
+ if ( is_field_in_projection_list && ( projection_field_count == 1 ) )
+ {
+ // Field of interest is the only column in the projection list
+ DBUG_RETURN( TRUE );
+ }
+
+ DBUG_RETURN( FALSE );
+}
+
bool spider_mysql_handler::is_bulk_insert_exec_period(
bool bulk_end
) {
diff --git a/storage/spider/spd_db_mysql.h b/storage/spider/spd_db_mysql.h
index 9a4f08ade98..482289d1d68 100644
--- a/storage/spider/spd_db_mysql.h
+++ b/storage/spider/spd_db_mysql.h
@@ -1128,6 +1128,9 @@ public:
ulong sql_type,
int link_idx
);
+ bool is_sole_projection_field(
+ uint16 field_index
+ );
bool is_bulk_insert_exec_period(
bool bulk_end
);
diff --git a/storage/spider/spd_db_oracle.cc b/storage/spider/spd_db_oracle.cc
index 5e6c89b10d0..5b322b9c4d7 100644
--- a/storage/spider/spd_db_oracle.cc
+++ b/storage/spider/spd_db_oracle.cc
@@ -9571,6 +9571,65 @@ int spider_oracle_handler::append_explain_select(
DBUG_RETURN(0);
}
+/********************************************************************
+ * Determine whether the current query's projection list
+ * consists solely of the specified column.
+ *
+ * Params IN - field_index:
+ * Field index of the column of interest within
+ * its table.
+ *
+ * Returns TRUE - if the query's projection list consists
+ * solely of the specified column.
+ * FALSE - otherwise.
+ ********************************************************************/
+bool spider_oracle_handler::is_sole_projection_field( uint16 field_index )
+{
+ // Determine whether the projection list consists solely of the field of interest
+ bool is_field_in_projection_list = FALSE;
+ TABLE* table = spider->get_table();
+ uint16 projection_field_count = 0;
+ uint16 projection_field_index;
+ Field** field;
+ DBUG_ENTER( "spider_oracle_handler::is_sole_projection_field" );
+
+ for ( field = table->field; *field; field++ )
+ {
+ projection_field_index = ( *field )->field_index;
+
+ if ( !( minimum_select_bit_is_set( projection_field_index ) ) )
+ {
+ // Current field is not in the projection list
+ continue;
+ }
+
+ projection_field_count++;
+
+ if ( !is_field_in_projection_list )
+ {
+ if (field_index == projection_field_index)
+ {
+ // Field of interest is in the projection list
+ is_field_in_projection_list = TRUE;
+ }
+ }
+
+ if ( is_field_in_projection_list && ( projection_field_count != 1 ) )
+ {
+ // Field of interest is not the sole column in the projection list
+ DBUG_RETURN( FALSE );
+ }
+ }
+
+ if ( is_field_in_projection_list && ( projection_field_count == 1 ) )
+ {
+ // Field of interest is the only column in the projection list
+ DBUG_RETURN( TRUE );
+ }
+
+ DBUG_RETURN( FALSE );
+}
+
bool spider_oracle_handler::is_bulk_insert_exec_period(
bool bulk_end
) {
diff --git a/storage/spider/spd_db_oracle.h b/storage/spider/spd_db_oracle.h
index 0e84435d9be..7a070f498da 100644
--- a/storage/spider/spd_db_oracle.h
+++ b/storage/spider/spd_db_oracle.h
@@ -1208,6 +1208,9 @@ public:
ulong sql_type,
int link_idx
);
+ bool is_sole_projection_field(
+ uint16 field_index
+ );
bool is_bulk_insert_exec_period(
bool bulk_end
);
diff --git a/storage/xtradb/btr/btr0btr.cc b/storage/xtradb/btr/btr0btr.cc
index 417eeb2c367..48411b6ff6a 100644
--- a/storage/xtradb/btr/btr0btr.cc
+++ b/storage/xtradb/btr/btr0btr.cc
@@ -3277,7 +3277,7 @@ func_start:
btr_page_create(new_block, new_page_zip, cursor->index,
btr_page_get_level(page, mtr), mtr);
/* Only record the leaf level page splits. */
- if (btr_page_get_level(page, mtr) == 0) {
+ if (page_is_leaf(page)) {
cursor->index->stat_defrag_n_page_split ++;
cursor->index->stat_defrag_modified_counter ++;
btr_defragment_save_defrag_stats_if_needed(cursor->index);
diff --git a/storage/xtradb/btr/btr0defragment.cc b/storage/xtradb/btr/btr0defragment.cc
index 8de85e746ca..3f4185341a6 100644
--- a/storage/xtradb/btr/btr0defragment.cc
+++ b/storage/xtradb/btr/btr0defragment.cc
@@ -233,7 +233,7 @@ btr_defragment_add_index(
return NULL;
}
- if (btr_page_get_level(page, &mtr) == 0) {
+ if (page_is_leaf(page)) {
// Index root is a leaf page, no need to defragment.
mtr_commit(&mtr);
return NULL;
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc
index 70cd9610b18..78ebbb7902b 100644
--- a/storage/xtradb/buf/buf0buf.cc
+++ b/storage/xtradb/buf/buf0buf.cc
@@ -5931,23 +5931,22 @@ buf_print_io_instance(
pool_info->pages_written_rate);
if (pool_info->n_page_get_delta) {
- double hit_rate = ((1000 * pool_info->page_read_delta)
- / pool_info->n_page_get_delta);
+ double hit_rate = double(pool_info->page_read_delta)
+ / pool_info->n_page_get_delta;
- if (hit_rate > 1000) {
- hit_rate = 1000;
+ if (hit_rate > 1) {
+ hit_rate = 1;
}
- hit_rate = 1000 - hit_rate;
-
fprintf(file,
- "Buffer pool hit rate %lu / 1000,"
- " young-making rate %lu / 1000 not %lu / 1000\n",
- (ulint) hit_rate,
- (ulint) (1000 * pool_info->young_making_delta
- / pool_info->n_page_get_delta),
- (ulint) (1000 * pool_info->not_young_making_delta
- / pool_info->n_page_get_delta));
+ "Buffer pool hit rate " ULINTPF " / 1000,"
+ " young-making rate " ULINTPF " / 1000 not "
+ ULINTPF " / 1000\n",
+ ulint(1000 * (1 - hit_rate)),
+ ulint(1000 * double(pool_info->young_making_delta)
+ / pool_info->n_page_get_delta),
+ ulint(1000 * double(pool_info->not_young_making_delta)
+ / pool_info->n_page_get_delta));
} else {
fputs("No buffer pool page gets since the last printout\n",
file);
@@ -6245,70 +6244,54 @@ buf_pool_reserve_tmp_slot(
return (free_slot);
}
-/********************************************************************//**
-Encrypts a buffer page right before it's flushed to disk
-@param[in,out] bpage Page control block
-@param[in,out] src_frame Source page
-@param[in] space_id Tablespace id
-@return either unencrypted source page or decrypted page.
-*/
+/** Encryption and page_compression hook that is called just before
+a page is written to disk.
+@param[in,out] space tablespace
+@param[in,out] bpage buffer page
+@param[in] src_frame physical page frame that is being encrypted
+@return page frame to be written to file
+(may be src_frame or an encrypted/compressed copy of it) */
+UNIV_INTERN
byte*
buf_page_encrypt_before_write(
+ fil_space_t* space,
buf_page_t* bpage,
- byte* src_frame,
- ulint space_id)
+ byte* src_frame)
{
+ ut_ad(space->id == bpage->space);
bpage->real_size = UNIV_PAGE_SIZE;
fil_page_type_validate(src_frame);
- if (bpage->offset == 0) {
+ switch (bpage->offset) {
+ case 0:
/* Page 0 of a tablespace is not encrypted/compressed */
ut_ad(bpage->key_version == 0);
return src_frame;
- }
-
- if (bpage->space == TRX_SYS_SPACE && bpage->offset == TRX_SYS_PAGE_NO) {
- /* don't encrypt/compress page as it contains address to dblwr buffer */
- bpage->key_version = 0;
- return src_frame;
- }
-
- fil_space_t* space = fil_space_acquire_silent(space_id);
-
- /* Tablespace must exist during write operation */
- if (!space) {
- /* This could be true on discard if we have injected a error
- case e.g. in innodb.innodb-wl5522-debug-zip so that space
- is already marked as stop_new_ops = true. */
- return src_frame;
+ case TRX_SYS_PAGE_NO:
+ if (bpage->space == TRX_SYS_SPACE) {
+ /* don't encrypt/compress page as it contains
+ address to dblwr buffer */
+ bpage->key_version = 0;
+ return src_frame;
+ }
}
fil_space_crypt_t* crypt_data = space->crypt_data;
- bool encrypted = true;
+ const bool encrypted = crypt_data
+ && !crypt_data->not_encrypted()
+ && crypt_data->type != CRYPT_SCHEME_UNENCRYPTED
+ && (!crypt_data->is_default_encryption()
+ || srv_encrypt_tables);
- if (space->crypt_data != NULL && space->crypt_data->not_encrypted()) {
- /* Encryption is disabled */
- encrypted = false;
- }
-
- if (!srv_encrypt_tables && (crypt_data == NULL || crypt_data->is_default_encryption())) {
- /* Encryption is disabled */
- encrypted = false;
- }
-
- /* Is encryption needed? */
- if (crypt_data == NULL || crypt_data->type == CRYPT_SCHEME_UNENCRYPTED) {
- /* An unencrypted table */
+ if (!encrypted) {
bpage->key_version = 0;
- encrypted = false;
}
- bool page_compressed = fil_space_is_page_compressed(bpage->space);
+ bool page_compressed = FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags);
if (!encrypted && !page_compressed) {
/* No need to encrypt or page compress the page */
- fil_space_release(space);
return src_frame;
}
@@ -6336,25 +6319,21 @@ buf_page_encrypt_before_write(
bpage->real_size = page_size;
slot->out_buf = dst_frame = tmp;
-#ifdef UNIV_DEBUG
- fil_page_type_validate(tmp);
-#endif
-
+ ut_d(fil_page_type_validate(tmp));
} else {
/* First we compress the page content */
ulint out_len = 0;
- ulint block_size = fil_space_get_block_size(bpage->space, bpage->offset, page_size);
-
- byte *tmp = fil_compress_page(bpage->space,
- (byte *)src_frame,
- slot->comp_buf,
- page_size,
- fil_space_get_page_compression_level(bpage->space),
- block_size,
- encrypted,
- &out_len,
- IF_LZO(slot->lzo_mem, NULL)
- );
+
+ byte *tmp = fil_compress_page(
+ space,
+ (byte *)src_frame,
+ slot->comp_buf,
+ page_size,
+ fsp_flags_get_page_compression_level(space->flags),
+ fil_space_get_block_size(space, bpage->offset),
+ encrypted,
+ &out_len,
+ IF_LZO(slot->lzo_mem, NULL));
bpage->real_size = out_len;
@@ -6379,7 +6358,6 @@ buf_page_encrypt_before_write(
fil_page_type_validate(dst_frame);
#endif
- fil_space_release(space);
// return dst_frame which will be written
return dst_frame;
}
@@ -6433,9 +6411,9 @@ buf_page_decrypt_after_read(
/* decompress using comp_buf to dst_frame */
fil_decompress_page(slot->comp_buf,
- dst_frame,
- size,
- &bpage->write_size);
+ dst_frame,
+ ulong(size),
+ &bpage->write_size);
/* Mark this slot as free */
slot->reserved = false;
@@ -6487,13 +6465,10 @@ buf_page_decrypt_after_read(
#endif
/* decompress using comp_buf to dst_frame */
fil_decompress_page(slot->comp_buf,
- dst_frame,
- size,
- &bpage->write_size);
-
-#ifdef UNIV_DEBUG
- fil_page_type_validate(dst_frame);
-#endif
+ dst_frame,
+ ulong(size),
+ &bpage->write_size);
+ ut_d(fil_page_type_validate(dst_frame));
}
/* Mark this slot as free */
diff --git a/storage/xtradb/buf/buf0dblwr.cc b/storage/xtradb/buf/buf0dblwr.cc
index b11c32064bf..55c5e4d543a 100644
--- a/storage/xtradb/buf/buf0dblwr.cc
+++ b/storage/xtradb/buf/buf0dblwr.cc
@@ -538,7 +538,7 @@ buf_dblwr_process()
/* Decompress the page before
validating the checksum. */
fil_decompress_page(
- NULL, read_buf, UNIV_PAGE_SIZE,
+ NULL, read_buf, srv_page_size,
NULL, true);
}
@@ -565,7 +565,7 @@ buf_dblwr_process()
/* Decompress the page before
validating the checksum. */
fil_decompress_page(
- NULL, page, UNIV_PAGE_SIZE, NULL, true);
+ NULL, page, srv_page_size, NULL, true);
}
if (!fil_space_verify_crypt_checksum(page, zip_size, NULL, page_no)
@@ -1001,7 +1001,7 @@ flush:
srv_stats.dblwr_writes.inc();
/* Now flush the doublewrite buffer data to disk */
- fil_flush(TRX_SYS_SPACE);
+ fil_flush(ulint(TRX_SYS_SPACE));
/* We know that the writes have been flushed to disk now
and in recovery we will find them in the doublewrite buffer
@@ -1249,7 +1249,7 @@ retry:
}
/* Now flush the doublewrite buffer data to disk */
- fil_flush(TRX_SYS_SPACE);
+ fil_flush(ulint(TRX_SYS_SPACE));
/* We know that the write has been flushed to disk now
and during recovery we will find it in the doublewrite buffer
diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc
index e7ed7204920..ffd40157c30 100644
--- a/storage/xtradb/buf/buf0flu.cc
+++ b/storage/xtradb/buf/buf0flu.cc
@@ -873,11 +873,12 @@ buf_flush_write_block_low(
buf_flush_t flush_type, /*!< in: type of flush */
bool sync) /*!< in: true if sync IO request */
{
+ fil_space_t* space = fil_space_acquire(bpage->space, true);
+ if (!space) {
+ return;
+ }
ulint zip_size = buf_page_get_zip_size(bpage);
page_t* frame = NULL;
- ulint space_id = buf_page_get_space(bpage);
- atomic_writes_t awrites = fil_space_get_atomic_writes(space_id);
-
#ifdef UNIV_DEBUG
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
ut_ad(!mutex_own(&buf_pool->LRU_list_mutex));
@@ -947,7 +948,7 @@ buf_flush_write_block_low(
break;
}
- frame = buf_page_encrypt_before_write(bpage, frame, space_id);
+ frame = buf_page_encrypt_before_write(space, bpage, frame);
if (!srv_use_doublewrite_buf || !buf_dblwr) {
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
@@ -968,7 +969,8 @@ buf_flush_write_block_low(
atomic writes should be used, no doublewrite buffer
is used. */
- if (awrites == ATOMIC_WRITES_ON) {
+ if (fsp_flags_get_atomic_writes(space->flags)
+ == ATOMIC_WRITES_ON) {
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
FALSE,
buf_page_get_space(bpage),
@@ -991,10 +993,12 @@ buf_flush_write_block_low(
are working on. */
if (sync) {
ut_ad(flush_type == BUF_FLUSH_SINGLE_PAGE);
- fil_flush(buf_page_get_space(bpage));
+ fil_flush(space);
buf_page_io_complete(bpage);
}
+ fil_space_release(space);
+
/* Increment the counter of I/O operations used
for selecting LRU policy. */
buf_LRU_stat_inc_io();
diff --git a/storage/xtradb/buf/buf0rea.cc b/storage/xtradb/buf/buf0rea.cc
index 15465699726..be2ee56504b 100644
--- a/storage/xtradb/buf/buf0rea.cc
+++ b/storage/xtradb/buf/buf0rea.cc
@@ -998,15 +998,11 @@ not_to_recover:
count++;
if (count > 1000) {
- fprintf(stderr,
- "InnoDB: Error: InnoDB has waited for"
- " 10 seconds for pending\n"
- "InnoDB: reads to the buffer pool to"
- " be finished.\n"
- "InnoDB: Number of pending reads %lu,"
- " pending pread calls %lu\n",
- (ulong) buf_pool->n_pend_reads,
- (ulong) os_file_n_pending_preads);
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "waited for 10 seconds for " ULINTPF
+ " pending reads to the buffer pool to"
+ " be finished",
+ buf_pool->n_pend_reads);
os_aio_print_debug = TRUE;
}
diff --git a/storage/xtradb/dict/dict0stats.cc b/storage/xtradb/dict/dict0stats.cc
index 6a28f3cdf8f..33b6c2e23e0 100644
--- a/storage/xtradb/dict/dict0stats.cc
+++ b/storage/xtradb/dict/dict0stats.cc
@@ -1576,7 +1576,7 @@ dict_stats_analyze_index_below_cur(
page = buf_block_get_frame(block);
- if (btr_page_get_level(page, mtr) == 0) {
+ if (page_is_leaf(page)) {
/* leaf level */
break;
}
@@ -1620,7 +1620,7 @@ dict_stats_analyze_index_below_cur(
}
/* make sure we got a leaf page as a result from the above loop */
- ut_ad(btr_page_get_level(page, &mtr) == 0);
+ ut_ad(page_is_leaf(page));
/* scan the leaf page and find the number of distinct keys,
when looking only at the first n_prefix columns; also estimate
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index aa95de7efea..f37d5e19ad6 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -694,7 +694,8 @@ fil_space_encrypt(
comp_mem = (byte *)malloc(UNIV_PAGE_SIZE);
uncomp_mem = (byte *)malloc(UNIV_PAGE_SIZE);
memcpy(comp_mem, src_frame, UNIV_PAGE_SIZE);
- fil_decompress_page(uncomp_mem, comp_mem, UNIV_PAGE_SIZE, NULL);
+ fil_decompress_page(uncomp_mem, comp_mem,
+ srv_page_size, NULL);
src = uncomp_mem;
}
@@ -704,7 +705,8 @@ fil_space_encrypt(
/* Need to decompress the page if it was also compressed */
if (page_compressed_encrypted) {
memcpy(comp_mem, tmp_mem, UNIV_PAGE_SIZE);
- fil_decompress_page(tmp_mem, comp_mem, UNIV_PAGE_SIZE, NULL);
+ fil_decompress_page(tmp_mem, comp_mem,
+ srv_page_size, NULL);
}
bool corrupted = buf_page_is_corrupted(true, tmp_mem, zip_size, space);
@@ -1492,20 +1494,21 @@ fil_crypt_realloc_iops(
if (10 * state->cnt_waited > state->batch) {
/* if we waited more than 10% re-estimate max_iops */
- uint avg_wait_time_us =
+ ulint avg_wait_time_us =
state->sum_waited_us / state->cnt_waited;
+ if (avg_wait_time_us == 0) {
+ avg_wait_time_us = 1; // prevent division by zero
+ }
+
DBUG_PRINT("ib_crypt",
- ("thr_no: %u - update estimated_max_iops from %u to %u.",
+ ("thr_no: %u - update estimated_max_iops from %u to "
+ ULINTPF ".",
state->thread_no,
state->estimated_max_iops,
1000000 / avg_wait_time_us));
- if (avg_wait_time_us == 0) {
- avg_wait_time_us = 1; // prevent division by zero
- }
-
- state->estimated_max_iops = 1000000 / avg_wait_time_us;
+ state->estimated_max_iops = uint(1000000 / avg_wait_time_us);
state->cnt_waited = 0;
state->sum_waited_us = 0;
} else {
@@ -1739,33 +1742,27 @@ fil_crypt_find_page_to_rotate(
fil_space_crypt_t *crypt_data = space->crypt_data;
- /* Space might already be dropped */
- if (crypt_data) {
- mutex_enter(&crypt_data->mutex);
- ut_ad(key_state->key_id == crypt_data->key_id);
-
- if (crypt_data->rotate_state.next_offset <
- crypt_data->rotate_state.max_offset) {
+ mutex_enter(&crypt_data->mutex);
+ ut_ad(key_state->key_id == crypt_data->key_id);
- state->offset = crypt_data->rotate_state.next_offset;
- ulint remaining = crypt_data->rotate_state.max_offset -
- crypt_data->rotate_state.next_offset;
+ bool found = crypt_data->rotate_state.max_offset >=
+ crypt_data->rotate_state.next_offset;
- if (batch <= remaining) {
- state->batch = batch;
- } else {
- state->batch = remaining;
- }
+ if (found) {
+ state->offset = crypt_data->rotate_state.next_offset;
+ ulint remaining = crypt_data->rotate_state.max_offset -
+ crypt_data->rotate_state.next_offset;
- crypt_data->rotate_state.next_offset += batch;
- mutex_exit(&crypt_data->mutex);
- return true;
+ if (batch <= remaining) {
+ state->batch = batch;
+ } else {
+ state->batch = remaining;
}
-
- mutex_exit(&crypt_data->mutex);
}
- return false;
+ crypt_data->rotate_state.next_offset += batch;
+ mutex_exit(&crypt_data->mutex);
+ return found;
}
/***********************************************************************
@@ -2343,7 +2340,7 @@ DECLARE_THREAD(fil_crypt_thread)(
fil_crypt_start_rotate_space(&new_state, &thr);
/* iterate all pages (cooperativly with other threads) */
- while (!thr.should_shutdown() && thr.space &&
+ while (!thr.should_shutdown() &&
fil_crypt_find_page_to_rotate(&new_state, &thr)) {
/* rotate a (set) of pages */
@@ -2352,6 +2349,8 @@ DECLARE_THREAD(fil_crypt_thread)(
/* If space is marked as stopping, release
space and stop rotation. */
if (thr.space->is_stopping()) {
+ fil_crypt_complete_rotate_space(
+ &new_state, &thr);
fil_space_release(thr.space);
thr.space = NULL;
break;
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index e7244d719c8..e504ab3947e 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -5993,31 +5993,34 @@ fil_space_get_node(
return (node);
}
-/********************************************************************//**
-Return block size of node in file space
-@return file block size */
+
+/** Determine the block size of the data file.
+@param[in] space tablespace
+@param[in] offset page number
+@return block size */
UNIV_INTERN
ulint
-fil_space_get_block_size(
-/*=====================*/
- ulint space_id,
- ulint block_offset,
- ulint len)
+fil_space_get_block_size(const fil_space_t* space, unsigned offset)
{
- ulint block_size = 512;
- ut_ad(!mutex_own(&fil_system->mutex));
-
- mutex_enter(&fil_system->mutex);
- fil_space_t* space = fil_space_get_space(space_id);
+ ut_ad(space->n_pending_ops > 0);
- if (space) {
- fil_node_t* node = fil_space_get_node(space, space_id, &block_offset, 0, len);
+ ulint block_size = 512;
- if (node) {
- block_size = node->file_block_size;
+ for (fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
+ node != NULL;
+ node = UT_LIST_GET_NEXT(chain, node)) {
+ block_size = node->file_block_size;
+ if (node->size > offset) {
+ break;
}
+ offset -= node->size;
+ }
+
+ /* Currently supporting block size up to 4K,
+ fall back to default if bigger requested. */
+ if (block_size > 4096) {
+ block_size = 512;
}
- mutex_exit(&fil_system->mutex);
return block_size;
}
@@ -6398,14 +6401,29 @@ fil_flush(
mutex_exit(&fil_system->mutex);
}
-/**********************************************************************//**
-Flushes to disk the writes in file spaces of the given type possibly cached by
-the OS. */
+/** Flush a tablespace.
+@param[in,out] space tablespace to flush */
UNIV_INTERN
void
-fil_flush_file_spaces(
-/*==================*/
- ulint purpose) /*!< in: FIL_TABLESPACE, FIL_LOG */
+fil_flush(fil_space_t* space)
+{
+ ut_ad(space->n_pending_ops > 0);
+
+ if (!space->is_stopping()) {
+ mutex_enter(&fil_system->mutex);
+ if (!space->is_stopping()) {
+ fil_flush_low(space);
+ }
+ mutex_exit(&fil_system->mutex);
+ }
+}
+
+/** Flush to disk the writes in file spaces of the given type
+possibly cached by the OS.
+@param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_LOG */
+UNIV_INTERN
+void
+fil_flush_file_spaces(ulint purpose)
{
fil_space_t* space;
ulint* space_ids;
@@ -6772,7 +6790,8 @@ fil_iterate(
/* If the original page is page_compressed, we need
to decompress page before we can update it. */
if (page_compressed) {
- fil_decompress_page(NULL, dst, size, NULL);
+ fil_decompress_page(NULL, dst, ulong(size),
+ NULL);
updated = true;
}
@@ -6832,12 +6851,14 @@ fil_iterate(
if (page_compressed) {
ulint len = 0;
- fil_compress_page(space_id,
+
+ fil_compress_page(
+ NULL,
src,
NULL,
size,
- fil_space_get_page_compression_level(space_id),
- fil_space_get_block_size(space_id, offset, size),
+ 0,/* FIXME: compression level */
+ 512,/* FIXME: use proper block size */
encrypted,
&len,
NULL);
@@ -6848,6 +6869,8 @@ fil_iterate(
/* If tablespace is encrypted, encrypt page before we
write it back. Note that we should not encrypt the
buffer that is in buffer pool. */
+ /* NOTE: At this stage of IMPORT the
+ buffer pool is not being used at all! */
if (decrypted && encrypted) {
byte *dest = writeptr + (i * size);
ulint space = mach_read_from_4(
@@ -7401,7 +7424,6 @@ fil_space_acquire_low(ulint id, bool silent, bool for_io = false)
if (!silent) {
ib_logf(IB_LOG_LEVEL_WARN, "Trying to access missing"
" tablespace " ULINTPF ".", id);
- ut_error;
}
} else if (!for_io && space->is_stopping()) {
space = NULL;
diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc
index 303ab5102fb..8b2449983df 100644
--- a/storage/xtradb/fil/fil0pagecompress.cc
+++ b/storage/xtradb/fil/fil0pagecompress.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (C) 2013, 2016, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2013, 2017, MariaDB Corporation. 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
@@ -91,8 +91,7 @@ UNIV_INTERN
byte*
fil_compress_page(
/*==============*/
- ulint space_id, /*!< in: tablespace id of the
- table. */
+ fil_space_t* space, /*!< in,out: tablespace (NULL during IMPORT) */
byte* buf, /*!< in: buffer from which to write; in aio
this must be appropriately aligned */
byte* out_buf, /*!< out: compressed buffer */
@@ -110,9 +109,12 @@ fil_compress_page(
ulint write_size=0;
/* Cache to avoid change during function execution */
ulint comp_method = innodb_compression_algorithm;
- ulint orig_page_type;
bool allocated=false;
+ /* page_compression does not apply to tables or tablespaces
+ that use ROW_FORMAT=COMPRESSED */
+ ut_ad(!space || !FSP_FLAGS_GET_ZIP_SSIZE(space->flags));
+
if (encrypted) {
header_len += FIL_PAGE_COMPRESSION_METHOD_SIZE;
}
@@ -133,21 +135,14 @@ fil_compress_page(
ut_ad(len);
ut_ad(out_len);
- /* read original page type */
- orig_page_type = mach_read_from_2(buf + FIL_PAGE_TYPE);
-
- fil_system_enter();
- fil_space_t* space = fil_space_get_by_id(space_id);
- fil_system_exit();
-
/* Let's not compress file space header or
extent descriptor */
- if (orig_page_type == 0 ||
- orig_page_type == FIL_PAGE_TYPE_FSP_HDR ||
- orig_page_type == FIL_PAGE_TYPE_XDES ||
- orig_page_type == FIL_PAGE_PAGE_COMPRESSED) {
+ switch (fil_page_get_type(buf)) {
+ case 0:
+ case FIL_PAGE_TYPE_FSP_HDR:
+ case FIL_PAGE_TYPE_XDES:
+ case FIL_PAGE_PAGE_COMPRESSED:
*out_len = len;
-
goto err_exit;
}
@@ -157,11 +152,11 @@ fil_compress_page(
comp_level = page_zip_level;
}
-#ifdef UNIV_PAGECOMPRESS_DEBUG
- ib_logf(IB_LOG_LEVEL_INFO,
- "Preparing for compress for space %lu name %s len %lu.",
- space_id, fil_space_name(space), len);
-#endif /* UNIV_PAGECOMPRESS_DEBUG */
+ DBUG_PRINT("compress",
+ ("Preparing for space " ULINTPF " '%s' len " ULINTPF,
+ space ? space->id : 0,
+ space ? space->name : "(import)",
+ len));
write_size = UNIV_PAGE_SIZE - header_len;
@@ -176,12 +171,15 @@ fil_compress_page(
/* If error we leave the actual page as it was */
#ifndef UNIV_PAGECOMPRESS_DEBUG
- if (space->printed_compression_failure == false) {
+ if (space && !space->printed_compression_failure) {
+ space->printed_compression_failure = true;
#endif
ib_logf(IB_LOG_LEVEL_WARN,
- "Compression failed for space %lu name %s len %lu rt %d write %lu.",
- space_id, fil_space_name(space), len, err, write_size);
- space->printed_compression_failure = true;
+ "Compression failed for space " ULINTPF
+ " name %s len " ULINTPF
+ " err %d write_size " ULINTPF ".",
+ space->id, space->name, len,
+ err, write_size);
#ifndef UNIV_PAGECOMPRESS_DEBUG
}
#endif
@@ -197,11 +195,14 @@ fil_compress_page(
buf, len, out_buf+header_len, &write_size, lzo_mem);
if (err != LZO_E_OK || write_size > UNIV_PAGE_SIZE-header_len) {
- if (space->printed_compression_failure == false) {
- ib_logf(IB_LOG_LEVEL_WARN,
- "Compression failed for space %lu name %s len %lu err %d write_size %lu.",
- space_id, fil_space_name(space), len, err, write_size);
+ if (space && !space->printed_compression_failure) {
space->printed_compression_failure = true;
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Compression failed for space " ULINTPF
+ " name %s len " ULINTPF
+ " err %d write_size " ULINTPF ".",
+ space->id, space->name, len,
+ err, write_size);
}
srv_stats.pages_page_compression_error.inc();
@@ -226,11 +227,14 @@ fil_compress_page(
(size_t)write_size);
if (err != LZMA_OK || out_pos > UNIV_PAGE_SIZE-header_len) {
- if (space->printed_compression_failure == false) {
- ib_logf(IB_LOG_LEVEL_WARN,
- "Compression failed for space %lu name %s len %lu err %d write_size %lu",
- space_id, fil_space_name(space), len, err, out_pos);
+ if (space && !space->printed_compression_failure) {
space->printed_compression_failure = true;
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Compression failed for space " ULINTPF
+ " name %s len " ULINTPF
+ " err %d write_size " ULINTPF ".",
+ space->id, space->name, len,
+ err, out_pos);
}
srv_stats.pages_page_compression_error.inc();
@@ -257,11 +261,14 @@ fil_compress_page(
0);
if (err != BZ_OK || write_size > UNIV_PAGE_SIZE-header_len) {
- if (space->printed_compression_failure == false) {
- ib_logf(IB_LOG_LEVEL_WARN,
- "Compression failed for space %lu name %s len %lu err %d write_size %lu.",
- space_id, fil_space_name(space), len, err, write_size);
+ if (space && !space->printed_compression_failure) {
space->printed_compression_failure = true;
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Compression failed for space " ULINTPF
+ " name %s len " ULINTPF
+ " err %d write_size " ULINTPF ".",
+ space->id, space->name, len,
+ err, write_size);
}
srv_stats.pages_page_compression_error.inc();
@@ -284,11 +291,14 @@ fil_compress_page(
(size_t*)&write_size);
if (cstatus != SNAPPY_OK || write_size > UNIV_PAGE_SIZE-header_len) {
- if (space->printed_compression_failure == false) {
- ib_logf(IB_LOG_LEVEL_WARN,
- "Compression failed for space %lu name %s len %lu err %d write_size %lu.",
- space_id, fil_space_name(space), len, (int)cstatus, write_size);
+ if (space && !space->printed_compression_failure) {
space->printed_compression_failure = true;
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Compression failed for space " ULINTPF
+ " name %s len " ULINTPF
+ " err %d write_size " ULINTPF ".",
+ space->id, space->name, len,
+ (int)cstatus, write_size);
}
srv_stats.pages_page_compression_error.inc();
@@ -300,16 +310,20 @@ fil_compress_page(
#endif /* HAVE_SNAPPY */
case PAGE_ZLIB_ALGORITHM:
- err = compress2(out_buf+header_len, (ulong*)&write_size, buf, len, comp_level);
+ err = compress2(out_buf+header_len, (ulong*)&write_size, buf,
+ uLong(len), comp_level);
if (err != Z_OK) {
/* If error we leave the actual page as it was */
- if (space->printed_compression_failure == false) {
- ib_logf(IB_LOG_LEVEL_WARN,
- "Compression failed for space %lu name %s len %lu rt %d write %lu.",
- space_id, fil_space_name(space), len, err, write_size);
+ if (space && !space->printed_compression_failure) {
space->printed_compression_failure = true;
+ ib_logf(IB_LOG_LEVEL_WARN,
+ "Compression failed for space " ULINTPF
+ " name %s len " ULINTPF
+ " rt %d write_size " ULINTPF ".",
+ space->id, space->name, len,
+ err, write_size);
}
srv_stats.pages_page_compression_error.inc();
@@ -364,11 +378,10 @@ fil_compress_page(
uncomp_page = static_cast<byte *>(ut_malloc(UNIV_PAGE_SIZE));
memcpy(comp_page, out_buf, UNIV_PAGE_SIZE);
- fil_decompress_page(uncomp_page, comp_page, len, NULL);
+ fil_decompress_page(uncomp_page, comp_page, ulong(len), NULL);
- if(buf_page_is_corrupted(false, uncomp_page, 0, space)) {
- buf_page_print(uncomp_page, 0, BUF_PAGE_PRINT_NO_CRASH);
- ut_error;
+ if (buf_page_is_corrupted(false, uncomp_page, 0, space)) {
+ buf_page_print(uncomp_page, 0, 0);
}
ut_free(comp_page);
@@ -396,11 +409,12 @@ fil_compress_page(
#endif
}
-#ifdef UNIV_PAGECOMPRESS_DEBUG
- ib_logf(IB_LOG_LEVEL_INFO,
- "Compression succeeded for space %lu name %s len %lu out_len %lu.",
- space_id, fil_space_name(space), len, write_size);
-#endif /* UNIV_PAGECOMPRESS_DEBUG */
+ DBUG_PRINT("compress",
+ ("Succeeded for space " ULINTPF
+ " '%s' len " ULINTPF " out_len " ULINTPF,
+ space ? space->id : 0,
+ space ? space->name : "(import)",
+ len, write_size));
srv_stats.page_compression_saved.add((len - write_size));
srv_stats.pages_page_compressed.inc();
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index 1774d9445ff..4a632e2345f 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -1534,17 +1534,19 @@ buf_own_zip_mutex_for_page(
MY_ATTRIBUTE((nonnull,warn_unused_result));
#endif /* UNIV_DEBUG */
-/********************************************************************//**
-The hook that is called just before a page is written to disk.
-The function encrypts the content of the page and returns a pointer
-to a frame that will be written instead of the real frame. */
+/** Encryption and page_compression hook that is called just before
+a page is written to disk.
+@param[in,out] space tablespace
+@param[in,out] bpage buffer page
+@param[in] src_frame physical page frame that is being encrypted
+@return page frame to be written to file
+(may be src_frame or an encrypted/compressed copy of it) */
UNIV_INTERN
byte*
buf_page_encrypt_before_write(
-/*==========================*/
- buf_page_t* page, /*!< in/out: buffer page to be flushed */
- byte* frame, /*!< in: src frame */
- ulint space_id); /*!< in: space id */
+ fil_space_t* space,
+ buf_page_t* bpage,
+ byte* src_frame);
/**********************************************************************
The hook that is called after page is written to disk.
diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic
index 81da2fa5580..e3de7a33123 100644
--- a/storage/xtradb/include/dict0dict.ic
+++ b/storage/xtradb/include/dict0dict.ic
@@ -540,15 +540,16 @@ dict_tf_is_valid(
/* Make sure there are no bits that we do not know about. */
if (unused != 0) {
-
fprintf(stderr,
- "InnoDB: Error: table unused flags are %ld"
+ "InnoDB: Error: table unused flags are " ULINTPF
" in the data dictionary and are corrupted\n"
"InnoDB: Error: data dictionary flags are\n"
- "InnoDB: compact %ld atomic_blobs %ld\n"
- "InnoDB: unused %ld data_dir %ld zip_ssize %ld\n"
- "InnoDB: page_compression %ld page_compression_level %ld\n"
- "InnoDB: atomic_writes %ld\n",
+ "InnoDB: compact " ULINTPF " atomic_blobs " ULINTPF
+ "\nInnoDB: unused " ULINTPF " data_dir " ULINTPF
+ " zip_ssize " ULINTPF
+ "\nInnoDB: page_compression " ULINTPF
+ " page_compression_level " ULINTPF
+ "\nInnoDB: atomic_writes " ULINTPF "\n",
unused,
compact, atomic_blobs, unused, data_dir, zip_ssize,
page_compression, page_compression_level, atomic_writes
@@ -564,17 +565,20 @@ dict_tf_is_valid(
if (!compact) {
fprintf(stderr,
- "InnoDB: Error: table compact flags are %ld"
+ "InnoDB: Error: table compact flags are "
+ ULINTPF
" in the data dictionary and are corrupted\n"
"InnoDB: Error: data dictionary flags are\n"
- "InnoDB: compact %ld atomic_blobs %ld\n"
- "InnoDB: unused %ld data_dir %ld zip_ssize %ld\n"
- "InnoDB: page_compression %ld page_compression_level %ld\n"
- "InnoDB: atomic_writes %ld\n",
+ "InnoDB: compact " ULINTPF
+ " atomic_blobs " ULINTPF "\n"
+ "InnoDB: unused " ULINTPF
+ " data_dir " ULINTPF " zip_ssize " ULINTPF
+ "\nInnoDB: page_compression " ULINTPF
+ " page_compression_level " ULINTPF
+ "\nInnoDB: atomic_writes " ULINTPF "\n",
compact, compact, atomic_blobs, unused, data_dir, zip_ssize,
page_compression, page_compression_level, atomic_writes
);
-
return(false);
}
@@ -582,17 +586,18 @@ dict_tf_is_valid(
/* Antelope does not support COMPRESSED row format. */
fprintf(stderr,
- "InnoDB: Error: table flags are %ld"
+ "InnoDB: Error: table flags are " ULINTPF
" in the data dictionary and are corrupted\n"
"InnoDB: Error: data dictionary flags are\n"
- "InnoDB: compact %ld atomic_blobs %ld\n"
- "InnoDB: unused %ld data_dir %ld zip_ssize %ld\n"
- "InnoDB: page_compression %ld page_compression_level %ld\n"
- "InnoDB: atomic_writes %ld\n",
+ "InnoDB: compact " ULINTPF " atomic_blobs " ULINTPF
+ "\nInnoDB: unused " ULINTPF " data_dir " ULINTPF
+ " zip_ssize " ULINTPF
+ "\nInnoDB: page_compression " ULINTPF
+ " page_compression_level " ULINTPF
+ "\nInnoDB: atomic_writes " ULINTPF "\n",
flags, compact, atomic_blobs, unused, data_dir, zip_ssize,
page_compression, page_compression_level, atomic_writes
);
-
return(false);
}
@@ -606,12 +611,17 @@ dict_tf_is_valid(
|| zip_ssize > PAGE_ZIP_SSIZE_MAX) {
fprintf(stderr,
- "InnoDB: Error: table compact flags are %ld in the data dictionary and are corrupted\n"
+ "InnoDB: Error: table compact flags are "
+ ULINTPF
+ " in the data dictionary and are corrupted\n"
"InnoDB: Error: data dictionary flags are\n"
- "InnoDB: compact %ld atomic_blobs %ld\n"
- "InnoDB: unused %ld data_dir %ld zip_ssize %ld\n"
- "InnoDB: page_compression %ld page_compression_level %ld\n"
- "InnoDB: atomic_writes %ld\n",
+ "InnoDB: compact " ULINTPF
+ " atomic_blobs " ULINTPF "\n"
+ "InnoDB: unused " ULINTPF
+ " data_dir " ULINTPF " zip_ssize " ULINTPF
+ "\nInnoDB: page_compression " ULINTPF
+ " page_compression_level " ULINTPF
+ "\nInnoDB: atomic_writes " ULINTPF "\n",
flags,
compact, atomic_blobs, unused, data_dir, zip_ssize,
page_compression, page_compression_level, atomic_writes
@@ -630,16 +640,19 @@ dict_tf_is_valid(
|| !atomic_blobs) {
fprintf(stderr,
- "InnoDB: Error: table flags are %ld in the data dictionary and are corrupted\n"
+ "InnoDB: Error: table flags are " ULINTPF
+ " in the data dictionary and are corrupted\n"
"InnoDB: Error: data dictionary flags are\n"
- "InnoDB: compact %ld atomic_blobs %ld\n"
- "InnoDB: unused %ld data_dir %ld zip_ssize %ld\n"
- "InnoDB: page_compression %ld page_compression_level %ld\n"
- "InnoDB: atomic_writes %ld\n",
+ "InnoDB: compact " ULINTPF
+ " atomic_blobs " ULINTPF "\n"
+ "InnoDB: unused " ULINTPF
+ " data_dir " ULINTPF " zip_ssize " ULINTPF
+ "\nInnoDB: page_compression " ULINTPF
+ " page_compression_level " ULINTPF
+ "\nInnoDB: atomic_writes " ULINTPF "\n",
flags, compact, atomic_blobs, unused, data_dir, zip_ssize,
page_compression, page_compression_level, atomic_writes
);
-
return(false);
}
}
@@ -649,12 +662,16 @@ dict_tf_is_valid(
if(atomic_writes > ATOMIC_WRITES_OFF) {
fprintf(stderr,
- "InnoDB: Error: table flags are %ld in the data dictionary and are corrupted\n"
+ "InnoDB: Error: table flags are " ULINTPF
+ " in the data dictionary and are corrupted\n"
"InnoDB: Error: data dictionary flags are\n"
- "InnoDB: compact %ld atomic_blobs %ld\n"
- "InnoDB: unused %ld data_dir %ld zip_ssize %ld\n"
- "InnoDB: page_compression %ld page_compression_level %ld\n"
- "InnoDB: atomic_writes %ld\n",
+ "InnoDB: compact " ULINTPF
+ " atomic_blobs " ULINTPF "\n"
+ "InnoDB: unused " ULINTPF
+ " data_dir " ULINTPF " zip_ssize " ULINTPF
+ "\nInnoDB: page_compression " ULINTPF
+ " page_compression_level " ULINTPF
+ "\nInnoDB: atomic_writes " ULINTPF "\n",
flags, compact, atomic_blobs, unused, data_dir, zip_ssize,
page_compression, page_compression_level, atomic_writes
);
@@ -699,7 +716,7 @@ dict_sys_tables_type_validate(
if (redundant) {
if (zip_ssize || atomic_blobs) {
- fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=Redundant, zip_ssize %lu atomic_blobs %lu\n",
+ fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=Redundant, zip_ssize " ULINTPF " atomic_blobs " ULINTPF "\n",
zip_ssize, atomic_blobs);
return(ULINT_UNDEFINED);
}
@@ -707,7 +724,7 @@ dict_sys_tables_type_validate(
/* Make sure there are no bits that we do not know about. */
if (unused) {
- fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=%lu, unused %lu\n",
+ fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=" ULINTPF ", unused " ULINTPF "\n",
type, unused);
return(ULINT_UNDEFINED);
}
@@ -723,7 +740,7 @@ dict_sys_tables_type_validate(
} else if (zip_ssize) {
/* Antelope does not support COMPRESSED format. */
- fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=%lu, zip_ssize %lu\n",
+ fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=" ULINTPF ", zip_ssize " ULINTPF "\n",
type, zip_ssize);
return(ULINT_UNDEFINED);
}
@@ -734,14 +751,14 @@ dict_sys_tables_type_validate(
should be in N_COLS, but we already know about the
low_order_bit and DICT_N_COLS_COMPACT flags. */
if (!atomic_blobs) {
- fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=%lu, zip_ssize %lu atomic_blobs %lu\n",
+ fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=" ULINTPF ", zip_ssize " ULINTPF " atomic_blobs " ULINTPF "\n",
type, zip_ssize, atomic_blobs);
return(ULINT_UNDEFINED);
}
/* Validate that the number is within allowed range. */
if (zip_ssize > PAGE_ZIP_SSIZE_MAX) {
- fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=%lu, zip_ssize %lu max %d\n",
+ fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=" ULINTPF ", zip_ssize " ULINTPF " max %d\n",
type, zip_ssize, PAGE_ZIP_SSIZE_MAX);
return(ULINT_UNDEFINED);
}
@@ -759,8 +776,8 @@ dict_sys_tables_type_validate(
low_order_bit and DICT_N_COLS_COMPACT flags. */
if (!atomic_blobs || !page_compression) {
- fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=%lu, page_compression %lu page_compression_level %lu\n"
- "InnoDB: Error: atomic_blobs %lu\n",
+ fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=" ULINTPF ", page_compression " ULINTPF " page_compression_level " ULINTPF "\n"
+ "InnoDB: Error: atomic_blobs " ULINTPF "\n",
type, page_compression, page_compression_level, atomic_blobs);
return(ULINT_UNDEFINED);
}
@@ -768,7 +785,7 @@ dict_sys_tables_type_validate(
/* Validate that the atomic writes number is within allowed range. */
if (atomic_writes > ATOMIC_WRITES_OFF) {
- fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=%lu, atomic_writes %lu\n",
+ fprintf(stderr, "InnoDB: Error: SYS_TABLES::TYPE=" ULINTPF ", atomic_writes " ULINTPF "\n",
type, atomic_writes);
return(ULINT_UNDEFINED);
}
diff --git a/storage/xtradb/include/fil0crypt.h b/storage/xtradb/include/fil0crypt.h
index cfc2d850883..e7e9676aa3a 100644
--- a/storage/xtradb/include/fil0crypt.h
+++ b/storage/xtradb/include/fil0crypt.h
@@ -109,7 +109,7 @@ struct fil_space_crypt_t : st_encryption_scheme
The object is expected to be placed in a buffer that
has been zero-initialized. */
fil_space_crypt_t(
- ulint new_type,
+ uint new_type,
uint new_min_key_version,
uint new_key_id,
fil_encryption_t new_encryption)
@@ -117,10 +117,10 @@ struct fil_space_crypt_t : st_encryption_scheme
min_key_version(new_min_key_version),
page0_offset(0),
encryption(new_encryption),
- key_found(),
+ mutex(),
+ key_found(new_min_key_version),
rotate_state()
{
- key_found = new_min_key_version;
key_id = new_key_id;
my_random_bytes(iv, sizeof(iv));
mutex_create(fil_crypt_data_mutex_key,
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index 698039afede..d73a68d9d34 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1120,16 +1120,13 @@ _fil_io(
#define fil_io(type, sync, space_id, zip_size, block_offset, byte_offset, len, buf, message, write_size) \
_fil_io(type, sync, space_id, zip_size, block_offset, byte_offset, len, buf, message, write_size, NULL)
-/*******************************************************************//**
-Returns the block size of the file space
+/** Determine the block size of the data file.
+@param[in] space tablespace
+@param[in] offset page number
@return block size */
UNIV_INTERN
ulint
-fil_space_get_block_size(
-/*=====================*/
- ulint id, /*!< in: space id */
- ulint offset, /*!< in: page offset */
- ulint len); /*!< in: page len */
+fil_space_get_block_size(const fil_space_t* space, unsigned offset);
/**********************************************************************//**
Waits for an aio operation to complete. This function is used to write the
@@ -1151,14 +1148,18 @@ fil_flush(
/*======*/
ulint space_id); /*!< in: file space id (this can be a group of
log files or a tablespace of the database) */
-/**********************************************************************//**
-Flushes to disk writes in file spaces of the given type possibly cached by
-the OS. */
+/** Flush a tablespace.
+@param[in,out] space tablespace to flush */
UNIV_INTERN
void
-fil_flush_file_spaces(
-/*==================*/
- ulint purpose); /*!< in: FIL_TABLESPACE, FIL_LOG */
+fil_flush(fil_space_t* space);
+
+/** Flush to disk the writes in file spaces of the given type
+possibly cached by the OS.
+@param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_LOG */
+UNIV_INTERN
+void
+fil_flush_file_spaces(ulint purpose);
/******************************************************************//**
Checks the consistency of the tablespace cache.
@return TRUE if ok */
@@ -1459,14 +1460,6 @@ fil_get_next_space_safe(
#endif /* UNIV_INNOCHECKSUM */
-/*******************************************************************//**
-Return space flags */
-UNIV_INLINE
-ulint
-fil_space_flags(
-/*===========*/
- fil_space_t* space); /*!< in: space */
-
/****************************************************************//**
Does error handling when a file operation fails.
@return TRUE if we should retry the operation */
diff --git a/storage/xtradb/include/fil0fil.ic b/storage/xtradb/include/fil0fil.ic
index 1179eea8b8e..6c2504c9f8c 100644
--- a/storage/xtradb/include/fil0fil.ic
+++ b/storage/xtradb/include/fil0fil.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2015, MariaDB Corporation.
+Copyright (c) 2015, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -27,28 +27,6 @@ Created 31/03/2015 Jan Lindström
#define fil0fil_ic
/*******************************************************************//**
-Return space name */
-UNIV_INLINE
-char*
-fil_space_name(
-/*===========*/
- fil_space_t* space) /*!< in: space */
-{
- return (space->name);
-}
-
-/*******************************************************************//**
-Return space flags */
-UNIV_INLINE
-ulint
-fil_space_flags(
-/*===========*/
- fil_space_t* space) /*!< in: space */
-{
- return (space->flags);
-}
-
-/*******************************************************************//**
Return page type name */
UNIV_INLINE
const char*
@@ -137,7 +115,7 @@ fil_page_type_validate(
page_type == FIL_PAGE_TYPE_ZBLOB2 ||
page_type == FIL_PAGE_TYPE_COMPRESSED))) {
- uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
+ ulint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED);
bool page_compressed_encrypted = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
ulint space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
@@ -148,30 +126,18 @@ fil_page_type_validate(
fil_space_t* rspace = fil_space_get_by_id(space);
fil_system_exit();
-
/* Dump out the page info */
- fprintf(stderr, "InnoDB: Space %lu offset %lu name %s page_type %lu page_type_name %s\n"
- "InnoDB: key_version %u page_compressed %d page_compressed_encrypted %d lsn %llu compressed_len %lu\n",
- space, offset, rspace->name, page_type, fil_get_page_type_name(page_type),
- key_version, page_compressed, page_compressed_encrypted, (ulonglong)lsn, compressed_len);
- fflush(stderr);
-
- ut_ad(page_type == FIL_PAGE_PAGE_COMPRESSED ||
- page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED ||
- page_type == FIL_PAGE_INDEX ||
- page_type == FIL_PAGE_UNDO_LOG ||
- page_type == FIL_PAGE_INODE ||
- page_type == FIL_PAGE_IBUF_FREE_LIST ||
- page_type == FIL_PAGE_TYPE_ALLOCATED ||
- page_type == FIL_PAGE_IBUF_BITMAP ||
- page_type == FIL_PAGE_TYPE_SYS ||
- page_type == FIL_PAGE_TYPE_TRX_SYS ||
- page_type == FIL_PAGE_TYPE_FSP_HDR ||
- page_type == FIL_PAGE_TYPE_XDES ||
- page_type == FIL_PAGE_TYPE_BLOB ||
- page_type == FIL_PAGE_TYPE_ZBLOB ||
- page_type == FIL_PAGE_TYPE_ZBLOB2 ||
- page_type == FIL_PAGE_TYPE_COMPRESSED);
+ fprintf(stderr, "InnoDB: Page " ULINTPF ":" ULINTPF
+ " name %s page_type " ULINTPF " page_type_name %s\n"
+ "InnoDB: key_version " ULINTPF
+ " page_compressed %d page_compressed_encrypted %d lsn "
+ LSN_PF " compressed_len " ULINTPF "\n",
+ space, offset, rspace->name, page_type,
+ fil_get_page_type_name(page_type),
+ key_version,
+ page_compressed, page_compressed_encrypted,
+ lsn, compressed_len);
+ ut_error;
return false;
}
diff --git a/storage/xtradb/include/fil0pagecompress.h b/storage/xtradb/include/fil0pagecompress.h
index 1fe5cb66bf6..73667c5420e 100644
--- a/storage/xtradb/include/fil0pagecompress.h
+++ b/storage/xtradb/include/fil0pagecompress.h
@@ -31,33 +31,6 @@ Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com
***********************************************************************/
/*******************************************************************//**
-Returns the page compression level flag of the space, or 0 if the space
-is not compressed. The tablespace must be cached in the memory cache.
-@return page compression level if page compressed, ULINT_UNDEFINED if space not found */
-UNIV_INLINE
-ulint
-fil_space_get_page_compression_level(
-/*=================================*/
- ulint id); /*!< in: space id */
-/*******************************************************************//**
-Returns the page compression flag of the space, or false if the space
-is not compressed. The tablespace must be cached in the memory cache.
-@return true if page compressed, false if not or space not found */
-UNIV_INLINE
-bool
-fil_space_is_page_compressed(
-/*=========================*/
- ulint id); /*!< in: space id */
-/*******************************************************************//**
-Returns the atomic writes flag of the space, or false if the space
-is not using atomic writes. The tablespace must be cached in the memory cache.
-@return atomic write table option value */
-UNIV_INLINE
-atomic_writes_t
-fil_space_get_atomic_writes(
-/*=========================*/
- ulint id); /*!< in: space id */
-/*******************************************************************//**
Find out wheather the page is index page or not
@return true if page type index page, false if not */
UNIV_INLINE
@@ -84,8 +57,7 @@ UNIV_INTERN
byte*
fil_compress_page(
/*==============*/
- ulint space_id, /*!< in: tablespace id of the
- table. */
+ fil_space_t* space, /*!< in,out: tablespace (NULL during IMPORT) */
byte* buf, /*!< in: buffer from which to write; in aio
this must be appropriately aligned */
byte* out_buf, /*!< out: compressed buffer */
diff --git a/storage/xtradb/include/fsp0pagecompress.ic b/storage/xtradb/include/fsp0pagecompress.ic
index 48163277feb..14f968e319e 100644
--- a/storage/xtradb/include/fsp0pagecompress.ic
+++ b/storage/xtradb/include/fsp0pagecompress.ic
@@ -85,47 +85,6 @@ fil_page_is_compressed_encrypted(
return(mach_read_from_2(buf+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
}
-#ifndef UNIV_INNOCHECKSUM
-/*******************************************************************//**
-Returns the page compression level of the space, or 0 if the space
-is not compressed. The tablespace must be cached in the memory cache.
-@return page compression level, 0 if space not found */
-UNIV_INLINE
-ulint
-fil_space_get_page_compression_level(
-/*=================================*/
- ulint id) /*!< in: space id */
-{
- ulint flags;
-
- flags = fil_space_get_flags(id);
-
- if (flags && flags != ULINT_UNDEFINED) {
-
- return(fsp_flags_get_page_compression_level(flags));
- }
-
- return(0);
-}
-
-/*******************************************************************//**
-Extract the page compression from space.
-@return true if space is page compressed, false if space is not found
-or space is not page compressed. */
-UNIV_INLINE
-bool
-fil_space_is_page_compressed(
-/*=========================*/
- ulint id) /*!< in: space id */
-{
- ulint flags = fil_space_get_flags(id);
-
- return(flags != ULINT_UNDEFINED
- && FSP_FLAGS_HAS_PAGE_COMPRESSION(flags));
-}
-
-#endif /* UNIV_INNOCHECKSUM */
-
/****************************************************************//**
Get the name of the compression algorithm used for page
compression.
@@ -166,28 +125,6 @@ fil_get_compression_alg_name(
#ifndef UNIV_INNOCHECKSUM
/*******************************************************************//**
-Returns the atomic writes flag of the space, or false if the space
-is not using atomic writes. The tablespace must be cached in the memory cache.
-@return atomic writes table option value */
-UNIV_INLINE
-atomic_writes_t
-fil_space_get_atomic_writes(
-/*========================*/
- ulint id) /*!< in: space id */
-{
- ulint flags;
-
- flags = fil_space_get_flags(id);
-
- if (flags && flags != ULINT_UNDEFINED) {
-
- return((atomic_writes_t)fsp_flags_get_atomic_writes(flags));
- }
-
- return((atomic_writes_t)0);
-}
-
-/*******************************************************************//**
Find out wheather the page is page compressed with lzo method
@return true if page is page compressed with lzo method, false if not */
UNIV_INLINE
diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h
index d6f0ecfb69c..06bb6a6fbac 100644
--- a/storage/xtradb/include/os0file.h
+++ b/storage/xtradb/include/os0file.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -52,16 +52,6 @@ extern ibool os_has_said_disk_full;
/** Flag: enable debug printout for asynchronous i/o */
extern ibool os_aio_print_debug;
-/** Number of pending os_file_pread() operations */
-extern ulint os_file_n_pending_preads;
-/** Number of pending os_file_pwrite() operations */
-extern ulint os_file_n_pending_pwrites;
-
-/** Number of pending read operations */
-extern ulint os_n_pending_reads;
-/** Number of pending write operations */
-extern ulint os_n_pending_writes;
-
#ifdef __WIN__
/** We define always WIN_ASYNC_IO, and check at run-time whether
diff --git a/storage/xtradb/include/os0sync.h b/storage/xtradb/include/os0sync.h
index f6207555f1a..48c56a73369 100644
--- a/storage/xtradb/include/os0sync.h
+++ b/storage/xtradb/include/os0sync.h
@@ -718,10 +718,7 @@ os_atomic_clear(volatile lock_word_t* ptr)
# define HAVE_ATOMIC_BUILTINS
# define HAVE_ATOMIC_BUILTINS_BYTE
-
-# ifndef _WIN32
-# define HAVE_ATOMIC_BUILTINS_64
-# endif
+# define HAVE_ATOMIC_BUILTINS_64
/**********************************************************//**
Atomic compare and exchange of signed integers (both 32 and 64 bit).
diff --git a/storage/xtradb/include/srv0mon.h b/storage/xtradb/include/srv0mon.h
index 3b030d56d29..63fd449ee18 100644
--- a/storage/xtradb/include/srv0mon.h
+++ b/storage/xtradb/include/srv0mon.h
@@ -2,7 +2,7 @@
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -571,22 +571,30 @@ on the counters */
/** Increment a monitor counter under mutex protection.
Use MONITOR_INC if appropriate mutex protection already exists.
+@param mutex mutex to acquire and release
@param monitor monitor to be incremented by 1
-@param mutex mutex to acquire and relese */
-# define MONITOR_MUTEX_INC(mutex, monitor) \
+@param enabled whether the monitor is enabled */
+#define MONITOR_MUTEX_INC_LOW(mutex, monitor, enabled) \
ut_ad(!mutex_own(mutex)); \
- if (MONITOR_IS_ON(monitor)) { \
+ if (enabled) { \
mutex_enter(mutex); \
if (++MONITOR_VALUE(monitor) > MONITOR_MAX_VALUE(monitor)) { \
MONITOR_MAX_VALUE(monitor) = MONITOR_VALUE(monitor); \
} \
mutex_exit(mutex); \
}
+/** Increment a monitor counter under mutex protection.
+Use MONITOR_INC if appropriate mutex protection already exists.
+@param mutex mutex to acquire and release
+@param monitor monitor to be incremented by 1 */
+#define MONITOR_MUTEX_INC(mutex, monitor) \
+ MONITOR_MUTEX_INC_LOW(mutex, monitor, MONITOR_IS_ON(monitor))
/** Decrement a monitor counter under mutex protection.
Use MONITOR_DEC if appropriate mutex protection already exists.
+@param mutex mutex to acquire and release
@param monitor monitor to be decremented by 1
-@param mutex mutex to acquire and relese */
-# define MONITOR_MUTEX_DEC(mutex, monitor) \
+@param enabled whether the monitor is enabled */
+#define MONITOR_MUTEX_DEC_LOW(mutex, monitor, enabled) \
ut_ad(!mutex_own(mutex)); \
if (MONITOR_IS_ON(monitor)) { \
mutex_enter(mutex); \
@@ -595,13 +603,20 @@ Use MONITOR_DEC if appropriate mutex protection already exists.
} \
mutex_exit(mutex); \
}
+/** Decrement a monitor counter under mutex protection.
+Use MONITOR_DEC if appropriate mutex protection already exists.
+@param mutex mutex to acquire and release
+@param monitor monitor to be decremented by 1 */
+#define MONITOR_MUTEX_DEC(mutex, monitor) \
+ MONITOR_MUTEX_DEC_LOW(mutex, monitor, MONITOR_IS_ON(monitor))
#if defined HAVE_ATOMIC_BUILTINS_64
/** Atomically increment a monitor counter.
Use MONITOR_INC if appropriate mutex protection exists.
-@param monitor monitor to be incremented by 1 */
-# define MONITOR_ATOMIC_INC(monitor) \
- if (MONITOR_IS_ON(monitor)) { \
+@param monitor monitor to be incremented by 1
+@param enabled whether the monitor is enabled */
+# define MONITOR_ATOMIC_INC_LOW(monitor, enabled) \
+ if (enabled) { \
ib_uint64_t value; \
value = os_atomic_increment_uint64( \
(ib_uint64_t*) &MONITOR_VALUE(monitor), 1); \
@@ -614,9 +629,10 @@ Use MONITOR_INC if appropriate mutex protection exists.
/** Atomically decrement a monitor counter.
Use MONITOR_DEC if appropriate mutex protection exists.
-@param monitor monitor to be decremented by 1 */
-# define MONITOR_ATOMIC_DEC(monitor) \
- if (MONITOR_IS_ON(monitor)) { \
+@param monitor monitor to be decremented by 1
+@param enabled whether the monitor is enabled */
+# define MONITOR_ATOMIC_DEC_LOW(monitor, enabled) \
+ if (enabled) { \
ib_uint64_t value; \
value = os_atomic_decrement_uint64( \
(ib_uint64_t*) &MONITOR_VALUE(monitor), 1); \
@@ -647,14 +663,29 @@ srv_mon_free(void);
/** Atomically increment a monitor counter.
Use MONITOR_INC if appropriate mutex protection exists.
-@param monitor monitor to be incremented by 1 */
-# define MONITOR_ATOMIC_INC(monitor) MONITOR_MUTEX_INC(&monitor_mutex, monitor)
+@param monitor monitor to be incremented by 1
+@param enabled whether the monitor is enabled */
+# define MONITOR_ATOMIC_INC_LOW(monitor, enabled) \
+ MONITOR_MUTEX_INC_LOW(&monitor_mutex, monitor, enabled)
/** Atomically decrement a monitor counter.
Use MONITOR_DEC if appropriate mutex protection exists.
-@param monitor monitor to be decremented by 1 */
-# define MONITOR_ATOMIC_DEC(monitor) MONITOR_MUTEX_DEC(&monitor_mutex, monitor)
+@param monitor monitor to be decremented by 1
+@param enabled whether the monitor is enabled */
+# define MONITOR_ATOMIC_DEC_LOW(monitor, enabled) \
+ MONITOR_MUTEX_DEC_LOW(&monitor_mutex, monitor, enabled)
#endif /* HAVE_ATOMIC_BUILTINS_64 */
+/** Atomically increment a monitor counter if it is enabled.
+Use MONITOR_INC if appropriate mutex protection exists.
+@param monitor monitor to be incremented by 1 */
+#define MONITOR_ATOMIC_INC(monitor) \
+ MONITOR_ATOMIC_INC_LOW(monitor, MONITOR_IS_ON(monitor))
+/** Atomically decrement a monitor counter if it is enabled.
+Use MONITOR_DEC if appropriate mutex protection exists.
+@param monitor monitor to be decremented by 1 */
+#define MONITOR_ATOMIC_DEC(monitor) \
+ MONITOR_ATOMIC_DEC_LOW(monitor, MONITOR_IS_ON(monitor))
+
#define MONITOR_DEC(monitor) \
if (MONITOR_IS_ON(monitor)) { \
MONITOR_VALUE(monitor)--; \
diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h
index e621d4226a7..766d61039b4 100644
--- a/storage/xtradb/include/trx0trx.h
+++ b/storage/xtradb/include/trx0trx.h
@@ -348,6 +348,23 @@ trx_print_latched(
or 0 to use the default max length */
MY_ATTRIBUTE((nonnull));
+#ifdef WITH_WSREP
+/**********************************************************************//**
+Prints info about a transaction.
+Transaction information may be retrieved without having trx_sys->mutex acquired
+so it may not be completely accurate. The caller must own lock_sys->mutex
+and the trx must have some locks to make sure that it does not escape
+without locking lock_sys->mutex. */
+UNIV_INTERN
+void
+wsrep_trx_print_locking(
+/*==============*/
+ FILE* f, /*!< in: output stream */
+ const trx_t* trx, /*!< in: transaction */
+ ulint max_query_len) /*!< in: max query length to print,
+ or 0 to use the default max length */
+ MY_ATTRIBUTE((nonnull));
+#endif /* WITH_WSREP */
/**********************************************************************//**
Prints info about a transaction.
Acquires and releases lock_sys->mutex and trx_sys->mutex. */
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 1e375ba2c09..e698f08f15b 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -304,22 +304,12 @@ definitions: */
#endif /* !UNIV_MUST_NOT_INLINE */
-#ifdef _WIN32
-#define UNIV_WORD_SIZE 4
-#elif defined(_WIN64)
-#define UNIV_WORD_SIZE 8
-#else
-/** MySQL config.h generated by GNU autoconf will define SIZEOF_LONG in Posix */
-#define UNIV_WORD_SIZE SIZEOF_LONG
-#endif
+#define UNIV_WORD_SIZE SIZEOF_SIZE_T
/** The following alignment is used in memory allocations in memory heap
management to ensure correct alignment for doubles etc. */
#define UNIV_MEM_ALIGNMENT 8
-/** The following alignment is used in aligning lints etc. */
-#define UNIV_WORD_ALIGNMENT UNIV_WORD_SIZE
-
/*
DATABASE VERSION CONTROL
========================
@@ -478,13 +468,12 @@ the word size of the machine, that is on a 32-bit platform 32 bits, and on a
macro ULINTPF. */
-#ifdef __WIN__
+#ifdef _WIN32
/* Use the integer types and formatting strings defined in Visual Studio. */
-# define UINT32PF "%I32u"
-# define INT64PF "%I64d"
-# define UINT64PF "%I64u"
-# define UINT64PFx "%016I64x"
-# define DBUG_LSN_PF "%llu"
+# define UINT32PF "%u"
+# define INT64PF "%lld"
+# define UINT64PF "%llu"
+# define UINT64PFx "%016llx"
typedef __int64 ib_int64_t;
typedef unsigned __int64 ib_uint64_t;
typedef unsigned __int32 ib_uint32_t;
@@ -494,13 +483,12 @@ typedef unsigned __int32 ib_uint32_t;
# define INT64PF "%" PRId64
# define UINT64PF "%" PRIu64
# define UINT64PFx "%016" PRIx64
-# define DBUG_LSN_PF UINT64PF
typedef int64_t ib_int64_t;
typedef uint64_t ib_uint64_t;
typedef uint32_t ib_uint32_t;
-# endif /* __WIN__ */
+#endif
-# define IB_ID_FMT UINT64PF
+#define IB_ID_FMT UINT64PF
/* Type used for all log sequence number storage and arithmetics */
typedef ib_uint64_t lsn_t;
diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc
index 0d555ed2dd7..717fbf02536 100644
--- a/storage/xtradb/lock/lock0lock.cc
+++ b/storage/xtradb/lock/lock0lock.cc
@@ -1762,7 +1762,6 @@ wsrep_kill_victim(
is in the queue*/
} else if (lock->trx != trx) {
if (wsrep_log_conflicts) {
- mutex_enter(&trx_sys->mutex);
if (bf_this) {
fputs("\n*** Priority TRANSACTION:\n",
stderr);
@@ -1771,7 +1770,7 @@ wsrep_kill_victim(
stderr);
}
- trx_print_latched(stderr, trx, 3000);
+ wsrep_trx_print_locking(stderr, trx, 3000);
if (bf_other) {
fputs("\n*** Priority TRANSACTION:\n",
@@ -1780,10 +1779,7 @@ wsrep_kill_victim(
fputs("\n*** Victim TRANSACTION:\n",
stderr);
}
-
- trx_print_latched(stderr, lock->trx, 3000);
-
- mutex_exit(&trx_sys->mutex);
+ wsrep_trx_print_locking(stderr, lock->trx, 3000);
fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n",
stderr);
diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc
index 6b7c8d77824..120f1432ccf 100644
--- a/storage/xtradb/log/log0recv.cc
+++ b/storage/xtradb/log/log0recv.cc
@@ -1728,7 +1728,7 @@ recv_recover_page_func(
}
DBUG_PRINT("ib_log",
- ("apply " DBUG_LSN_PF ": %u len %u "
+ ("apply " LSN_PF ": %u len %u "
"page %u:%u", recv->start_lsn,
(unsigned) recv->type,
(unsigned) recv->len,
@@ -2391,7 +2391,7 @@ loop:
recv_sys->recovered_lsn = new_recovered_lsn;
DBUG_PRINT("ib_log",
- ("scan " DBUG_LSN_PF ": log rec %u len %u "
+ ("scan " LSN_PF ": log rec %u len %u "
"page %u:%u", old_lsn,
(unsigned) type, (unsigned) len,
(unsigned) space, (unsigned) page_no));
@@ -2483,7 +2483,7 @@ loop:
#endif /* UNIV_LOG_DEBUG */
DBUG_PRINT("ib_log",
- ("scan " DBUG_LSN_PF ": multi-log rec %u "
+ ("scan " LSN_PF ": multi-log rec %u "
"len %u page %u:%u",
recv_sys->recovered_lsn,
(unsigned) type, (unsigned) len,
diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc
index ed84834e6ea..03200fee80b 100644
--- a/storage/xtradb/os/os0file.cc
+++ b/storage/xtradb/os/os0file.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@@ -339,21 +339,6 @@ UNIV_INTERN time_t os_last_printout;
UNIV_INTERN ibool os_has_said_disk_full = FALSE;
-#if !defined(UNIV_HOTBACKUP) \
- && (!defined(HAVE_ATOMIC_BUILTINS) || UNIV_WORD_SIZE < 8)
-/** The mutex protecting the following counts of pending I/O operations */
-static os_ib_mutex_t os_file_count_mutex;
-#endif /* !UNIV_HOTBACKUP && (!HAVE_ATOMIC_BUILTINS || UNIV_WORD_SIZE < 8) */
-
-/** Number of pending os_file_pread() operations */
-UNIV_INTERN ulint os_file_n_pending_preads;
-/** Number of pending os_file_pwrite() operations */
-UNIV_INTERN ulint os_file_n_pending_pwrites;
-/** Number of pending write operations */
-UNIV_INTERN ulint os_n_pending_writes;
-/** Number of pending read operations */
-UNIV_INTERN ulint os_n_pending_reads;
-
#if defined(WIN_ASYNC_IO) || defined(LINUX_NATIVE_AIO)
/** After first fallocate failure we will disable os_file_trim */
static bool os_fallocate_failed;
@@ -1021,10 +1006,6 @@ void
os_io_init_simple(void)
/*===================*/
{
-#if !defined(HAVE_ATOMIC_BUILTINS) || UNIV_WORD_SIZE < 8
- os_file_count_mutex = os_mutex_create();
-#endif /* !HAVE_ATOMIC_BUILTINS || UNIV_WORD_SIZE < 8 */
-
for (ulint i = 0; i < OS_FILE_N_SEEK_MUTEXES; i++) {
os_file_seek_mutexes[i] = os_mutex_create();
}
@@ -2811,10 +2792,6 @@ os_file_pread(
trx_t* trx)
{
off_t offs;
-#if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
- ssize_t n_bytes;
- ssize_t n_read;
-#endif /* HAVE_PREAD && !HAVE_BROKEN_PREAD */
ulint sec;
ulint ms;
ib_uint64_t start_time;
@@ -2844,22 +2821,16 @@ os_file_pread(
} else {
start_time = 0;
}
-#if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
-#if defined(HAVE_ATOMIC_BUILTINS) && UNIV_WORD_SIZE == 8
- (void) os_atomic_increment_ulint(&os_n_pending_reads, 1);
- (void) os_atomic_increment_ulint(&os_file_n_pending_preads, 1);
- MONITOR_ATOMIC_INC(MONITOR_OS_PENDING_READS);
-#else
- os_mutex_enter(os_file_count_mutex);
- os_file_n_pending_preads++;
- os_n_pending_reads++;
- MONITOR_INC(MONITOR_OS_PENDING_READS);
- os_mutex_exit(os_file_count_mutex);
-#endif /* HAVE_ATOMIC_BUILTINS && UNIV_WORD == 8 */
+
+ const bool monitor = MONITOR_IS_ON(MONITOR_OS_PENDING_READS);
+#ifdef HAVE_PREAD
+ MONITOR_ATOMIC_INC_LOW(MONITOR_OS_PENDING_READS, monitor);
+
+ ssize_t n_bytes;
/* Handle partial reads and signal interruptions correctly */
for (n_bytes = 0; n_bytes < (ssize_t) n; ) {
- n_read = pread(file, buf, (ssize_t)n - n_bytes, offs);
+ ssize_t n_read = pread(file, buf, (ssize_t)n - n_bytes, offs);
if (n_read > 0) {
n_bytes += n_read;
offs += n_read;
@@ -2871,17 +2842,7 @@ os_file_pread(
}
}
-#if defined(HAVE_ATOMIC_BUILTINS) && UNIV_WORD_SIZE == 8
- (void) os_atomic_decrement_ulint(&os_n_pending_reads, 1);
- (void) os_atomic_decrement_ulint(&os_file_n_pending_preads, 1);
- MONITOR_ATOMIC_DEC(MONITOR_OS_PENDING_READS);
-#else
- os_mutex_enter(os_file_count_mutex);
- os_file_n_pending_preads--;
- os_n_pending_reads--;
- MONITOR_DEC(MONITOR_OS_PENDING_READS);
- os_mutex_exit(os_file_count_mutex);
-#endif /* !HAVE_ATOMIC_BUILTINS || UNIV_WORD == 8 */
+ MONITOR_ATOMIC_DEC_LOW(MONITOR_OS_PENDING_READS, monitor);
if (UNIV_UNLIKELY(start_time != 0))
{
@@ -2900,15 +2861,7 @@ os_file_pread(
ulint i;
#endif /* !UNIV_HOTBACKUP */
-#if defined(HAVE_ATOMIC_BUILTINS) && UNIV_WORD_SIZE == 8
- (void) os_atomic_increment_ulint(&os_n_pending_reads, 1);
- MONITOR_ATOMIC_INC(MONITOR_OS_PENDING_READS);
-#else
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_reads++;
- MONITOR_INC(MONITOR_OS_PENDING_READS);
- os_mutex_exit(os_file_count_mutex);
-#endif /* HAVE_ATOMIC_BUILTINS && UNIV_WORD == 8 */
+ MONITOR_ATOMIC_INC_LOW(MONITOR_OS_PENDING_READS, monitor);
#ifndef UNIV_HOTBACKUP
/* Protect the seek / read operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
@@ -2938,15 +2891,7 @@ os_file_pread(
os_mutex_exit(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
-#if defined(HAVE_ATOMIC_BUILTINS) && UNIV_WORD_SIZE == 8
- (void) os_atomic_decrement_ulint(&os_n_pending_reads, 1);
- MONITOR_ATOIC_DEC(MONITOR_OS_PENDING_READS);
-#else
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_reads--;
- MONITOR_DEC(MONITOR_OS_PENDING_READS);
- os_mutex_exit(os_file_count_mutex);
-#endif /* HAVE_ATOMIC_BUILTINS && UNIV_WORD_SIZE == 8 */
+ MONITOR_ATOMIC_DEC_LOW(MONITOR_OS_PENDING_READS, monitor);
if (UNIV_UNLIKELY(start_time != 0)
{
@@ -2992,18 +2937,9 @@ os_file_pwrite(
os_n_file_writes++;
-#if defined(HAVE_PWRITE) && !defined(HAVE_BROKEN_PREAD)
-#if !defined(HAVE_ATOMIC_BUILTINS) || UNIV_WORD_SIZE < 8
- os_mutex_enter(os_file_count_mutex);
- os_file_n_pending_pwrites++;
- os_n_pending_writes++;
- MONITOR_INC(MONITOR_OS_PENDING_WRITES);
- os_mutex_exit(os_file_count_mutex);
-#else
- (void) os_atomic_increment_ulint(&os_n_pending_writes, 1);
- (void) os_atomic_increment_ulint(&os_file_n_pending_pwrites, 1);
- MONITOR_ATOMIC_INC(MONITOR_OS_PENDING_WRITES);
-#endif /* !HAVE_ATOMIC_BUILTINS || UNIV_WORD < 8 */
+ const bool monitor = MONITOR_IS_ON(MONITOR_OS_PENDING_WRITES);
+#ifdef HAVE_PWRITE
+ MONITOR_ATOMIC_INC_LOW(MONITOR_OS_PENDING_WRITES, monitor);
/* Handle partial writes and signal interruptions correctly */
for (ret = 0; ret < (ssize_t) n; ) {
@@ -3022,17 +2958,7 @@ os_file_pwrite(
}
}
-#if !defined(HAVE_ATOMIC_BUILTINS) || UNIV_WORD_SIZE < 8
- os_mutex_enter(os_file_count_mutex);
- os_file_n_pending_pwrites--;
- os_n_pending_writes--;
- MONITOR_DEC(MONITOR_OS_PENDING_WRITES);
- os_mutex_exit(os_file_count_mutex);
-#else
- (void) os_atomic_decrement_ulint(&os_n_pending_writes, 1);
- (void) os_atomic_decrement_ulint(&os_file_n_pending_pwrites, 1);
- MONITOR_ATOMIC_DEC(MONITOR_OS_PENDING_WRITES);
-#endif /* !HAVE_ATOMIC_BUILTINS || UNIV_WORD < 8 */
+ MONITOR_ATOMIC_DEC_LOW(MONITOR_OS_PENDING_WRITES, monitor);
return(ret);
#else
@@ -3042,10 +2968,7 @@ os_file_pwrite(
ulint i;
# endif /* !UNIV_HOTBACKUP */
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_writes++;
- MONITOR_INC(MONITOR_OS_PENDING_WRITES);
- os_mutex_exit(os_file_count_mutex);
+ MONITOR_ATOMIC_INC_LOW(MONITOR_OS_PENDING_WRITES, monitor);
# ifndef UNIV_HOTBACKUP
/* Protect the seek / write operation with a mutex */
@@ -3079,14 +3002,10 @@ func_exit:
os_mutex_exit(os_file_seek_mutexes[i]);
# endif /* !UNIV_HOTBACKUP */
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_writes--;
- MONITOR_DEC(MONITOR_OS_PENDING_WRITES);
- os_mutex_exit(os_file_count_mutex);
-
+ MONITOR_ATOMIC_DEC_LOW(MONITOR_OS_PENDING_WRITES, monitor);
return(ret);
}
-#endif /* !UNIV_HOTBACKUP */
+#endif /* HAVE_PWRITE */
}
#endif
@@ -3118,15 +3037,13 @@ os_file_read_func(
os_n_file_reads++;
os_bytes_read_since_printout += n;
+ const bool monitor = MONITOR_IS_ON(MONITOR_OS_PENDING_READS);
try_again:
ut_ad(buf);
ut_ad(n > 0);
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_reads++;
- MONITOR_INC(MONITOR_OS_PENDING_READS);
- os_mutex_exit(os_file_count_mutex);
+ MONITOR_ATOMIC_INC_LOW(MONITOR_OS_PENDING_READS, monitor);
memset (&overlapped, 0, sizeof (overlapped));
overlapped.Offset = (DWORD)(offset & 0xFFFFFFFF);
@@ -3139,10 +3056,7 @@ try_again:
else if(GetLastError() == ERROR_IO_PENDING) {
ret = GetOverlappedResult(file, &overlapped, (DWORD *)&len, TRUE);
}
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_reads--;
- MONITOR_DEC(MONITOR_OS_PENDING_READS);
- os_mutex_exit(os_file_count_mutex);
+ MONITOR_ATOMIC_DEC_LOW(MONITOR_OS_PENDING_READS, monitor);
if (ret && len == n) {
return(TRUE);
@@ -3226,15 +3140,13 @@ os_file_read_no_error_handling_func(
os_n_file_reads++;
os_bytes_read_since_printout += n;
+ const bool monitor = MONITOR_IS_ON(MONITOR_OS_PENDING_READS);
try_again:
ut_ad(buf);
ut_ad(n > 0);
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_reads++;
- MONITOR_INC(MONITOR_OS_PENDING_READS);
- os_mutex_exit(os_file_count_mutex);
+ MONITOR_ATOMIC_INC_LOW(MONITOR_OS_PENDING_READS, monitor);
memset (&overlapped, 0, sizeof (overlapped));
overlapped.Offset = (DWORD)(offset & 0xFFFFFFFF);
@@ -3247,10 +3159,7 @@ try_again:
else if(GetLastError() == ERROR_IO_PENDING) {
ret = GetOverlappedResult(file, &overlapped, (DWORD *)&len, TRUE);
}
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_reads--;
- MONITOR_DEC(MONITOR_OS_PENDING_READS);
- os_mutex_exit(os_file_count_mutex);
+ MONITOR_ATOMIC_DEC_LOW(MONITOR_OS_PENDING_READS, monitor);
if (ret && len == n) {
return(TRUE);
@@ -3344,13 +3253,10 @@ os_file_write_func(
ut_ad(buf);
ut_ad(n > 0);
-
+ const bool monitor = MONITOR_IS_ON(MONITOR_OS_PENDING_WRITES);
retry:
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_writes++;
- MONITOR_INC(MONITOR_OS_PENDING_WRITES);
- os_mutex_exit(os_file_count_mutex);
+ MONITOR_ATOMIC_INC_LOW(MONITOR_OS_PENDING_WRITES, monitor);
memset (&overlapped, 0, sizeof (overlapped));
overlapped.Offset = (DWORD)(offset & 0xFFFFFFFF);
@@ -3365,10 +3271,7 @@ retry:
ret = GetOverlappedResult(file, &overlapped, (DWORD *)&len, TRUE);
}
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_writes--;
- MONITOR_DEC(MONITOR_OS_PENDING_WRITES);
- os_mutex_exit(os_file_count_mutex);
+ MONITOR_ATOMIC_DEC_LOW(MONITOR_OS_PENDING_WRITES, monitor);
if (ret && len == n) {
@@ -4463,10 +4366,6 @@ os_aio_free(void)
}
}
-#if !defined(HAVE_ATOMIC_BUILTINS) || UNIV_WORD_SIZE < 8
- os_mutex_free(os_file_count_mutex);
-#endif /* !HAVE_ATOMIC_BUILTINS || UNIV_WORD_SIZE < 8 */
-
for (ulint i = 0; i < OS_FILE_N_SEEK_MUTEXES; i++) {
os_mutex_free(os_file_seek_mutexes[i]);
}
@@ -6192,19 +6091,24 @@ os_aio_print(
time_elapsed = 0.001 + difftime(current_time, os_last_printout);
fprintf(file,
- "Pending flushes (fsync) log: %lu; buffer pool: %lu\n"
- "%lu OS file reads, %lu OS file writes, %lu OS fsyncs\n",
- (ulong) fil_n_pending_log_flushes,
- (ulong) fil_n_pending_tablespace_flushes,
- (ulong) os_n_file_reads,
- (ulong) os_n_file_writes,
- (ulong) os_n_fsyncs);
-
- if (os_file_n_pending_preads != 0 || os_file_n_pending_pwrites != 0) {
+ "Pending flushes (fsync) log: " ULINTPF
+ "; buffer pool: " ULINTPF "\n"
+ ULINTPF " OS file reads, "
+ ULINTPF " OS file writes, "
+ ULINTPF " OS fsyncs\n",
+ fil_n_pending_log_flushes,
+ fil_n_pending_tablespace_flushes,
+ os_n_file_reads,
+ os_n_file_writes,
+ os_n_fsyncs);
+
+ const ulint n_reads = ulint(MONITOR_VALUE(MONITOR_OS_PENDING_READS));
+ const ulint n_writes = ulint(MONITOR_VALUE(MONITOR_OS_PENDING_WRITES));
+
+ if (n_reads != 0 || n_writes != 0) {
fprintf(file,
- "%lu pending preads, %lu pending pwrites\n",
- (ulong) os_file_n_pending_preads,
- (ulong) os_file_n_pending_pwrites);
+ ULINTPF " pending reads, " ULINTPF " pending writes\n",
+ n_reads, n_writes);
}
if (os_n_file_reads == os_n_file_reads_old) {
diff --git a/storage/xtradb/row/row0ftsort.cc b/storage/xtradb/row/row0ftsort.cc
index 29ddffd2587..4542aa31a6c 100644
--- a/storage/xtradb/row/row0ftsort.cc
+++ b/storage/xtradb/row/row0ftsort.cc
@@ -1320,10 +1320,9 @@ row_fts_build_sel_tree_level(
int child_left;
int child_right;
ulint i;
- ulint num_item;
+ ulint num_item = ulint(1) << level;
- start = static_cast<ulint>((1 << level) - 1);
- num_item = static_cast<ulint>(1 << level);
+ start = num_item - 1;
for (i = 0; i < num_item; i++) {
child_left = sel_tree[(start + i) * 2 + 1];
@@ -1392,7 +1391,7 @@ row_fts_build_sel_tree(
treelevel++;
}
- start = (1 << treelevel) - 1;
+ start = (ulint(1) << treelevel) - 1;
for (i = 0; i < (int) fts_sort_pll_degree; i++) {
sel_tree[i + start] = i;
diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc
index 6dc01907710..baa7bcbea09 100644
--- a/storage/xtradb/row/row0import.cc
+++ b/storage/xtradb/row/row0import.cc
@@ -583,8 +583,8 @@ AbstractCallback::init(
} else if (!is_compressed_table() && m_page_size != UNIV_PAGE_SIZE) {
ib_logf(IB_LOG_LEVEL_ERROR,
- "Page size %lu of ibd file is not the same "
- "as the server page size %lu",
+ "Page size " ULINTPF " of ibd file is not the same "
+ "as the server page size " ULINTPF,
m_page_size, UNIV_PAGE_SIZE);
return(DB_CORRUPTION);
@@ -593,8 +593,8 @@ AbstractCallback::init(
ib_logf(IB_LOG_LEVEL_ERROR,
"File size " UINT64PF " is not a multiple "
- "of the page size %lu",
- (ib_uint64_t) file_size, (ulong) m_page_size);
+ "of the page size " ULINTPF,
+ (ib_uint64_t) file_size, m_page_size);
return(DB_CORRUPTION);
}
@@ -695,8 +695,8 @@ FetchIndexRootPages::operator() (
if (block->page.offset * m_page_size != offset) {
ib_logf(IB_LOG_LEVEL_ERROR,
"Page offset doesn't match file offset: "
- "page offset: %lu, file offset: %lu",
- (ulint) block->page.offset,
+ "page offset: %u, file offset: " ULINTPF,
+ block->page.offset,
(ulint) (offset / m_page_size));
err = DB_CORRUPTION;
@@ -1134,10 +1134,9 @@ row_import::match_index_columns(
ib_errf(thd, IB_LOG_LEVEL_ERROR,
ER_TABLE_SCHEMA_MISMATCH,
- "Index field count %lu doesn't match"
- " tablespace metadata file value %lu",
- (ulong) index->n_fields,
- (ulong) cfg_index->m_n_fields);
+ "Index field count %u doesn't match"
+ " tablespace metadata file value " ULINTPF,
+ index->n_fields, cfg_index->m_n_fields);
return(DB_ERROR);
}
@@ -1154,34 +1153,31 @@ row_import::match_index_columns(
ER_TABLE_SCHEMA_MISMATCH,
"Index field name %s doesn't match"
" tablespace metadata field name %s"
- " for field position %lu",
- field->name, cfg_field->name, (ulong) i);
+ " for field position " ULINTPF,
+ field->name, cfg_field->name, i);
err = DB_ERROR;
}
if (cfg_field->prefix_len != field->prefix_len) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Index %s field %s prefix len %lu"
- " doesn't match metadata file value"
- " %lu",
- index->name, field->name,
- (ulong) field->prefix_len,
- (ulong) cfg_field->prefix_len);
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Index %s field %s prefix len %u"
+ " doesn't match metadata file value %u",
+ index->name, field->name,
+ field->prefix_len, cfg_field->prefix_len);
err = DB_ERROR;
}
if (cfg_field->fixed_len != field->fixed_len) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Index %s field %s fixed len %lu"
- " doesn't match metadata file value"
- " %lu",
- index->name, field->name,
- (ulong) field->fixed_len,
- (ulong) cfg_field->fixed_len);
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Index %s field %s fixed len %u"
+ " doesn't match metadata file value %u",
+ index->name, field->name,
+ field->fixed_len,
+ cfg_field->fixed_len);
err = DB_ERROR;
}
@@ -1223,12 +1219,11 @@ row_import::match_table_columns(
} else if (cfg_col_index != col->ind) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
- ER_TABLE_SCHEMA_MISMATCH,
- "Column %s ordinal value mismatch, it's at "
- "%lu in the table and %lu in the tablespace "
- "meta-data file",
- col_name,
- (ulong) col->ind, (ulong) cfg_col_index);
+ ER_TABLE_SCHEMA_MISMATCH,
+ "Column %s ordinal value mismatch, it's at %u"
+ " in the table and " ULINTPF
+ " in the tablespace meta-data file",
+ col_name, col->ind, cfg_col_index);
err = DB_ERROR;
} else {
@@ -1310,23 +1305,20 @@ row_import::match_schema(
THD* thd) UNIV_NOTHROW
{
/* Do some simple checks. */
- const unsigned relevant_flags = m_flags & ~DICT_TF_MASK_DATA_DIR;
- const unsigned relevant_table_flags
- = m_table->flags & ~DICT_TF_MASK_DATA_DIR;
- if (relevant_flags != relevant_table_flags) {
+ if ((m_table->flags ^ m_flags) & ~DICT_TF_MASK_DATA_DIR) {
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
- "Table flags don't match, server table has 0x%x "
- "and the meta-data file has 0x%x",
- relevant_table_flags, relevant_flags);
+ "Table flags don't match, server table has 0x%x"
+ " and the meta-data file has 0x%lx",
+ m_table->flags, ulong(m_flags));
return(DB_ERROR);
} else if (m_table->n_cols != m_n_cols) {
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
- "Number of columns don't match, table has %lu "
- "columns but the tablespace meta-data file has "
- "%lu columns",
- (ulong) m_table->n_cols, (ulong) m_n_cols);
+ "Number of columns don't match, table has %u "
+ "columns but the tablespace meta-data file has "
+ ULINTPF " columns",
+ m_table->n_cols, m_n_cols);
return(DB_ERROR);
} else if (UT_LIST_GET_LEN(m_table->indexes) != m_n_indexes) {
@@ -1336,11 +1328,10 @@ row_import::match_schema(
table matching the IMPORT definition. */
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
- "Number of indexes don't match, table has %lu "
- "indexes but the tablespace meta-data file has "
- "%lu indexes",
- (ulong) UT_LIST_GET_LEN(m_table->indexes),
- (ulong) m_n_indexes);
+ "Number of indexes don't match, table has " ULINTPF
+ " indexes but the tablespace meta-data file has "
+ ULINTPF " indexes",
+ UT_LIST_GET_LEN(m_table->indexes), m_n_indexes);
return(DB_ERROR);
}
@@ -1416,8 +1407,8 @@ row_import::set_root_by_heuristic() UNIV_NOTHROW
table_name, sizeof(table_name), m_table->name, FALSE);
ib_logf(IB_LOG_LEVEL_WARN,
- "Table %s should have %lu indexes but the tablespace "
- "has %lu indexes",
+ "Table %s should have " ULINTPF
+ " indexes but the tablespace has " ULINTPF " indexes",
table_name,
UT_LIST_GET_LEN(m_table->indexes),
m_n_indexes);
@@ -1655,9 +1646,10 @@ PageConverter::adjust_cluster_index_blob_column(
ib_errf(m_trx->mysql_thd, IB_LOG_LEVEL_ERROR,
ER_INNODB_INDEX_CORRUPT,
- "Externally stored column(%lu) has a reference "
- "length of %lu in the cluster index %s",
- (ulong) i, (ulong) len, index_name);
+ "Externally stored column(" ULINTPF
+ ") has a reference length of " ULINTPF
+ " in the cluster index %s",
+ i, len, index_name);
return(DB_CORRUPTION);
}
@@ -2021,7 +2013,8 @@ PageConverter::update_page(
return(err);
}
- ib_logf(IB_LOG_LEVEL_WARN, "Unknown page type (%lu)", page_type);
+ ib_logf(IB_LOG_LEVEL_WARN, "Unknown page type (" ULINTPF ")",
+ page_type);
return(DB_CORRUPTION);
}
@@ -2058,7 +2051,8 @@ PageConverter::validate(
if (checksum != 0) {
/* Checksum check passed in buf_page_is_corrupted(). */
ib_logf(IB_LOG_LEVEL_WARN,
- "%s: Page %lu checksum %lu should be zero.",
+ "%s: Page %lu checksum " ULINTPF
+ " should be zero.",
m_filepath, (ulong) (offset / m_page_size),
checksum);
}
@@ -2372,11 +2366,10 @@ row_import_adjust_root_pages_of_secondary_indexes(
ib_errf(trx->mysql_thd,
IB_LOG_LEVEL_WARN,
ER_INNODB_INDEX_CORRUPT,
- "Index '%s' contains %lu entries, "
- "should be %lu, you should recreate "
+ "Index '%s' contains " ULINTPF " entries, "
+ "should be " ULINTPF ", you should recreate "
"this index.", index_name,
- (ulong) purge.get_n_rows(),
- (ulong) n_rows_in_table);
+ purge.get_n_rows(), n_rows_in_table);
index->type |= DICT_CORRUPT;
@@ -2727,7 +2720,7 @@ row_import_read_index_data(
if (len > OS_FILE_MAX_PATH) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
ER_INNODB_INDEX_CORRUPT,
- "Index name length (%lu) is too long, "
+ "Index name length (" ULINTPF ") is too long, "
"the meta-data is corrupt", len);
return(DB_CORRUPTION);
@@ -2808,8 +2801,8 @@ row_import_read_indexes(
} else if (cfg->m_n_indexes > 1024) {
// FIXME: What is the upper limit? */
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_IO_READ_ERROR,
- "Number of indexes in meta-data file is too high: %lu",
- (ulong) cfg->m_n_indexes);
+ "Number of indexes in meta-data file is too high: "
+ ULINTPF, cfg->m_n_indexes);
cfg->m_n_indexes = 0;
return(DB_CORRUPTION);
@@ -2907,8 +2900,8 @@ row_import_read_columns(
if (len == 0 || len > 128) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
ER_IO_READ_ERROR,
- "Column name length %lu, is invalid",
- (ulong) len);
+ "Column name length " ULINTPF ", is invalid",
+ len);
return(DB_CORRUPTION);
}
@@ -3079,8 +3072,9 @@ row_import_read_v1(
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
"Tablespace to be imported has a different "
"page size than this server. Server page size "
- "is %lu, whereas tablespace page size is %lu",
- UNIV_PAGE_SIZE, (ulong) cfg->m_page_size);
+ "is " ULINTPF ", whereas tablespace page size is "
+ ULINTPF,
+ UNIV_PAGE_SIZE, cfg->m_page_size);
return(DB_ERROR);
}
@@ -3145,8 +3139,8 @@ row_import_read_meta_data(
return(row_import_read_v1(file, thd, &cfg));
default:
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_IO_READ_ERROR,
- "Unsupported meta-data version number (%lu), "
- "file ignored", (ulong) cfg.m_version);
+ "Unsupported meta-data version number (" ULINTPF "), "
+ "file ignored", cfg.m_version);
}
return(DB_ERROR);
diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc
index 72be305d481..24cd9687a47 100644
--- a/storage/xtradb/row/row0merge.cc
+++ b/storage/xtradb/row/row0merge.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2014, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -26,6 +26,7 @@ Completed by Sunny Bains and Marko Makela
*******************************************************/
#include <my_config.h>
#include <log.h>
+#include <sql_class.h>
#include "row0merge.h"
#include "row0ext.h"
@@ -188,7 +189,8 @@ row_merge_tuple_print(
}
ut_print_buf(f, dfield_get_data(field), len);
if (len != field_len) {
- fprintf(f, " (total %lu bytes)", field_len);
+ fprintf(f, " (total " ULINTPF " bytes)",
+ field_len);
}
}
}
@@ -881,9 +883,9 @@ row_merge_buf_write(
ut_ad(b < &block[srv_sort_buf_size]);
#ifdef UNIV_DEBUG
if (row_merge_print_write) {
- fprintf(stderr, "row_merge_buf_write %p,%d,%lu %lu",
- (void*) b, of->fd, (ulong) of->offset,
- (ulong) i);
+ fprintf(stderr, "row_merge_buf_write %p,%d,"
+ ULINTPF " " ULINTPF,
+ (void*) b, of->fd, of->offset, i);
row_merge_tuple_print(stderr, entry, n_fields);
}
#endif /* UNIV_DEBUG */
@@ -900,8 +902,8 @@ row_merge_buf_write(
#endif /* UNIV_DEBUG_VALGRIND */
#ifdef UNIV_DEBUG
if (row_merge_print_write) {
- fprintf(stderr, "row_merge_buf_write %p,%d,%lu EOF\n",
- (void*) b, of->fd, (ulong) of->offset);
+ fprintf(stderr, "row_merge_buf_write %p,%d," ULINTPF " EOF\n",
+ (void*) b, of->fd, of->offset);
}
#endif /* UNIV_DEBUG */
}
@@ -960,15 +962,8 @@ row_merge_read(
#ifdef UNIV_DEBUG
if (row_merge_print_block_read) {
- fprintf(stderr, "row_merge_read fd=%d ofs=%lu\n",
- fd, (ulong) offset);
- }
-#endif /* UNIV_DEBUG */
-
-#ifdef UNIV_DEBUG
- if (row_merge_print_block_read) {
- fprintf(stderr, "row_merge_read fd=%d ofs=%lu\n",
- fd, (ulong) offset);
+ fprintf(stderr, "row_merge_read fd=%d ofs=" ULINTPF "\n",
+ fd, offset);
}
#endif /* UNIV_DEBUG */
@@ -1032,8 +1027,8 @@ row_merge_write(
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
- fprintf(stderr, "row_merge_write fd=%d ofs=%lu\n",
- fd, (ulong) offset);
+ fprintf(stderr, "row_merge_write fd=%d ofs=" ULINTPF "\n",
+ fd, offset);
}
#endif /* UNIV_DEBUG */
@@ -1088,9 +1083,10 @@ row_merge_read_rec(
*mrec = NULL;
#ifdef UNIV_DEBUG
if (row_merge_print_read) {
- fprintf(stderr, "row_merge_read %p,%p,%d,%lu EOF\n",
+ fprintf(stderr, "row_merge_read %p,%p,%d," ULINTPF
+ " EOF\n",
(const void*) b, (const void*) block,
- fd, (ulong) *foffs);
+ fd, *foffs);
}
#endif /* UNIV_DEBUG */
return(NULL);
@@ -1208,9 +1204,9 @@ err_exit:
func_exit:
#ifdef UNIV_DEBUG
if (row_merge_print_read) {
- fprintf(stderr, "row_merge_read %p,%p,%d,%lu ",
+ fprintf(stderr, "row_merge_read %p,%p,%d," ULINTPF " ",
(const void*) b, (const void*) block,
- fd, (ulong) *foffs);
+ fd, *foffs);
rec_print_comp(stderr, *mrec, offsets);
putc('\n', stderr);
}
@@ -1244,8 +1240,8 @@ row_merge_write_rec_low(
ut_ad(e == rec_offs_extra_size(offsets) + 1);
if (row_merge_print_write) {
- fprintf(stderr, "row_merge_write %p,%d,%lu ",
- (void*) b, fd, (ulong) foffs);
+ fprintf(stderr, "row_merge_write %p,%d," ULINTPF " ",
+ (void*) b, fd, foffs);
rec_print_comp(stderr, mrec, offsets);
putc('\n', stderr);
}
@@ -1358,8 +1354,8 @@ row_merge_write_eof(
ut_ad(foffs);
#ifdef UNIV_DEBUG
if (row_merge_print_write) {
- fprintf(stderr, "row_merge_write %p,%p,%d,%lu EOF\n",
- (void*) b, (void*) block, fd, (ulong) *foffs);
+ fprintf(stderr, "row_merge_write %p,%p,%d," ULINTPF " EOF\n",
+ (void*) b, (void*) block, fd, *foffs);
}
#endif /* UNIV_DEBUG */
@@ -2258,11 +2254,12 @@ row_merge_blocks(
#ifdef UNIV_DEBUG
if (row_merge_print_block) {
fprintf(stderr,
- "row_merge_blocks fd=%d ofs=%lu + fd=%d ofs=%lu"
- " = fd=%d ofs=%lu\n",
- file->fd, (ulong) *foffs0,
- file->fd, (ulong) *foffs1,
- of->fd, (ulong) of->offset);
+ "row_merge_blocks fd=%d ofs=" ULINTPF
+ " + fd=%d ofs=" ULINTPF
+ " = fd=%d ofs=" ULINTPF "\n",
+ file->fd, *foffs0,
+ file->fd, *foffs1,
+ of->fd, of->offset);
}
#endif /* UNIV_DEBUG */
@@ -2373,10 +2370,10 @@ row_merge_blocks_copy(
#ifdef UNIV_DEBUG
if (row_merge_print_block) {
fprintf(stderr,
- "row_merge_blocks_copy fd=%d ofs=%lu"
- " = fd=%d ofs=%lu\n",
- file->fd, (ulong) foffs0,
- of->fd, (ulong) of->offset);
+ "row_merge_blocks_copy fd=%d ofs=" ULINTPF
+ " = fd=%d ofs=" ULINTPF "\n",
+ file->fd, *foffs0,
+ of->fd, of->offset);
}
#endif /* UNIV_DEBUG */
@@ -2635,7 +2632,11 @@ row_merge_sort(
thd_progress_init(trx->mysql_thd, 1);
}
- sql_print_information("InnoDB: Online DDL : merge-sorting has estimated %lu runs", num_runs);
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information("InnoDB: Online DDL : merge-sorting"
+ " has estimated " ULINTPF " runs",
+ num_runs);
+ }
/* Merge the runs until we have one big run */
do {
@@ -4060,9 +4061,11 @@ row_merge_build_indexes(
duplicate keys. */
innobase_rec_reset(table);
- sql_print_information("InnoDB: Online DDL : Start");
- sql_print_information("InnoDB: Online DDL : Start reading clustered "
- "index of the table and create temporary files");
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information("InnoDB: Online DDL : Start reading"
+ " clustered index of the table"
+ " and create temporary files");
+ }
pct_cost = COST_READ_CLUSTERED_INDEX * 100 / (total_static_cost + total_dynamic_cost);
@@ -4089,8 +4092,11 @@ row_merge_build_indexes(
pct_progress += pct_cost;
- sql_print_information("InnoDB: Online DDL : End of reading "
- "clustered index of the table and create temporary files");
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information("InnoDB: Online DDL : End of reading "
+ "clustered index of the table"
+ " and create temporary files");
+ }
for (i = 0; i < n_indexes; i++) {
total_index_blocks += merge_files[i].offset;
@@ -4186,8 +4192,7 @@ wait_again:
DEBUG_FTS_SORT_PRINT("FTS_SORT: Complete Insert\n");
#endif
} else if (merge_files[i].fd != -1) {
- char buf[3 * NAME_LEN];
- char *bufend;
+ char buf[NAME_LEN + 1];
row_merge_dup_t dup = {
sort_idx, table, col_map, 0};
@@ -4196,18 +4201,25 @@ wait_again:
total_index_blocks)) /
(total_static_cost + total_dynamic_cost)
* PCT_COST_MERGESORT_INDEX * 100;
-
- bufend = innobase_convert_name(
+ char* bufend = innobase_convert_name(
buf, sizeof buf,
- indexes[i]->name, strlen(indexes[i]->name),
+ indexes[i]->name,
+ strlen(indexes[i]->name),
trx->mysql_thd,
FALSE);
-
buf[bufend - buf]='\0';
- sql_print_information("InnoDB: Online DDL : Start merge-sorting"
- " index %s (%lu / %lu), estimated cost : %2.4f",
- buf, (i+1), n_indexes, pct_cost);
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information("InnoDB: Online DDL :"
+ " Start merge-sorting"
+ " index %s"
+ " (" ULINTPF
+ " / " ULINTPF "),"
+ " estimated cost :"
+ " %2.4f",
+ buf, i + 1, n_indexes,
+ pct_cost);
+ }
error = row_merge_sort(
trx, &dup, &merge_files[i],
@@ -4217,9 +4229,14 @@ wait_again:
pct_progress += pct_cost;
- sql_print_information("InnoDB: Online DDL : End of "
- " merge-sorting index %s (%lu / %lu)",
- buf, (i+1), n_indexes);
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information("InnoDB: Online DDL :"
+ " End of "
+ " merge-sorting index %s"
+ " (" ULINTPF
+ " / " ULINTPF ")",
+ buf, i + 1, n_indexes);
+ }
DBUG_EXECUTE_IF(
"ib_merge_wait_after_sort",
@@ -4232,10 +4249,15 @@ wait_again:
(total_static_cost + total_dynamic_cost) *
PCT_COST_INSERT_INDEX * 100;
- sql_print_information("InnoDB: Online DDL : Start "
- "building index %s (%lu / %lu), estimated "
- "cost : %2.4f", buf, (i+1),
- n_indexes, pct_cost);
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information(
+ "InnoDB: Online DDL : Start "
+ "building index %s"
+ " (" ULINTPF
+ " / " ULINTPF "), estimated "
+ "cost : %2.4f", buf, i + 1,
+ n_indexes, pct_cost);
+ }
error = row_merge_insert_index_tuples(
trx->id, sort_idx, old_table,
@@ -4244,9 +4266,13 @@ wait_again:
crypt_data, crypt_block, new_table->space);
pct_progress += pct_cost;
- sql_print_information("InnoDB: Online DDL : "
- "End of building index %s (%lu / %lu)",
- buf, (i+1), n_indexes);
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information(
+ "InnoDB: Online DDL : "
+ "End of building index %s"
+ " (" ULINTPF " / " ULINTPF ")",
+ buf, i + 1, n_indexes);
+ }
}
}
@@ -4263,15 +4289,16 @@ wait_again:
ut_ad(sort_idx->online_status
== ONLINE_INDEX_COMPLETE);
} else {
- sql_print_information("InnoDB: Online DDL : Start applying row log");
+ if (global_system_variables.log_warnings > 2) {
+ sql_print_information(
+ "InnoDB: Online DDL : Applying"
+ " log to index");
+ }
DEBUG_SYNC_C("row_log_apply_before");
error = row_log_apply(trx, sort_idx, table);
DEBUG_SYNC_C("row_log_apply_after");
- sql_print_information("InnoDB: Online DDL : End of applying row log");
}
- sql_print_information("InnoDB: Online DDL : Completed");
-
if (error != DB_SUCCESS) {
trx->error_key_num = key_numbers[i];
goto func_exit;
diff --git a/storage/xtradb/srv/srv0mon.cc b/storage/xtradb/srv/srv0mon.cc
index 7c2e549e188..47abae66192 100644
--- a/storage/xtradb/srv/srv0mon.cc
+++ b/storage/xtradb/srv/srv0mon.cc
@@ -2,7 +2,7 @@
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2016, MariaDB Corporation.
+Copyright (c) 2013, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -690,11 +690,11 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_DEFAULT_START, MONITOR_OVLD_OS_FSYNC},
{"os_pending_reads", "os", "Number of reads pending",
- MONITOR_NONE,
+ MONITOR_DEFAULT_ON,
MONITOR_DEFAULT_START, MONITOR_OS_PENDING_READS},
{"os_pending_writes", "os", "Number of writes pending",
- MONITOR_NONE,
+ MONITOR_DEFAULT_ON,
MONITOR_DEFAULT_START, MONITOR_OS_PENDING_WRITES},
{"os_log_bytes_written", "os",
diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc
index f8c8c330f0c..1c40baee04b 100644
--- a/storage/xtradb/srv/srv0srv.cc
+++ b/storage/xtradb/srv/srv0srv.cc
@@ -1814,10 +1814,10 @@ srv_export_innodb_status(void)
mutex_enter(&srv_innodb_monitor_mutex);
export_vars.innodb_data_pending_reads =
- os_n_pending_reads;
+ ulint(MONITOR_VALUE(MONITOR_OS_PENDING_READS));
export_vars.innodb_data_pending_writes =
- os_n_pending_writes;
+ ulint(MONITOR_VALUE(MONITOR_OS_PENDING_WRITES));
export_vars.innodb_data_pending_fsyncs =
fil_n_pending_log_flushes
diff --git a/storage/xtradb/sync/sync0arr.cc b/storage/xtradb/sync/sync0arr.cc
index c311d2cbd7d..134d16ae58e 100644
--- a/storage/xtradb/sync/sync0arr.cc
+++ b/storage/xtradb/sync/sync0arr.cc
@@ -522,13 +522,14 @@ sync_array_cell_print(
if (mutex) {
fprintf(file,
"Mutex at %p '%s', lock var %lu\n"
- "Last time reserved by thread %lu in file %s line %lu, "
- "waiters flag %lu\n",
+ "Last time reserved by thread " ULINTPF
+ " in file %s line " ULINTPF ", "
+ "waiters flag " ULINTPF "\n",
(void*) mutex, mutex->cmutex_name,
(ulong) mutex->lock_word,
- mutex->thread_id,
- mutex->file_name, (ulong) mutex->line,
- (ulong) mutex->waiters);
+ os_thread_pf(mutex->thread_id),
+ mutex->file_name, mutex->line,
+ mutex->waiters);
}
/* If stacktrace feature is enabled we will send a SIGUSR2
@@ -582,9 +583,9 @@ sync_array_cell_print(
if (writer && writer != RW_LOCK_NOT_LOCKED) {
fprintf(file,
- "a writer (thread id %lu) has"
+ "a writer (thread id " ULINTPF ") has"
" reserved it in mode %s",
- (ulong) os_thread_pf(rwlock->writer_thread),
+ os_thread_pf(rwlock->writer_thread),
writer == RW_LOCK_EX
? " exclusive\n"
: " wait exclusive\n");
@@ -593,21 +594,23 @@ sync_array_cell_print(
}
fprintf(file,
- "number of readers %lu, waiters flag %lu, "
+ "number of readers " ULINTPF
+ ", waiters flag " ULINTPF ", "
"lock_word: %lx\n"
- "Last time read locked in file %s line %lu\n"
- "Last time write locked in file %s line %lu\n",
- (ulong) rw_lock_get_reader_count(rwlock),
- (ulong) rwlock->waiters,
+ "Last time read locked in file %s line %u\n"
+ "Last time write locked in file %s line %u\n"
+ "Holder thread " ULINTPF
+ " file %s line " ULINTPF "\n",
+ rw_lock_get_reader_count(rwlock),
+ rwlock->waiters,
rwlock->lock_word,
innobase_basename(rwlock->last_s_file_name),
- (ulong) rwlock->last_s_line,
- rwlock->last_x_file_name,
- (ulong) rwlock->last_x_line);
-
- fprintf(file,
- "Holder thread %lu file %s line %lu\n",
- rwlock->thread_id, rwlock->file_name, rwlock->line);
+ rwlock->last_s_line,
+ innobase_basename(rwlock->last_x_file_name),
+ rwlock->last_x_line,
+ os_thread_pf(rwlock->thread_id),
+ innobase_basename(rwlock->file_name),
+ rwlock->line);
/* If stacktrace feature is enabled we will send a SIGUSR2
signal to thread that has locked RW-latch with write mode.
@@ -1175,9 +1178,10 @@ sync_array_print_long_waits(
now the values of pending calls of these. */
fprintf(stderr,
- "InnoDB: Pending preads %lu, pwrites %lu\n",
- (ulong) os_file_n_pending_preads,
- (ulong) os_file_n_pending_pwrites);
+ "InnoDB: Pending reads " UINT64PF
+ ", writes " UINT64PF "\n",
+ MONITOR_VALUE(MONITOR_OS_PENDING_READS),
+ MONITOR_VALUE(MONITOR_OS_PENDING_WRITES));
srv_print_innodb_monitor = TRUE;
os_event_set(srv_monitor_event);
diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc
index 439897a5b96..92d7525ea84 100644
--- a/storage/xtradb/trx/trx0trx.cc
+++ b/storage/xtradb/trx/trx0trx.cc
@@ -2161,6 +2161,118 @@ trx_print_latched(
mem_heap_get_size(trx->lock.lock_heap));
}
+#ifdef WITH_WSREP
+/**********************************************************************//**
+Prints info about a transaction.
+Transaction information may be retrieved without having trx_sys->mutex acquired
+so it may not be completely accurate. The caller must own lock_sys->mutex
+and the trx must have some locks to make sure that it does not escape
+without locking lock_sys->mutex. */
+UNIV_INTERN
+void
+wsrep_trx_print_locking(
+/*==========*/
+ FILE* f,
+ /*!< in: output stream */
+ const trx_t* trx,
+ /*!< in: transaction */
+ ulint max_query_len)
+ /*!< in: max query length to print,
+ or 0 to use the default max length */
+{
+ ibool newline;
+ const char* op_info;
+
+ ut_ad(lock_mutex_own());
+ ut_ad(trx->lock.trx_locks.count > 0);
+
+ fprintf(f, "TRANSACTION " TRX_ID_FMT, trx->id);
+
+ /* trx->state may change since trx_sys->mutex is not required */
+ switch (trx->state) {
+ case TRX_STATE_NOT_STARTED:
+ fputs(", not started", f);
+ goto state_ok;
+ case TRX_STATE_ACTIVE:
+ fprintf(f, ", ACTIVE %lu sec",
+ (ulong) difftime(time(NULL), trx->start_time));
+ goto state_ok;
+ case TRX_STATE_PREPARED:
+ fprintf(f, ", ACTIVE (PREPARED) %lu sec",
+ (ulong) difftime(time(NULL), trx->start_time));
+ goto state_ok;
+ case TRX_STATE_COMMITTED_IN_MEMORY:
+ fputs(", COMMITTED IN MEMORY", f);
+ goto state_ok;
+ }
+ fprintf(f, ", state %lu", (ulong) trx->state);
+ ut_ad(0);
+state_ok:
+
+ /* prevent a race condition */
+ op_info = trx->op_info;
+
+ if (*op_info) {
+ putc(' ', f);
+ fputs(op_info, f);
+ }
+
+ if (trx->is_recovered) {
+ fputs(" recovered trx", f);
+ }
+
+ if (trx->declared_to_be_inside_innodb) {
+ fprintf(f, ", thread declared inside InnoDB %lu",
+ (ulong) trx->n_tickets_to_enter_innodb);
+ }
+
+ putc('\n', f);
+
+ if (trx->n_mysql_tables_in_use > 0 || trx->mysql_n_tables_locked > 0) {
+ fprintf(f, "mysql tables in use %lu, locked %lu\n",
+ (ulong) trx->n_mysql_tables_in_use,
+ (ulong) trx->mysql_n_tables_locked);
+ }
+
+ newline = TRUE;
+
+ /* trx->lock.que_state of an ACTIVE transaction may change
+ while we are not holding trx->mutex. We perform a dirty read
+ for performance reasons. */
+
+ switch (trx->lock.que_state) {
+ case TRX_QUE_RUNNING:
+ newline = FALSE; break;
+ case TRX_QUE_LOCK_WAIT:
+ fputs("LOCK WAIT ", f); break;
+ case TRX_QUE_ROLLING_BACK:
+ fputs("ROLLING BACK ", f); break;
+ case TRX_QUE_COMMITTING:
+ fputs("COMMITTING ", f); break;
+ default:
+ fprintf(f, "que state %lu ", (ulong) trx->lock.que_state);
+ }
+
+ if (trx->has_search_latch) {
+ newline = TRUE;
+ fputs(", holds adaptive hash latch", f);
+ }
+
+ if (trx->undo_no != 0) {
+ newline = TRUE;
+ fprintf(f, ", undo log entries " TRX_ID_FMT, trx->undo_no);
+ }
+
+ if (newline) {
+ putc('\n', f);
+ }
+
+ if (trx->mysql_thd != NULL) {
+ innobase_mysql_print_thd(
+ f, trx->mysql_thd, static_cast<uint>(max_query_len));
+ }
+}
+#endif /* WITH_WSREP */
/**********************************************************************//**
Prints info about a transaction.
Acquires and releases lock_sys->mutex and trx_sys->mutex. */
diff --git a/strings/json_lib.c b/strings/json_lib.c
index 5eda81d96c5..0e2a17b0ae0 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -1248,6 +1248,7 @@ static int handle_match(json_engine_t *je, json_path_t *p,
if (++next_step > p->last_step)
{
je->s.c_str= je->value_begin;
+ je->stack_p--;
return 1;
}
} while (next_step->type == JSON_PATH_ARRAY && next_step->n_item == 0);