summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc90
-rw-r--r--cmake/ssl.cmake7
-rw-r--r--debian/compat2
-rw-r--r--include/my_global.h7
-rw-r--r--include/my_sys.h2
-rw-r--r--include/service_versions.h2
-rw-r--r--libmysql/libmysql.c5
-rw-r--r--mysql-test/include/wait_for_slave_sql_error_and_skip.inc7
-rwxr-xr-xmysql-test/mysql-test-run.pl6
-rw-r--r--mysql-test/r/binary_to_hex.result117
-rw-r--r--mysql-test/r/count_distinct.result12
-rw-r--r--mysql-test/r/func_regexp_pcre.result32
-rw-r--r--mysql-test/r/gis-rt-precise.result22
-rw-r--r--mysql-test/r/gis.result8
-rw-r--r--mysql-test/r/group_by.result27
-rw-r--r--mysql-test/r/loadxml.result16
-rw-r--r--mysql-test/r/mysql_upgrade.result25
-rw-r--r--mysql-test/r/read_only.result2
-rw-r--r--mysql-test/r/subselect.result15
-rw-r--r--mysql-test/r/subselect_no_exists_to_in.result15
-rw-r--r--mysql-test/r/subselect_no_mat.result15
-rw-r--r--mysql-test/r/subselect_no_opts.result15
-rw-r--r--mysql-test/r/subselect_no_scache.result15
-rw-r--r--mysql-test/r/subselect_no_semijoin.result15
-rw-r--r--mysql-test/r/subselect_nulls.result6
-rw-r--r--mysql-test/r/union.result18
-rw-r--r--mysql-test/r/view.result14
-rw-r--r--mysql-test/std_data/loadxml.dat8
-rw-r--r--mysql-test/suite/archive/archive_gis.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_unsafe.result22
-rw-r--r--mysql-test/suite/binlog/t/binlog_unsafe.test22
-rw-r--r--mysql-test/suite/innodb/r/innodb_gis.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_reset_slave_fail.result29
-rw-r--r--mysql-test/suite/rpl/t/rpl_reset_slave_fail.test91
-rw-r--r--mysql-test/suite/storage_engine/type_spatial.result4
-rw-r--r--mysql-test/suite/storage_engine/type_spatial_indexes.result8
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff111
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff70
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff46
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result2
-rw-r--r--mysql-test/t/alter_table_online.test4
-rw-r--r--mysql-test/t/binary_to_hex.test76
-rw-r--r--mysql-test/t/count_distinct.test16
-rw-r--r--mysql-test/t/func_regexp_pcre.test19
-rw-r--r--mysql-test/t/gis-rt-precise.test22
-rw-r--r--mysql-test/t/gis.test10
-rw-r--r--mysql-test/t/group_by.test38
-rw-r--r--mysql-test/t/mysql_upgrade.test28
-rw-r--r--mysql-test/t/read_only.test3
-rw-r--r--mysql-test/t/subselect.test17
-rw-r--r--mysql-test/t/subselect_nulls.test6
-rw-r--r--mysql-test/t/union.test14
-rw-r--r--mysql-test/t/view.test16
-rw-r--r--mysys/my_fopen.c2
-rw-r--r--mysys/stacktrace.c2
-rw-r--r--pcre/ChangeLog47
-rw-r--r--pcre/NEWS6
-rw-r--r--pcre/configure.ac12
-rw-r--r--pcre/doc/html/pcrejit.html57
-rw-r--r--pcre/doc/html/pcretest.html9
-rw-r--r--pcre/doc/pcre.txt49
-rw-r--r--pcre/doc/pcrejit.354
-rw-r--r--pcre/doc/pcretest.110
-rw-r--r--pcre/doc/pcretest.txt8
-rw-r--r--pcre/pcre_compile.c16
-rw-r--r--pcre/pcre_dfa_exec.c4
-rw-r--r--pcre/pcre_exec.c2
-rw-r--r--pcre/pcre_internal.h11
-rw-r--r--pcre/pcre_jit_compile.c958
-rw-r--r--pcre/pcre_scanner_unittest.cc1
-rw-r--r--pcre/pcre_stringpiece.h.in4
-rw-r--r--pcre/pcre_stringpiece_unittest.cc1
-rw-r--r--pcre/pcre_tables.c4
-rw-r--r--pcre/pcre_ucd.c14
-rw-r--r--pcre/pcrecpp_unittest.cc1
-rw-r--r--pcre/pcregrep.c29
-rw-r--r--pcre/pcreposix.c6
-rw-r--r--pcre/pcretest.c17
-rw-r--r--pcre/testdata/testinput13
-rw-r--r--pcre/testdata/testinput122
-rw-r--r--pcre/testdata/testinput153
-rw-r--r--pcre/testdata/testinput83
-rw-r--r--pcre/testdata/testoutput14
-rw-r--r--pcre/testdata/testoutput122
-rw-r--r--pcre/testdata/testoutput155
-rw-r--r--pcre/testdata/testoutput84
-rw-r--r--plugin/semisync/semisync_master.cc6
-rw-r--r--scripts/CMakeLists.txt11
-rw-r--r--[-rwxr-xr-x]scripts/dheadgen.pl8
-rw-r--r--scripts/mysql_config.pl.in4
-rw-r--r--scripts/mysql_convert_table_format.sh5
-rw-r--r--scripts/mysql_find_rows.sh5
-rw-r--r--scripts/mysql_fix_extensions.sh5
-rw-r--r--scripts/mysql_install_db.pl.in4
-rw-r--r--scripts/mysql_secure_installation.pl.in7
-rw-r--r--scripts/mysql_setpermission.sh5
-rw-r--r--scripts/mysql_system_tables_fix.sql9
-rw-r--r--scripts/mysql_zap.sh5
-rw-r--r--scripts/mysqlaccess.sh19
-rw-r--r--scripts/mysqld_multi.sh22
-rw-r--r--scripts/mysqldumpslow.sh5
-rw-r--r--scripts/mysqlhotcopy.sh4
-rw-r--r--sql-common/client.c1
-rw-r--r--sql/item.cc6
-rw-r--r--sql/item_cmpfunc.cc15
-rw-r--r--sql/item_cmpfunc.h2
-rw-r--r--sql/item_strfunc.cc14
-rw-r--r--sql/item_strfunc.h2
-rw-r--r--sql/item_subselect.cc6
-rw-r--r--sql/log.cc2
-rw-r--r--sql/multi_range_read.cc22
-rw-r--r--sql/mysqld.cc10
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/opt_range.cc9
-rw-r--r--sql/records.cc1
-rw-r--r--sql/rpl_handler.cc2
-rw-r--r--sql/rpl_mi.cc6
-rw-r--r--sql/rpl_rli.cc64
-rw-r--r--sql/rpl_rli.h12
-rw-r--r--sql/slave.cc7
-rw-r--r--sql/spatial.cc27
-rw-r--r--sql/sql_class.cc10
-rw-r--r--sql/sql_derived.cc2
-rw-r--r--sql/sql_load.cc2
-rw-r--r--sql/sql_parse.cc27
-rw-r--r--sql/sql_repl.cc5
-rw-r--r--sql/sql_union.cc18
-rw-r--r--sql/uniques.cc16
-rw-r--r--storage/connect/array.cpp12
-rw-r--r--storage/connect/blkfil.cpp10
-rw-r--r--storage/connect/colblk.cpp10
-rw-r--r--storage/connect/connect.cc11
-rw-r--r--storage/connect/connect.h3
-rw-r--r--storage/connect/engmsg.h1
-rw-r--r--storage/connect/filter.cpp14
-rw-r--r--storage/connect/global.h4
-rw-r--r--storage/connect/ha_connect.cc166
-rw-r--r--storage/connect/ha_connect.h3
-rw-r--r--storage/connect/jdbconn.cpp143
-rw-r--r--storage/connect/json.cpp139
-rw-r--r--storage/connect/json.h36
-rw-r--r--storage/connect/jsonudf.cpp61
-rw-r--r--storage/connect/msgid.h1
-rw-r--r--storage/connect/mycat.cc2
-rw-r--r--storage/connect/mycat.h4
-rw-r--r--storage/connect/mysql-test/connect/r/json_udf.result2
-rw-r--r--storage/connect/os.h1
-rw-r--r--storage/connect/osutil.c1
-rw-r--r--storage/connect/osutil.h1
-rw-r--r--storage/connect/plgdbsem.h2
-rw-r--r--storage/connect/plgdbutl.cpp22
-rw-r--r--storage/connect/plugutil.cpp102
-rw-r--r--storage/connect/tabcol.cpp8
-rw-r--r--storage/connect/tabdos.cpp178
-rw-r--r--storage/connect/tabjson.cpp32
-rw-r--r--storage/connect/table.cpp2
-rw-r--r--storage/connect/tabodbc.cpp4
-rw-r--r--storage/connect/tabodbc.h2
-rw-r--r--storage/connect/tabvir.cpp2
-rw-r--r--storage/connect/tabxml.cpp40
-rw-r--r--storage/connect/user_connect.cc37
-rw-r--r--storage/connect/user_connect.h5
-rw-r--r--storage/connect/value.cpp71
-rw-r--r--storage/connect/value.h4
-rwxr-xr-xstorage/connect/xindex.cpp20
-rw-r--r--storage/connect/xobject.cpp10
-rw-r--r--storage/federated/ha_federated.cc2
-rw-r--r--storage/federatedx/ha_federatedx.cc2
-rw-r--r--storage/heap/hp_extra.c1
-rw-r--r--storage/innobase/api/api0api.cc21
-rw-r--r--storage/innobase/dict/dict0crea.cc1
-rw-r--r--storage/innobase/dict/dict0dict.cc57
-rw-r--r--storage/innobase/handler/ha_innodb.cc21
-rw-r--r--storage/innobase/handler/ha_innodb.h6
-rw-r--r--storage/innobase/include/dict0dict.h10
-rw-r--r--storage/innobase/include/row0mysql.h7
-rw-r--r--storage/innobase/include/row0sel.h14
-rw-r--r--storage/innobase/include/univ.i2
-rw-r--r--storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff4
-rw-r--r--storage/innobase/row/row0merge.cc6
-rw-r--r--storage/innobase/row/row0sel.cc85
-rw-r--r--storage/innobase/srv/srv0srv.cc2
-rw-r--r--storage/maria/ma_check.c4
-rw-r--r--storage/maria/ma_key_recover.c1
-rw-r--r--storage/maria/ma_recovery.c4
-rw-r--r--storage/myisam/mi_check.c4
-rw-r--r--storage/myisam/mysql-test/storage_engine/parts/disabled.def0
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff4
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff8
-rw-r--r--storage/tokudb/CMakeLists.txt2
-rw-r--r--storage/tokudb/PerconaFT/CMakeLists.txt10
-rw-r--r--storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake3
-rw-r--r--storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc9
-rw-r--r--storage/tokudb/PerconaFT/ft/cachetable/cachetable.h3
-rw-r--r--storage/tokudb/PerconaFT/ft/ft-ops.cc97
-rw-r--r--storage/tokudb/PerconaFT/ft/ft.cc3
-rw-r--r--storage/tokudb/PerconaFT/ft/node.cc19
-rw-r--r--storage/tokudb/PerconaFT/ft/node.h20
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc43
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/ft-serialize.h23
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc689
-rw-r--r--storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.h69
-rw-r--r--storage/tokudb/PerconaFT/ft/txn/roll.cc2
-rw-r--r--storage/tokudb/PerconaFT/ft/txn/txn.cc4
-rw-r--r--storage/tokudb/PerconaFT/locktree/lock_request.cc110
-rw-r--r--storage/tokudb/PerconaFT/locktree/lock_request.h13
-rw-r--r--storage/tokudb/PerconaFT/locktree/locktree.cc36
-rw-r--r--storage/tokudb/PerconaFT/locktree/locktree.h27
-rw-r--r--storage/tokudb/PerconaFT/locktree/tests/lock_request_start_release_wait.cc148
-rw-r--r--storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race.cc92
-rw-r--r--storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race_3.cc122
-rw-r--r--storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_wait_race_2.cc123
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_debug_sync.h77
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_portability.h3
-rw-r--r--storage/tokudb/PerconaFT/src/tests/test_iterate_live_transactions.cc6
-rw-r--r--storage/tokudb/PerconaFT/src/tests/transactional_fileops.cc9
-rw-r--r--storage/tokudb/PerconaFT/src/ydb.cc33
-rw-r--r--storage/tokudb/PerconaFT/src/ydb_row_lock.cc24
-rw-r--r--storage/tokudb/PerconaFT/tools/CMakeLists.txt8
-rw-r--r--storage/tokudb/PerconaFT/tools/ftverify.cc2
-rw-r--r--storage/tokudb/PerconaFT/tools/tokuftdump.cc3
-rw-r--r--storage/tokudb/ha_tokudb.cc124
-rw-r--r--storage/tokudb/ha_tokudb.h41
-rw-r--r--storage/tokudb/hatoku_hton.cc7
-rw-r--r--storage/tokudb/mysql-test/rpl/include/rpl_tokudb_row_img_general_loop.inc42
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_update_pk_uc0_lookup0.result6
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_write_pk.result1
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_rfr_disable_on_expl_pk_absence.result (renamed from storage/tokudb/mysql-test/tokudb_rpl/r/rpl_rfr_disable_on_expl_pk_absence.result)0
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_commit_after_flush.result10
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_insert_id.result530
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_insert_id_pk.result74
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update.result25
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update2.result53
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update3.result195
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_rfr_partition_table.result (renamed from storage/tokudb/mysql-test/tokudb_rpl/r/rpl_tokudb_rfr_partition_table.result)0
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_crash_safe.result2183
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_blobs.result4739
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_full.result3681
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_min.result3522
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_noblob.result3522
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_full.result3505
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_min.result3530
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_noblob.result3530
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_log.result293
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_lower_case_table_names.result51
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_sp003.result54
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_sp006.result41
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_trig004.result27
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_log.result292
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_mixed_crash_safe.result1773
-rw-r--r--storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_mixed_lower_case_table_names.result48
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_not_null_tokudb.test2
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_delete_pk-slave.opt7
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_update_pk_uc0_lookup0-slave.opt6
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_update_pk_uc0_lookup0.test7
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_write_pk-slave.opt5
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_write_pk.test4
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_rfr_disable_on_expl_pk_absence-slave.opt (renamed from storage/tokudb/mysql-test/tokudb_rpl/t/rpl_rfr_disable_on_expl_pk_absence-slave.opt)0
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_rfr_disable_on_expl_pk_absence.test (renamed from storage/tokudb/mysql-test/tokudb_rpl/t/rpl_rfr_disable_on_expl_pk_absence.test)0
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_row_basic_3tokudb.test12
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_stm_tokudb.test1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_commit_after_flush.test5
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id-master.opt0
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id-slave.opt0
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id.test6
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id_pk.test6
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update.test3
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update2-slave.opt1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update2.test12
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update3.test12
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_rfr_partition_table-slave.opt (renamed from storage/tokudb/mysql-test/tokudb_rpl/t/rpl_tokudb_rfr_partition_table-slave.opt)0
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_rfr_partition_table.test (renamed from storage/tokudb/mysql-test/tokudb_rpl/t/rpl_tokudb_rfr_partition_table.test)2
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe-master.opt1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe-slave.opt1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe.test19
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_blobs.test54
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_full.test51
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_min.test43
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_noblob.test43
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_full.test39
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_min.test42
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_noblob.test42
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_log-master.opt2
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_log.test14
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_lower_case_table_names-slave.opt1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_lower_case_table_names.test15
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_sp003.test13
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_sp006.test13
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_trig004.test18
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_log-master.opt2
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_log.test14
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe-master.opt1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe-slave.opt1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe.test18
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_lower_case_table_names-slave.opt1
-rw-r--r--storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_lower_case_table_names.test14
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/kill_query_blocked_in_lt.result26
-rw-r--r--storage/tokudb/mysql-test/tokudb/r/locks-select-update-3.result6
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/kill_query_blocked_in_lt.test57
-rw-r--r--storage/tokudb/mysql-test/tokudb/t/locks-select-update-3.test11
-rw-r--r--storage/tokudb/mysql-test/tokudb_backup/r/rpl_safe_slave.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb_backup/t/rpl_safe_slave.inc3
-rw-r--r--storage/tokudb/mysql-test/tokudb_mariadb/r/mdev12972.result19
-rw-r--r--storage/tokudb/mysql-test/tokudb_mariadb/t/mdev12972.test26
-rw-r--r--storage/tokudb/tokudb_information_schema.cc6
-rw-r--r--storage/xtradb/buf/buf0flu.cc16
-rw-r--r--storage/xtradb/dict/dict0dict.cc57
-rw-r--r--storage/xtradb/handler/xtradb_i_s.cc5
-rw-r--r--storage/xtradb/include/dict0dict.h10
-rw-r--r--storage/xtradb/include/univ.i2
-rw-r--r--storage/xtradb/log/log0log.cc2
-rw-r--r--storage/xtradb/mysql-test/storage_engine/type_spatial_indexes.rdiff4
-rw-r--r--storage/xtradb/srv/srv0srv.cc10
313 files changed, 36827 insertions, 2122 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 28d781aff8b..1c344c7e54c 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -149,7 +149,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
default_pager_set= 0, opt_sigint_ignore= 0,
auto_vertical_output= 0,
show_warnings= 0, executing_query= 0,
- ignore_spaces= 0, opt_progress_reports;
+ ignore_spaces= 0, opt_binhex= 0, opt_progress_reports;
static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error;
static my_bool column_types_flag;
static my_bool preserve_comments= 0;
@@ -1492,6 +1492,8 @@ static struct my_option my_long_options[] =
{"batch", 'B',
"Don't use history file. Disable interactive behavior. (Enables --silent.)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"binary-as-hex", 'b', "Print binary data as hex", &opt_binhex, &opt_binhex,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", &charsets_dir,
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -3314,7 +3316,8 @@ com_go(String *buffer,char *line __attribute__((unused)))
print_table_data_html(result);
else if (opt_xml)
print_table_data_xml(result);
- else if (vertical || (auto_vertical_output && (terminal_width < get_result_width(result))))
+ else if (vertical || (auto_vertical_output &&
+ (terminal_width < get_result_width(result))))
print_table_data_vertically(result);
else if (opt_silent && verbose <= 2 && !output_tables)
print_tab_data(result);
@@ -3533,6 +3536,41 @@ print_field_types(MYSQL_RES *result)
}
+/* Used to determine if we should invoke print_as_hex for this field */
+
+static bool
+is_binary_field(MYSQL_FIELD *field)
+{
+ if ((field->charsetnr == 63) &&
+ (field->type == MYSQL_TYPE_BIT ||
+ field->type == MYSQL_TYPE_BLOB ||
+ field->type == MYSQL_TYPE_LONG_BLOB ||
+ field->type == MYSQL_TYPE_MEDIUM_BLOB ||
+ field->type == MYSQL_TYPE_TINY_BLOB ||
+ field->type == MYSQL_TYPE_VAR_STRING ||
+ field->type == MYSQL_TYPE_STRING ||
+ field->type == MYSQL_TYPE_VARCHAR ||
+ field->type == MYSQL_TYPE_GEOMETRY))
+ return 1;
+ return 0;
+}
+
+
+/* Print binary value as hex literal (0x ...) */
+
+static void
+print_as_hex(FILE *output_file, const char *str, ulong len, ulong total_bytes_to_send)
+{
+ const char *ptr= str, *end= ptr+len;
+ ulong i;
+ fprintf(output_file, "0x");
+ for(; ptr < end; ptr++)
+ fprintf(output_file, "%02X", *((uchar*)ptr));
+ for (i= 2*len+2; i < total_bytes_to_send; i++)
+ tee_putc((int)' ', output_file);
+}
+
+
static void
print_table_data(MYSQL_RES *result)
{
@@ -3559,6 +3597,8 @@ print_table_data(MYSQL_RES *result)
length= MY_MAX(length,field->max_length);
if (length < 4 && !IS_NOT_NULL(field->flags))
length=4; // Room for "NULL"
+ if (opt_binhex && is_binary_field(field))
+ length= 2 + length * 2;
field->max_length=length;
num_flag[mysql_field_tell(result) - 1]= IS_NUM(field->type);
separator.fill(separator.length()+length+2,'-');
@@ -3626,9 +3666,11 @@ print_table_data(MYSQL_RES *result)
many extra padding-characters we should send with the printing function.
*/
visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
- extra_padding= data_length - visible_length;
+ extra_padding= (uint) (data_length - visible_length);
- if (field_max_length > MAX_COLUMN_LENGTH)
+ if (opt_binhex && is_binary_field(field))
+ print_as_hex(PAGER, cur[off], lengths[off], field_max_length);
+ else if (field_max_length > MAX_COLUMN_LENGTH)
tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE);
else
{
@@ -3762,11 +3804,15 @@ print_table_data_html(MYSQL_RES *result)
if (interrupted_query)
break;
ulong *lengths=mysql_fetch_lengths(result);
+ field= mysql_fetch_fields(result);
(void) tee_fputs("<TR>", PAGER);
for (uint i=0; i < mysql_num_fields(result); i++)
{
(void) tee_fputs("<TD>", PAGER);
- xmlencode_print(cur[i], lengths[i]);
+ if (opt_binhex && is_binary_field(&field[i]))
+ print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
+ else
+ xmlencode_print(cur[i], lengths[i]);
(void) tee_fputs("</TD>", PAGER);
}
(void) tee_fputs("</TR>", PAGER);
@@ -3802,7 +3848,10 @@ print_table_data_xml(MYSQL_RES *result)
if (cur[i])
{
tee_fprintf(PAGER, "\">");
- xmlencode_print(cur[i], lengths[i]);
+ if (opt_binhex && is_binary_field(&fields[i]))
+ print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
+ else
+ xmlencode_print(cur[i], lengths[i]);
tee_fprintf(PAGER, "</field>\n");
}
else
@@ -3849,23 +3898,28 @@ print_table_data_vertically(MYSQL_RES *result)
{
unsigned int i;
const char *p;
-
+ if (opt_binhex && is_binary_field(field))
+ fprintf(PAGER, "0x");
for (i= 0, p= cur[off]; i < lengths[off]; i+= 1, p+= 1)
{
- if (*p == '\0')
- tee_putc((int)' ', PAGER);
+ if (opt_binhex && is_binary_field(field))
+ fprintf(PAGER, "%02X", *((uchar*)p));
else
- tee_putc((int)*p, PAGER);
+ {
+ if (*p == '\0')
+ tee_putc((int)' ', PAGER);
+ else
+ tee_putc((int)*p, PAGER);
+ }
}
tee_putc('\n', PAGER);
}
- else
+ else
tee_fprintf(PAGER, "NULL\n");
}
}
}
-
/* print_warnings should be called right after executing a statement */
static void print_warnings()
@@ -4002,11 +4056,19 @@ print_tab_data(MYSQL_RES *result)
while ((cur = mysql_fetch_row(result)))
{
lengths=mysql_fetch_lengths(result);
- safe_put_field(cur[0],lengths[0]);
+ field= mysql_fetch_fields(result);
+ if (opt_binhex && is_binary_field(&field[0]))
+ print_as_hex(PAGER, cur[0], lengths[0], lengths[0]);
+ else
+ safe_put_field(cur[0],lengths[0]);
+
for (uint off=1 ; off < mysql_num_fields(result); off++)
{
(void) tee_fputs("\t", PAGER);
- safe_put_field(cur[off], lengths[off]);
+ if (opt_binhex && field && is_binary_field(&field[off]))
+ print_as_hex(PAGER, cur[off], lengths[off], lengths[off]);
+ else
+ safe_put_field(cur[off], lengths[off]);
}
(void) tee_fputs("\n", PAGER);
}
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
index 74d61b582ea..5c202230c8b 100644
--- a/cmake/ssl.cmake
+++ b/cmake/ssl.cmake
@@ -1,4 +1,5 @@
-# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2012, Oracle and/or its affiliates.
+# Copyright (c) 2011, 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
@@ -11,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# We support different versions of SSL:
# - "bundled" uses source code in <source dir>/extra/yassl
@@ -207,7 +208,7 @@ MACRO (MYSQL_CHECK_SSL)
HAVE_EncryptAes128Gcm)
ELSE()
IF(WITH_SSL STREQUAL "system")
- MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support")
+ MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support")
ENDIF()
MYSQL_USE_BUNDLED_SSL()
ENDIF()
diff --git a/debian/compat b/debian/compat
index 7ed6ff82de6..ec635144f60 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-5
+9
diff --git a/include/my_global.h b/include/my_global.h
index b958a8d9e28..b9284b99577 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2013, Oracle and/or its affiliates.
- Copyright (c) 2010, 2013, Monty Program Ab.
+ Copyright (c) 2009, 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
@@ -439,9 +439,8 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#define SIGNAL_HANDLER_RESET_ON_DELIVERY
#endif
-#ifndef STDERR_FILENO
-#define STDERR_FILENO fileno(stderr)
-#endif
+/* don't assume that STDERR_FILENO is 2, mysqld can freopen */
+#undef STDERR_FILENO
#ifndef SO_EXT
#ifdef _WIN32
diff --git a/include/my_sys.h b/include/my_sys.h
index 6eadec05124..110a2ee9af3 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2010, 2016, Monty Program Ab.
+ Copyright (c) 2010, 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
diff --git a/include/service_versions.h b/include/service_versions.h
index ddc780a44b9..da7a2101f76 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -36,7 +36,7 @@
#define VERSION_progress_report 0x0100
#define VERSION_thd_alloc 0x0100
#define VERSION_thd_autoinc 0x0100
-#define VERSION_thd_error_context 0x0100
+#define VERSION_thd_error_context 0x0200
#define VERSION_thd_rnd 0x0100
#define VERSION_thd_specifics 0x0100
#define VERSION_thd_timezone 0x0100
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 49d7b20c8dc..9b884ebbd20 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, SkySQL Ab.
+/* Copyright (c) 2000, 2014, Oracle and/or its affiliates
+ Copyright (c) 2009, 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
@@ -4919,4 +4919,3 @@ ulong STDCALL mysql_net_field_length(uchar **packet)
{
return net_field_length(packet);
}
-
diff --git a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
index 9246c1839af..d68faaf04e7 100644
--- a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
+++ b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
@@ -66,6 +66,13 @@ if (!$slave_skip_counter) {
}
source include/start_slave.inc;
+# start_slave.inc returns when Slave_SQL_Running=Yes. But the slave
+# thread sets it before clearing Last_SQL_Errno. So we have to wait
+# for Last_SQL_Errno=0 separately.
+
+let $slave_param= Last_SQL_Errno;
+let $slave_param_value= 0;
+source include/wait_for_slave_param.inc;
--let $include_filename= wait_for_slave_sql_error_and_skip.inc [errno=$slave_sql_errno]
--source include/end_include_file.inc
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index ff929f8a2e8..2cd5d2ae922 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2,7 +2,7 @@
# -*- cperl -*-
# Copyright (c) 2004, 2014, Oracle and/or its affiliates.
-# Copyright (c) 2009, 2014, Monty Program Ab
+# Copyright (c) 2009, 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
@@ -1267,10 +1267,6 @@ sub command_line_setup {
fix_vs_config_dir();
- # Respect MTR_BINDIR variable, which is typically set in to the
- # build directory in out-of-source builds.
- $bindir=$ENV{MTR_BINDIR}||$basedir;
-
# Look for the client binaries directory
if ($path_client_bindir)
{
diff --git a/mysql-test/r/binary_to_hex.result b/mysql-test/r/binary_to_hex.result
new file mode 100644
index 00000000000..a6b68834da8
--- /dev/null
+++ b/mysql-test/r/binary_to_hex.result
@@ -0,0 +1,117 @@
+USE test;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (c1 TINYBLOB,
+c2 BLOB,
+c3 MEDIUMBLOB,
+c4 LONGBLOB,
+c5 TEXT,
+c6 BIT(1),
+c7 CHAR,
+c8 VARCHAR(10),
+c9 GEOMETRY) CHARACTER SET = binary;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` tinyblob,
+ `c2` blob,
+ `c3` mediumblob,
+ `c4` longblob,
+ `c5` blob,
+ `c6` bit(1) DEFAULT NULL,
+ `c7` binary(1) DEFAULT NULL,
+ `c8` varbinary(10) DEFAULT NULL,
+ `c9` geometry DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=binary
+INSERT INTO t1 VALUES ('tinyblob-text readable', 'blob-text readable',
+'mediumblob-text readable', 'longblob-text readable',
+'text readable', b'1', 'c', 'variable',
+POINT(1, 1));
+CREATE TABLE t2(id int, `col1` binary(10),`col2` blob);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) DEFAULT NULL,
+ `col1` binary(10) DEFAULT NULL,
+ `col2` blob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF');
+#Print the table contents when binary-as-hex option is off.
+SELECT * FROM t1;
+c1 c2 c3 c4 c5 c6 c7 c8 c9
+tinyblob-text readable blob-text readable mediumblob-text readable longblob-text readable text readable # c variable #
+SELECT * FROM t2;
+id col1 col2
+1 # #
+2 # #
+#Print the table contents after turning on the binary-as-hex option
+
+#Print the table contents in tab format
+
+c1 c2 c3 c4 c5 c6 c7 c8 c9
+0x74696E79626C6F622D74657874207265616461626C65 0x626C6F622D74657874207265616461626C65 0x6D656469756D626C6F622D74657874207265616461626C65 0x6C6F6E67626C6F622D74657874207265616461626C65 0x74657874207265616461626C65 0x01 0x63 0x7661726961626C65 0x000000000101000000000000000000F03F000000000000F03F
+id col1 col2
+1 0xAB123400000000000000 0x123ABC
+2 0xDE123400000000000000 0x123DEF
+
+#Print the table contents in table format
+
++------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+
+| c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 | c9 |
++------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+
+| 0x74696E79626C6F622D74657874207265616461626C65 | 0x626C6F622D74657874207265616461626C65 | 0x6D656469756D626C6F622D74657874207265616461626C65 | 0x6C6F6E67626C6F622D74657874207265616461626C65 | 0x74657874207265616461626C65 | 0x01 | 0x63 | 0x7661726961626C65 | 0x000000000101000000000000000000F03F000000000000F03F |
++------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+
++------+------------------------+------------+
+| id | col1 | col2 |
++------+------------------------+------------+
+| 1 | 0xAB123400000000000000 | 0x123ABC |
++------+------------------------+------------+
+
+#Print the table contents vertically
+
+*************************** 1. row ***************************
+c1: 0x74696E79626C6F622D74657874207265616461626C65
+c2: 0x626C6F622D74657874207265616461626C65
+c3: 0x6D656469756D626C6F622D74657874207265616461626C65
+c4: 0x6C6F6E67626C6F622D74657874207265616461626C65
+c5: 0x74657874207265616461626C65
+c6: 0x01
+c7: 0x63
+c8: 0x7661726961626C65
+c9: 0x000000000101000000000000000000F03F000000000000F03F
+
+#Print the table contents in xml format
+
+<?xml version="1.0"?>
+
+<resultset statement="SELECT * FROM t1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <row>
+ <field name="c1">0x74696E79626C6F622D74657874207265616461626C65</field>
+ <field name="c2">0x626C6F622D74657874207265616461626C65</field>
+ <field name="c3">0x6D656469756D626C6F622D74657874207265616461626C65</field>
+ <field name="c4">0x6C6F6E67626C6F622D74657874207265616461626C65</field>
+ <field name="c5">0x74657874207265616461626C65</field>
+ <field name="c6">0x01</field>
+ <field name="c7">0x63</field>
+ <field name="c8">0x7661726961626C65</field>
+ <field name="c9">0x000000000101000000000000000000F03F000000000000F03F</field>
+ </row>
+</resultset>
+<?xml version="1.0"?>
+
+<resultset statement="SELECT * FROM t2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <row>
+ <field name="id">1</field>
+ <field name="col1">0xAB123400000000000000</field>
+ <field name="col2">0x123ABC</field>
+ </row>
+
+ <row>
+ <field name="id">2</field>
+ <field name="col1">0xDE123400000000000000</field>
+ <field name="col2">0x123DEF</field>
+ </row>
+</resultset>
+
+#Print the table contents in html format
+
+<TABLE BORDER=1><TR><TH>c1</TH><TH>c2</TH><TH>c3</TH><TH>c4</TH><TH>c5</TH><TH>c6</TH><TH>c7</TH><TH>c8</TH><TH>c9</TH></TR><TR><TD>0x74696E79626C6F622D74657874207265616461626C65</TD><TD>0x626C6F622D74657874207265616461626C65</TD><TD>0x6D656469756D626C6F622D74657874207265616461626C65</TD><TD>0x6C6F6E67626C6F622D74657874207265616461626C65</TD><TD>0x74657874207265616461626C65</TD><TD>0x01</TD><TD>0x63</TD><TD>0x7661726961626C65</TD><TD>0x000000000101000000000000000000F03F000000000000F03F</TD></TR></TABLE><TABLE BORDER=1><TR><TH>id</TH><TH>col1</TH><TH>col2</TH></TR><TR><TD>1</TD><TD>0xAB123400000000000000</TD><TD>0x123ABC</TD></TR><TR><TD>2</TD><TD>0xDE123400000000000000</TD><TD>0x123DEF</TD></TR></TABLE>DROP TABLE t1, t2;
diff --git a/mysql-test/r/count_distinct.result b/mysql-test/r/count_distinct.result
index 3b65dd0e608..d55a232c715 100644
--- a/mysql-test/r/count_distinct.result
+++ b/mysql-test/r/count_distinct.result
@@ -94,3 +94,15 @@ count(distinct i)
2
drop table t1;
drop view v1;
+create table t1 (user_id char(64) character set utf8);
+insert t1 values(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17);
+set @@tmp_table_size = 1024;
+select count(distinct user_id) from t1;
+count(distinct user_id)
+17
+alter table t1 modify user_id char(128) character set utf8;
+select count(distinct user_id) from t1;
+count(distinct user_id)
+17
+drop table t1;
+set @@tmp_table_size = default;
diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result
index 85822a16e15..7712b76e3ae 100644
--- a/mysql-test/r/func_regexp_pcre.result
+++ b/mysql-test/r/func_regexp_pcre.result
@@ -883,6 +883,38 @@ SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,
1
Warnings:
Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
+SELECT CONCAT(REPEAT('100,',133),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
+CONCAT(REPEAT('100,',133),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'
+1
+SELECT CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
+CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$'
+0
+Warnings:
+Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
+SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
+REGEXP_INSTR(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')
+1
+SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
+REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$')
+0
+Warnings:
+Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
+SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
+LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'))
+535
+SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
+LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'))
+0
+Warnings:
+Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
+SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
+LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''))
+0
+SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
+LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''))
+803
+Warnings:
+Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
SELECT REGEXP_INSTR('a_kollision', 'oll');
REGEXP_INSTR('a_kollision', 'oll')
4
diff --git a/mysql-test/r/gis-rt-precise.result b/mysql-test/r/gis-rt-precise.result
index 3f4f014fb78..65583a0ce0d 100644
--- a/mysql-test/r/gis-rt-precise.result
+++ b/mysql-test/r/gis-rt-precise.result
@@ -60,3 +60,25 @@ fid AsText(g)
45 LINESTRING(51 51,60 60)
DROP TABLE t1;
End of 5.5 tests.
+CREATE TABLE t1 (
+coordinate point NOT NULL,
+SPATIAL KEY coordinate (coordinate)
+) ENGINE=Aria DEFAULT CHARSET=ascii PAGE_CHECKSUM=1;
+SHOW COLUMNS FROM t1;
+Field Type Null Key Default Extra
+coordinate point NO MUL NULL
+INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(0 0)"));
+INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(10 0)"));
+INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(10 10)"));
+INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(0 10)"));
+INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(5 5)"));
+SELECT astext(coordinate) FROM t1 WHERE ST_Intersects(ST_LineFromText("LINESTRING(0 0, 10 0, 10 10, 0 10)"), coordinate);
+astext(coordinate)
+POINT(0 0)
+POINT(10 0)
+POINT(10 10)
+POINT(0 10)
+SHOW COLUMNS FROM t1;
+Field Type Null Key Default Extra
+coordinate point NO MUL NULL
+DROP TABLE t1;
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 600ee83e032..76f4f6accdb 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -331,8 +331,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
fid AsText(Centroid(g))
-117 POINT(55.58852775304245 17.426536064113982)
-118 POINT(55.58852775304245 17.426536064113982)
+117 POINT(57.98031067576927 17.854754130800433)
+118 POINT(57.98031067576927 17.854754130800433)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon;
fid Area(g)
@@ -682,11 +682,11 @@ insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85998;
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
-85998 MULTIPOLYGON 1 POINT(115.31877315203187 -36.23747282102153)
+85998 MULTIPOLYGON 1 POINT(115.2970604672862 -36.23335610879993)
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85984;
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
-85984 MULTIPOLYGON 1 POINT(-114.87787186923313 36.33101763469059)
+85984 MULTIPOLYGON 1 POINT(-114.86854472054372 36.34725218253213)
drop table t1;
create table t1 (fl geometry not null);
insert into t1 values (1);
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index f48359d1971..29b3a0ea13b 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -2609,6 +2609,33 @@ select a from t1 group by a having a > 1;
a
drop table t1;
set sql_mode= @save_sql_mode;
+create table t1 (f1 int);
+insert into t1 values (5),(9);
+create table t2 (f2 int);
+insert into t2 values (0),(6);
+create table t3 (f3 int);
+insert into t3 values (6),(3);
+create table t4 (f4 int);
+insert into t4 values (1),(0);
+select
+(select min(f1) from t1 where f1 in (select min(f4) from t2)) as field7,
+(select count(*) from t3 where f3 in (select max(f4) from t2 group by field7))
+from t4;
+ERROR 42S22: Reference 'field7' not supported (reference to group function)
+drop table t1, t2, t3, t4;
+create table t1 (i1 int);
+insert into t1 values (1);
+create table t2 (i int);
+insert into t2 values (2);
+select 1 from t1 left join t2 b on b.i = (select max(b.i) from t2);
+1
+1
+drop table t1, t2;
+create table t1 (c1 int, c2 int);
+create table t2 (c1 int, c2 int);
+select t1.c1 as c1, t2.c2 as c1 from t1, t2 where t1.c1 < 20 and t2.c2 > 5 group by t1.c1, t2.c2 having t1.c1 < 3;
+c1 c1
+drop table t1, t2;
#
# Bug #58782
# Missing rows with SELECT .. WHERE .. IN subquery
diff --git a/mysql-test/r/loadxml.result b/mysql-test/r/loadxml.result
index 05b3ddf5bc9..94db3cc913f 100644
--- a/mysql-test/r/loadxml.result
+++ b/mysql-test/r/loadxml.result
@@ -5,10 +5,10 @@ load xml infile '../../std_data/loadxml.dat' into table t1
rows identified by '<row>';
select * from t1 order by a;
a b
-1 b1
-2 b2
-3 b3
-11 b11
+1 b1
+2 b2
+3 b3
+11 b11
111 b111
112 b112 & < > " ' &unknown; -- check entities
212 b212
@@ -81,17 +81,17 @@ LOAD XML INFILE '../../std_data/loadxml.dat' INTO TABLE t1
ROWS IDENTIFIED BY '<row>' (a,@b) SET b=concat('!',@b);
SELECT * FROM t1 ORDER BY a;
a b
-1 !b1
-11 !b11
+1 ! b1
+11 ! b11
111 !b111
112 !b112 & < > " ' &unknown; -- check entities
-2 !b2
+2 ! b2
212 !b212
213 !b213
214 !b214
215 !b215
216 !&bb b;
-3 !b3
+3 ! b3
DROP TABLE t1;
#
# Bug#16171518 LOAD XML DOES NOT HANDLE EMPTY ELEMENTS
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index 46725055952..69637f4078f 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -474,6 +474,29 @@ even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@loca
even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost
DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost;
DROP PROCEDURE test.pr;
+use test;
+call mtr.add_suppression('Column last_update in table "mysql"."innodb_table_stats" is INT NOT NULL but should be');
+alter table mysql.innodb_table_stats modify last_update int not null;
+create table extralongname_extralongname_extralongname_extralongname_ext (
+id int(10) unsigned not null,
+created_date date not null,
+created timestamp not null,
+primary key (created,id,created_date)
+) engine=innodb stats_persistent=1 default charset=latin1
+partition by range (year(created_date))
+subpartition by hash (month(created_date))
+subpartitions 2 (
+partition p2007 values less than (2008),
+partition p2008 values less than (2009)
+);
+select length(table_name) from mysql.innodb_table_stats;
+length(table_name)
+79
+79
+79
+79
+drop table extralongname_extralongname_extralongname_extralongname_ext;
+End of 10.0 tests
set sql_mode=default;
# Droping the previously created mysql_upgrade_info file..
create table test.t1(a int) engine=MyISAM;
@@ -536,4 +559,4 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE test.t1;
SET GLOBAL enforce_storage_engine=NULL;
-End of tests
+End of 10.1 tests
diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result
index 964c259ebf8..0673acacfa9 100644
--- a/mysql-test/r/read_only.result
+++ b/mysql-test/r/read_only.result
@@ -34,6 +34,8 @@ create temporary table t3 (a int);
create temporary table t4 (a int) select * from t3;
insert into t3 values(1);
insert into t4 select * from t3;
+create table t3 (a int);
+ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index da418accd6c..cf542a5913e 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -7195,6 +7195,21 @@ SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
ERROR 21000: Subquery returns more than 1 row
drop view v1;
drop table t1,t2;
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=MyISAM;
+INSERT t1 VALUES (4),(8);
+CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM;
+INSERT t2 VALUES (6);
+SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+(SELECT MAX(sq.f2) FROM t1)
+NULL
+#
+# Disable this query till MDEV-13399 is resolved
+#
+# INSERT t2 VALUES (9);
+# --error ER_SUBQUERY_NO_1_ROW
+# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+#
+drop table t1, t2;
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result
index 5382e291dfc..a3a6e2ab4c0 100644
--- a/mysql-test/r/subselect_no_exists_to_in.result
+++ b/mysql-test/r/subselect_no_exists_to_in.result
@@ -7195,6 +7195,21 @@ SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
ERROR 21000: Subquery returns more than 1 row
drop view v1;
drop table t1,t2;
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=MyISAM;
+INSERT t1 VALUES (4),(8);
+CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM;
+INSERT t2 VALUES (6);
+SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+(SELECT MAX(sq.f2) FROM t1)
+NULL
+#
+# Disable this query till MDEV-13399 is resolved
+#
+# INSERT t2 VALUES (9);
+# --error ER_SUBQUERY_NO_1_ROW
+# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+#
+drop table t1, t2;
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index 255f8e30ccf..11457ccbb02 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -7188,6 +7188,21 @@ SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
ERROR 21000: Subquery returns more than 1 row
drop view v1;
drop table t1,t2;
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=MyISAM;
+INSERT t1 VALUES (4),(8);
+CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM;
+INSERT t2 VALUES (6);
+SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+(SELECT MAX(sq.f2) FROM t1)
+NULL
+#
+# Disable this query till MDEV-13399 is resolved
+#
+# INSERT t2 VALUES (9);
+# --error ER_SUBQUERY_NO_1_ROW
+# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+#
+drop table t1, t2;
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 938c8edc2e9..076953c210f 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -7186,6 +7186,21 @@ SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
ERROR 21000: Subquery returns more than 1 row
drop view v1;
drop table t1,t2;
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=MyISAM;
+INSERT t1 VALUES (4),(8);
+CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM;
+INSERT t2 VALUES (6);
+SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+(SELECT MAX(sq.f2) FROM t1)
+NULL
+#
+# Disable this query till MDEV-13399 is resolved
+#
+# INSERT t2 VALUES (9);
+# --error ER_SUBQUERY_NO_1_ROW
+# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+#
+drop table t1, t2;
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index 9a37719c38a..b5c7e9bfdbd 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -7201,6 +7201,21 @@ SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
ERROR 21000: Subquery returns more than 1 row
drop view v1;
drop table t1,t2;
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=MyISAM;
+INSERT t1 VALUES (4),(8);
+CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM;
+INSERT t2 VALUES (6);
+SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+(SELECT MAX(sq.f2) FROM t1)
+NULL
+#
+# Disable this query till MDEV-13399 is resolved
+#
+# INSERT t2 VALUES (9);
+# --error ER_SUBQUERY_NO_1_ROW
+# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+#
+drop table t1, t2;
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index c66fef2eb9b..52da5f1cec3 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -7186,6 +7186,21 @@ SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
ERROR 21000: Subquery returns more than 1 row
drop view v1;
drop table t1,t2;
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=MyISAM;
+INSERT t1 VALUES (4),(8);
+CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM;
+INSERT t2 VALUES (6);
+SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+(SELECT MAX(sq.f2) FROM t1)
+NULL
+#
+# Disable this query till MDEV-13399 is resolved
+#
+# INSERT t2 VALUES (9);
+# --error ER_SUBQUERY_NO_1_ROW
+# SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+#
+drop table t1, t2;
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
diff --git a/mysql-test/r/subselect_nulls.result b/mysql-test/r/subselect_nulls.result
index 584c184870d..08982371269 100644
--- a/mysql-test/r/subselect_nulls.result
+++ b/mysql-test/r/subselect_nulls.result
@@ -115,3 +115,9 @@ k d1 d2
set optimizer_switch= @tmp_subselect_nulls;
drop table x1;
drop table x2;
+select (select 1, 2) in (select 3, 4);
+(select 1, 2) in (select 3, 4)
+0
+select (select NULL, NULL) in (select 3, 4);
+(select NULL, NULL) in (select 3, 4)
+NULL
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index afeec1104bb..233e7399cd2 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -2051,6 +2051,24 @@ d
2016-06-04 00:00:00
drop table t1;
End of 5.0 tests
+create table t1 (a int, b int);
+insert into t1 values (1,1),(2,2),(3,3);
+create table t2 (c varchar(30), d varchar(30));
+insert into t1 values ('1','1'),('2','2'),('4','4');
+create table t3 (e int, f int);
+insert into t3 values (1,1),(2,2),(31,31),(32,32);
+select e,f, (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3;
+e f sub
+1 1 1
+2 2 1
+31 31 0
+32 32 0
+select avg(f), (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3 group by sub;
+avg(f) sub
+31.5000 0
+1.5000 1
+drop table t1,t2,t3;
+End of 5.5 tests
#
# WL#1763 Avoid creating temporary table in UNION ALL
#
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index cf1ad1053f1..39513acf9b6 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -5651,6 +5651,20 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(((`test`.`t2`.`c` = `test`.`t1`.`b`) and (`test`.`t3`.`f` = `test`.`t1`.`a`) and (`test`.`t2`.`d` = `test`.`t3`.`e`) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`a` is not null) and (`test`.`t1`.`b` is not null))) where (`test`.`t1`.`a` < 5)
drop view v1;
drop table t1,t2,t3;
+#
+# MDEV-11240: Server crashes in check_view_single_update or
+# Assertion `derived->table' failed in mysql_derived_merge_for_insert
+#
+CREATE TABLE t3 (a INT);
+CREATE ALGORITHM = MERGE VIEW v1 AS SELECT t2.a FROM t3 AS t1, t3 AS t2;
+CREATE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM v1;
+PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
+EXECUTE stmt;
+ERROR HY000: Can not insert into join view 'test.v2' without fields list
+EXECUTE stmt;
+ERROR HY000: Can not insert into join view 'test.v2' without fields list
+drop view v1,v2;
+drop table t3;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/std_data/loadxml.dat b/mysql-test/std_data/loadxml.dat
index b72fac9da74..d5ccd4a1b13 100644
--- a/mysql-test/std_data/loadxml.dat
+++ b/mysql-test/std_data/loadxml.dat
@@ -9,19 +9,19 @@
<table_data name="t1">
<row>
<field name="a">1</field>
- <field name="b">b1</field>
+ <field name="b"> b1</field>
</row>
<row>
<field name="a">2</field>
- <field name="b">b2</field>
+ <field name="b"> b2</field>
</row>
<row>
<field name="a">3</field>
- <field name="b">b3</field>
+ <field name="b"> b3</field>
</row>
<row>
<field name="a">11</field>
- <field name="b">b11</field>
+ <field name="b"> b11</field>
</row>
<!-- Check field values as tags -->
diff --git a/mysql-test/suite/archive/archive_gis.result b/mysql-test/suite/archive/archive_gis.result
index 6ee50fd3b85..80c1e347764 100644
--- a/mysql-test/suite/archive/archive_gis.result
+++ b/mysql-test/suite/archive/archive_gis.result
@@ -326,8 +326,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
fid AsText(Centroid(g))
-117 POINT(55.58852775304245 17.426536064113982)
-118 POINT(55.58852775304245 17.426536064113982)
+117 POINT(57.98031067576927 17.854754130800433)
+118 POINT(57.98031067576927 17.854754130800433)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
fid Area(g)
diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result
index 5b6adf5600e..48d9db44b05 100644
--- a/mysql-test/suite/binlog/r/binlog_unsafe.result
+++ b/mysql-test/suite/binlog/r/binlog_unsafe.result
@@ -1,14 +1,14 @@
#### Setup tables ####
-CREATE TABLE t0 (a CHAR(100));
-CREATE TABLE t1 (a CHAR(100));
-CREATE TABLE t2 (a CHAR(100));
-CREATE TABLE t3 (a CHAR(100));
-CREATE TABLE ta0 (a CHAR(100));
-CREATE TABLE ta1 (a CHAR(100));
-CREATE TABLE ta2 (a CHAR(100));
-CREATE TABLE ta3 (a CHAR(100));
+CREATE TABLE t0 (a CHAR(200));
+CREATE TABLE t1 (a CHAR(200));
+CREATE TABLE t2 (a CHAR(200));
+CREATE TABLE t3 (a CHAR(200));
+CREATE TABLE ta0 (a CHAR(200));
+CREATE TABLE ta1 (a CHAR(200));
+CREATE TABLE ta2 (a CHAR(200));
+CREATE TABLE ta3 (a CHAR(200));
CREATE TABLE autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
-CREATE TABLE data_table (a CHAR(100));
+CREATE TABLE data_table (a CHAR(200));
INSERT INTO data_table VALUES ('foo');
CREATE TABLE trigger_table_1 (a INT);
CREATE TABLE trigger_table_2 (a INT);
@@ -2392,7 +2392,7 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc
DROP PROCEDURE p1;
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100));
+CREATE TABLE t1 (a VARCHAR(200), b VARCHAR(200));
INSERT INTO t1 VALUES ('a','b');
UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
Warnings:
@@ -2423,7 +2423,7 @@ CREATE FUNCTION fun_check_log_bin() RETURNS INT
BEGIN
SET @@SQL_LOG_BIN = 0;
INSERT INTO t1 VALUES(@@global.sync_binlog);
-RETURN 100;
+RETURN 200;
END|
"One unsafe warning should be issued in the following statement"
SELECT fun_check_log_bin();
diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test
index c9e92e21002..a23155e6c1d 100644
--- a/mysql-test/suite/binlog/t/binlog_unsafe.test
+++ b/mysql-test/suite/binlog/t/binlog_unsafe.test
@@ -106,16 +106,16 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
--echo #### Setup tables ####
-CREATE TABLE t0 (a CHAR(100));
-CREATE TABLE t1 (a CHAR(100));
-CREATE TABLE t2 (a CHAR(100));
-CREATE TABLE t3 (a CHAR(100));
-CREATE TABLE ta0 (a CHAR(100));
-CREATE TABLE ta1 (a CHAR(100));
-CREATE TABLE ta2 (a CHAR(100));
-CREATE TABLE ta3 (a CHAR(100));
+CREATE TABLE t0 (a CHAR(200));
+CREATE TABLE t1 (a CHAR(200));
+CREATE TABLE t2 (a CHAR(200));
+CREATE TABLE t3 (a CHAR(200));
+CREATE TABLE ta0 (a CHAR(200));
+CREATE TABLE ta1 (a CHAR(200));
+CREATE TABLE ta2 (a CHAR(200));
+CREATE TABLE ta3 (a CHAR(200));
CREATE TABLE autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
-CREATE TABLE data_table (a CHAR(100));
+CREATE TABLE data_table (a CHAR(200));
INSERT INTO data_table VALUES ('foo');
CREATE TABLE trigger_table_1 (a INT);
CREATE TABLE trigger_table_2 (a INT);
@@ -429,7 +429,7 @@ DROP TABLE t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
-CREATE TABLE t1 (a VARCHAR(100), b VARCHAR(100));
+CREATE TABLE t1 (a VARCHAR(200), b VARCHAR(200));
INSERT INTO t1 VALUES ('a','b');
UPDATE t1 SET b = '%s%s%s%s%s%s%s%s%s%s%s%s%s%s' WHERE a = 'a' LIMIT 1;
DROP TABLE t1;
@@ -467,7 +467,7 @@ CREATE FUNCTION fun_check_log_bin() RETURNS INT
BEGIN
SET @@SQL_LOG_BIN = 0;
INSERT INTO t1 VALUES(@@global.sync_binlog);
- RETURN 100;
+ RETURN 200;
END|
DELIMITER ;|
--echo "One unsafe warning should be issued in the following statement"
diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result
index fc13ba1ab2c..8270a7ad7ff 100644
--- a/mysql-test/suite/innodb/r/innodb_gis.result
+++ b/mysql-test/suite/innodb/r/innodb_gis.result
@@ -326,8 +326,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon ORDER by fid;
fid AsText(Centroid(g))
-117 POINT(55.58852775304245 17.426536064113982)
-118 POINT(55.58852775304245 17.426536064113982)
+117 POINT(57.98031067576927 17.854754130800433)
+118 POINT(57.98031067576927 17.854754130800433)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon ORDER by fid;
fid Area(g)
diff --git a/mysql-test/suite/rpl/r/rpl_reset_slave_fail.result b/mysql-test/suite/rpl/r/rpl_reset_slave_fail.result
new file mode 100644
index 00000000000..205e8fe428b
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_reset_slave_fail.result
@@ -0,0 +1,29 @@
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1 (c1 INT);
+INSERT INTO t1 (c1) VALUES (1);
+include/stop_slave_sql.inc
+FLUSH LOGS;
+FLUSH LOGS;
+INSERT INTO t1 (c1) VALUES (2);
+include/sync_slave_io_with_master.inc
+call mtr.add_suppression("File '.*slave-relay-bin.");
+call mtr.add_suppression("Could not open log file");
+call mtr.add_suppression("Failed to open the relay log");
+call mtr.add_suppression("Failed to initialize the master info structure");
+include/rpl_stop_server.inc [server_number=2]
+# Removing file(s)
+include/rpl_start_server.inc [server_number=2]
+START SLAVE;
+ERROR HY000: Could not initialize master info structure for ''; more error messages can be found in the MariaDB error log
+START SLAVE;
+ERROR HY000: Could not initialize master info structure for ''; more error messages can be found in the MariaDB error log
+RESET SLAVE;
+DROP TABLE t1;
+START SLAVE UNTIL MASTER_LOG_FILE= 'MASTER_LOG_FILE', MASTER_LOG_POS= MASTER_LOG_POS;;
+include/wait_for_slave_sql_to_stop.inc
+include/stop_slave_io.inc
+include/start_slave.inc
+include/diff_tables.inc [master:t1, slave:t1]
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_reset_slave_fail.test b/mysql-test/suite/rpl/t/rpl_reset_slave_fail.test
new file mode 100644
index 00000000000..021dc76d50c
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_reset_slave_fail.test
@@ -0,0 +1,91 @@
+###############################################################################
+# Bug#24901077: RESET SLAVE ALL DOES NOT ALWAYS RESET SLAVE
+#
+# Problem:
+# =======
+# If you have a relay log index file that has ended up with
+# some relay log files that do not exists, then RESET SLAVE
+# ALL is not enough to get back to a clean state.
+###############################################################################
+# Remove all slave-relay-bin.0* files (do not remove slave-relay-bin.index)
+# During server restart rli initialization will fail as there are no
+# relay logs. In case of bug RESET SLAVE will not do the required clean up
+# as rli is not inited and subsequent START SLAVE will fail.
+# Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found"
+# because it is different on Unix and Windows systems.
+
+--source include/have_binlog_format_mixed.inc
+--source include/master-slave.inc
+
+--connection master
+CREATE TABLE t1 (c1 INT);
+INSERT INTO t1 (c1) VALUES (1);
+--sync_slave_with_master
+
+--connection slave
+--source include/stop_slave_sql.inc
+--let $MYSQLD_SLAVE_DATADIR= `select @@datadir`
+
+--connection master
+# Generate more relay logs on slave.
+FLUSH LOGS;
+FLUSH LOGS;
+INSERT INTO t1 (c1) VALUES (2);
+
+--source include/sync_slave_io_with_master.inc
+call mtr.add_suppression("File '.*slave-relay-bin.");
+call mtr.add_suppression("Could not open log file");
+call mtr.add_suppression("Failed to open the relay log");
+call mtr.add_suppression("Failed to initialize the master info structure");
+
+# Stop slave
+--let $rpl_server_number= 2
+--source include/rpl_stop_server.inc
+
+# Delete file(s)
+--echo # Removing $remove_pattern file(s)
+--let $remove_pattern= slave-relay-bin.0*
+--remove_files_wildcard $MYSQLD_SLAVE_DATADIR $remove_pattern
+
+# Start slave
+--let $rpl_server_number= 2
+--source include/rpl_start_server.inc
+
+# Start slave must fail because of the removed file(s).
+--error ER_MASTER_INFO
+START SLAVE;
+
+# Try a second time, it must fail again.
+--error ER_MASTER_INFO
+START SLAVE;
+
+# Retrieve master executed position before reset slave.
+--let $master_exec_file= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1)
+--let $master_exec_pos= query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1)
+
+# Reset slave.
+# Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found"
+# because it is different on Unix and Windows systems.
+--disable_warnings
+RESET SLAVE;
+--enable_warnings
+DROP TABLE t1;
+--replace_result $master_exec_file MASTER_LOG_FILE $master_exec_pos MASTER_LOG_POS
+--eval START SLAVE UNTIL MASTER_LOG_FILE= '$master_exec_file', MASTER_LOG_POS= $master_exec_pos;
+--source include/wait_for_slave_sql_to_stop.inc
+--source include/stop_slave_io.inc
+
+# Start slave.
+--source include/start_slave.inc
+
+--connection master
+--sync_slave_with_master
+# Check consistency.
+--let $diff_tables= master:t1, slave:t1
+--source include/diff_tables.inc
+
+# Cleanup
+--connection master
+DROP TABLE t1;
+--sync_slave_with_master
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/storage_engine/type_spatial.result b/mysql-test/suite/storage_engine/type_spatial.result
index e1ae2f1fa64..cab1942153f 100644
--- a/mysql-test/suite/storage_engine/type_spatial.result
+++ b/mysql-test/suite/storage_engine/type_spatial.result
@@ -350,8 +350,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
fid AsText(Centroid(g))
-117 POINT(55.58852775304245 17.426536064113982)
-118 POINT(55.58852775304245 17.426536064113982)
+117 POINT(57.98031067576927 17.854754130800433)
+118 POINT(57.98031067576927 17.854754130800433)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon;
fid Area(g)
diff --git a/mysql-test/suite/storage_engine/type_spatial_indexes.result b/mysql-test/suite/storage_engine/type_spatial_indexes.result
index 1c9fee3ceac..f608366c217 100644
--- a/mysql-test/suite/storage_engine/type_spatial_indexes.result
+++ b/mysql-test/suite/storage_engine/type_spatial_indexes.result
@@ -350,8 +350,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
fid AsText(Centroid(g))
-117 POINT(55.58852775304245 17.426536064113982)
-118 POINT(55.58852775304245 17.426536064113982)
+117 POINT(57.98031067576927 17.854754130800433)
+118 POINT(57.98031067576927 17.854754130800433)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon;
fid Area(g)
@@ -1050,8 +1050,8 @@ fid IsClosed(g)
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
fid AsText(Centroid(g))
-117 POINT(55.58852775304245 17.426536064113982)
-118 POINT(55.58852775304245 17.426536064113982)
+117 POINT(57.98031067576927 17.854754130800433)
+118 POINT(57.98031067576927 17.854754130800433)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon;
fid Area(g)
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff
index b7025bcd606..8638fd00be6 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff
@@ -1,5 +1,5 @@
---- suite/sys_vars/r/sysvars_innodb.result 2016-05-06 14:03:16.000000000 +0300
-+++ suite/sys_vars/r/sysvars_innodb,32bit.reject 2016-05-08 13:28:44.312418574 +0300
+--- suite/sys_vars/r/sysvars_innodb.result
++++ suite/sys_vars/r/sysvars_innodb,32bit.reject
@@ -47,13 +47,27 @@
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
@@ -298,7 +298,7 @@
VARIABLE_NAME INNODB_DATA_FILE_PATH
SESSION_VALUE NULL
GLOBAL_VALUE ibdata1:12M:autoextend
-@@ -753,7 +893,7 @@
+@@ -767,7 +907,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 120
VARIABLE_SCOPE GLOBAL
@@ -307,7 +307,7 @@
VARIABLE_COMMENT Number of pages reserved in doublewrite buffer for batch flushing
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 127
-@@ -761,6 +901,20 @@
+@@ -775,6 +915,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -328,7 +328,7 @@
VARIABLE_NAME INNODB_ENCRYPTION_ROTATE_KEY_AGE
SESSION_VALUE NULL
GLOBAL_VALUE 1
-@@ -831,13 +985,27 @@
+@@ -845,13 +999,27 @@
ENUM_VALUE_LIST OFF,ON,FORCE
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -357,7 +357,7 @@
VARIABLE_COMMENT Speeds up the shutdown process of the InnoDB storage engine. Possible values are 0, 1 (faster) or 2 (fastest - crash-like).
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
-@@ -851,7 +1019,7 @@
+@@ -865,7 +1033,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 600
VARIABLE_SCOPE GLOBAL
@@ -366,7 +366,7 @@
VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -921,7 +1089,7 @@
+@@ -935,7 +1103,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -375,7 +375,7 @@
VARIABLE_COMMENT Make the first page of the given tablespace dirty.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -935,7 +1103,7 @@
+@@ -949,7 +1117,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL
@@ -384,7 +384,7 @@
VARIABLE_COMMENT Number of iterations over which the background flushing is averaged.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1000
-@@ -958,12 +1126,12 @@
+@@ -972,12 +1140,12 @@
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_FLUSH_LOG_AT_TRX_COMMIT
@@ -400,7 +400,7 @@
VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 3
-@@ -991,7 +1159,7 @@
+@@ -1005,7 +1173,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -409,7 +409,7 @@
VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
-@@ -1033,7 +1201,7 @@
+@@ -1047,7 +1215,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -575,7 +575,7 @@
VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -1341,7 +1551,7 @@
+@@ -1355,7 +1565,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50
VARIABLE_SCOPE SESSION
@@ -584,7 +584,7 @@
VARIABLE_COMMENT Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1073741824
-@@ -1349,35 +1559,105 @@
+@@ -1363,37 +1573,107 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -620,7 +620,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL
-VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES
+VARIABLE_NAME INNODB_LOG_ARCH_DIR
-+SESSION_VALUE NULL
+ SESSION_VALUE NULL
+-GLOBAL_VALUE ON
+GLOBAL_VALUE PATH
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE
@@ -704,10 +705,12 @@
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES
- SESSION_VALUE NULL
- GLOBAL_VALUE ON
++SESSION_VALUE NULL
++GLOBAL_VALUE ON
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-@@ -1397,7 +1677,7 @@
+ DEFAULT_VALUE ON
+ VARIABLE_SCOPE GLOBAL
+@@ -1411,7 +1691,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
@@ -716,7 +719,7 @@
VARIABLE_COMMENT Number of log files in the log group. InnoDB writes to the files in a circular fashion.
NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 100
-@@ -1439,9 +1719,37 @@
+@@ -1453,9 +1733,37 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 1024
VARIABLE_SCOPE GLOBAL
@@ -755,7 +758,7 @@
NUMERIC_MAX_VALUE 18446744073709551615
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
-@@ -1481,10 +1789,10 @@
+@@ -1495,10 +1803,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -768,7 +771,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1495,7 +1803,7 @@
+@@ -1509,7 +1817,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -777,7 +780,7 @@
VARIABLE_COMMENT Maximum delay of user threads in micro-seconds
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10000000
-@@ -1509,7 +1817,7 @@
+@@ -1523,7 +1831,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -786,7 +789,7 @@
VARIABLE_COMMENT Number of identical copies of log groups we keep for the database. Currently this should be set to 1.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10
-@@ -1579,7 +1887,7 @@
+@@ -1593,7 +1901,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8
VARIABLE_SCOPE GLOBAL
@@ -795,7 +798,7 @@
VARIABLE_COMMENT Number of multi-threaded flush threads
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64
-@@ -1635,10 +1943,10 @@
+@@ -1649,10 +1957,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -808,7 +811,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
-@@ -1663,7 +1971,7 @@
+@@ -1677,7 +1985,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16
VARIABLE_SCOPE GLOBAL
@@ -817,7 +820,7 @@
VARIABLE_COMMENT Number of rw_locks protecting buffer pool page_hash. Rounded up to the next power of 2
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -1677,7 +1985,7 @@
+@@ -1691,7 +1999,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16384
VARIABLE_SCOPE GLOBAL
@@ -826,8 +829,8 @@
VARIABLE_COMMENT Page size to use for all InnoDB tablespaces.
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 65536
-@@ -1713,13 +2021,69 @@
- ENUM_VALUE_LIST NULL
+@@ -1727,13 +2035,69 @@
+ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME INNODB_PRIORITY_CLEANER
@@ -897,7 +900,7 @@
VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 5000
-@@ -1761,7 +2125,7 @@
+@@ -1775,7 +2139,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -906,7 +909,7 @@
VARIABLE_COMMENT Purge threads can be from 1 to 32. Default is 1.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 32
-@@ -1789,7 +2153,7 @@
+@@ -1803,7 +2167,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 56
VARIABLE_SCOPE GLOBAL
@@ -915,7 +918,7 @@
VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
-@@ -1803,7 +2167,7 @@
+@@ -1817,7 +2181,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
@@ -924,7 +927,7 @@
VARIABLE_COMMENT Number of background read I/O threads in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64
-@@ -1831,10 +2195,10 @@
+@@ -1845,10 +2209,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -937,7 +940,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1859,7 +2223,7 @@
+@@ -1873,7 +2237,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
@@ -946,7 +949,7 @@
VARIABLE_COMMENT Number of undo logs to use (deprecated).
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
-@@ -1873,7 +2237,7 @@
+@@ -1887,7 +2251,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -955,7 +958,7 @@
VARIABLE_COMMENT An InnoDB page number.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -1881,6 +2245,48 @@
+@@ -1895,6 +2259,48 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -1004,7 +1007,7 @@
VARIABLE_NAME INNODB_SCRUB_LOG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -1909,6 +2315,34 @@
+@@ -1923,6 +2329,34 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -1039,7 +1042,7 @@
VARIABLE_NAME INNODB_SIMULATE_COMP_FAILURES
SESSION_VALUE NULL
GLOBAL_VALUE 0
-@@ -1929,7 +2363,7 @@
+@@ -1943,7 +2377,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
@@ -1048,7 +1051,7 @@
VARIABLE_COMMENT Memory buffer size for index creation
NUMERIC_MIN_VALUE 65536
NUMERIC_MAX_VALUE 67108864
-@@ -1943,10 +2377,10 @@
+@@ -1957,10 +2391,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 6
VARIABLE_SCOPE GLOBAL
@@ -1061,7 +1064,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1972,7 +2406,7 @@
+@@ -2000,7 +2434,7 @@
DEFAULT_VALUE nulls_equal
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
@@ -1070,7 +1073,7 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -2139,7 +2573,7 @@
+@@ -2167,7 +2601,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -1079,7 +1082,7 @@
VARIABLE_COMMENT Size of the mutex/lock wait array.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -2153,10 +2587,10 @@
+@@ -2181,10 +2615,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL
@@ -1092,7 +1095,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2181,7 +2615,7 @@
+@@ -2209,7 +2643,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -1101,7 +1104,7 @@
VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
-@@ -2195,7 +2629,7 @@
+@@ -2223,7 +2657,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10000
VARIABLE_SCOPE GLOBAL
@@ -1110,7 +1113,7 @@
VARIABLE_COMMENT Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000000
-@@ -2217,6 +2651,34 @@
+@@ -2245,6 +2679,34 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -1145,7 +1148,7 @@
VARIABLE_NAME INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -2265,7 +2727,7 @@
+@@ -2293,7 +2755,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
@@ -1154,7 +1157,7 @@
VARIABLE_COMMENT Number of undo logs to use.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
-@@ -2279,7 +2741,7 @@
+@@ -2307,7 +2769,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -1163,7 +1166,7 @@
VARIABLE_COMMENT Number of undo tablespaces to use.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 126
-@@ -2294,7 +2756,7 @@
+@@ -2322,7 +2784,7 @@
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
@@ -1172,8 +1175,8 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -2315,6 +2777,20 @@
- ENUM_VALUE_LIST NULL
+@@ -2343,6 +2805,20 @@
+ ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT NONE
+VARIABLE_NAME INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
@@ -1193,8 +1196,8 @@
VARIABLE_NAME INNODB_USE_MTFLUSH
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -2329,6 +2805,20 @@
- ENUM_VALUE_LIST NULL
+@@ -2357,6 +2833,20 @@
+ ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT NONE
+VARIABLE_NAME INNODB_USE_STACKTRACE
@@ -1214,12 +1217,12 @@
VARIABLE_NAME INNODB_USE_SYS_MALLOC
SESSION_VALUE NULL
GLOBAL_VALUE ON
-@@ -2359,12 +2849,12 @@
+@@ -2387,12 +2877,12 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
--GLOBAL_VALUE 5.6.36
-+GLOBAL_VALUE 5.6.36-82.0
+-GLOBAL_VALUE 5.6.37
++GLOBAL_VALUE 5.6.36-82.1
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
@@ -1229,7 +1232,7 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -2377,7 +2867,7 @@
+@@ -2405,7 +2895,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
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 ceb5cdaa46e..46148b1d6ba 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
@@ -125,7 +125,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -753,7 +753,7 @@
+@@ -767,7 +767,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 120
VARIABLE_SCOPE GLOBAL
@@ -134,7 +134,7 @@
VARIABLE_COMMENT Number of pages reserved in doublewrite buffer for batch flushing
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 127
-@@ -837,7 +837,7 @@
+@@ -851,7 +851,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -143,7 +143,7 @@
VARIABLE_COMMENT Speeds up the shutdown process of the InnoDB storage engine. Possible values are 0, 1 (faster) or 2 (fastest - crash-like).
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
-@@ -851,7 +851,7 @@
+@@ -865,7 +865,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 600
VARIABLE_SCOPE GLOBAL
@@ -152,7 +152,7 @@
VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -921,7 +921,7 @@
+@@ -935,7 +935,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -161,7 +161,7 @@
VARIABLE_COMMENT Make the first page of the given tablespace dirty.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -935,7 +935,7 @@
+@@ -949,7 +949,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL
@@ -170,7 +170,7 @@
VARIABLE_COMMENT Number of iterations over which the background flushing is averaged.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1000
-@@ -963,7 +963,7 @@
+@@ -977,7 +977,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -179,7 +179,7 @@
VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 3
-@@ -991,7 +991,7 @@
+@@ -1005,7 +1005,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -188,7 +188,7 @@
VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 2
-@@ -1033,7 +1033,7 @@
+@@ -1047,7 +1047,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -298,7 +298,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1341,7 +1341,7 @@
+@@ -1355,7 +1355,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 50
VARIABLE_SCOPE SESSION
@@ -307,7 +307,7 @@
VARIABLE_COMMENT Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1073741824
-@@ -1355,10 +1355,10 @@
+@@ -1369,10 +1369,10 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 16777216
VARIABLE_SCOPE GLOBAL
@@ -320,7 +320,7 @@
NUMERIC_BLOCK_SIZE 1024
ENUM_VALUE_LIST NULL
READ_ONLY YES
-@@ -1397,7 +1397,7 @@
+@@ -1411,7 +1411,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
@@ -329,7 +329,7 @@
VARIABLE_COMMENT Number of log files in the log group. InnoDB writes to the files in a circular fashion.
NUMERIC_MIN_VALUE 2
NUMERIC_MAX_VALUE 100
-@@ -1439,10 +1439,10 @@
+@@ -1453,10 +1453,10 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 1024
VARIABLE_SCOPE GLOBAL
@@ -342,7 +342,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1481,10 +1481,10 @@
+@@ -1495,10 +1495,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -355,7 +355,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1495,7 +1495,7 @@
+@@ -1509,7 +1509,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -364,7 +364,7 @@
VARIABLE_COMMENT Maximum delay of user threads in micro-seconds
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10000000
-@@ -1509,7 +1509,7 @@
+@@ -1523,7 +1523,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -373,7 +373,7 @@
VARIABLE_COMMENT Number of identical copies of log groups we keep for the database. Currently this should be set to 1.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 10
-@@ -1579,7 +1579,7 @@
+@@ -1593,7 +1593,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8
VARIABLE_SCOPE GLOBAL
@@ -382,7 +382,7 @@
VARIABLE_COMMENT Number of multi-threaded flush threads
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64
-@@ -1635,10 +1635,10 @@
+@@ -1649,10 +1649,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -395,7 +395,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY YES
-@@ -1663,7 +1663,7 @@
+@@ -1677,7 +1677,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16
VARIABLE_SCOPE GLOBAL
@@ -404,7 +404,7 @@
VARIABLE_COMMENT Number of rw_locks protecting buffer pool page_hash. Rounded up to the next power of 2
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -1677,7 +1677,7 @@
+@@ -1691,7 +1691,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 16384
VARIABLE_SCOPE GLOBAL
@@ -413,7 +413,7 @@
VARIABLE_COMMENT Page size to use for all InnoDB tablespaces.
NUMERIC_MIN_VALUE 4096
NUMERIC_MAX_VALUE 65536
-@@ -1719,7 +1719,7 @@
+@@ -1733,7 +1733,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 300
VARIABLE_SCOPE GLOBAL
@@ -422,7 +422,7 @@
VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 5000
-@@ -1761,7 +1761,7 @@
+@@ -1775,7 +1775,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -431,7 +431,7 @@
VARIABLE_COMMENT Purge threads can be from 1 to 32. Default is 1.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 32
-@@ -1789,7 +1789,7 @@
+@@ -1803,7 +1803,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 56
VARIABLE_SCOPE GLOBAL
@@ -440,7 +440,7 @@
VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 64
-@@ -1803,7 +1803,7 @@
+@@ -1817,7 +1817,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
@@ -449,7 +449,7 @@
VARIABLE_COMMENT Number of background read I/O threads in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 64
-@@ -1831,10 +1831,10 @@
+@@ -1845,10 +1845,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -462,7 +462,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -1859,7 +1859,7 @@
+@@ -1873,7 +1873,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
@@ -471,7 +471,7 @@
VARIABLE_COMMENT Number of undo logs to use (deprecated).
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
-@@ -1873,7 +1873,7 @@
+@@ -1887,7 +1887,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -480,7 +480,7 @@
VARIABLE_COMMENT An InnoDB page number.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
-@@ -1929,7 +1929,7 @@
+@@ -1943,7 +1943,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1048576
VARIABLE_SCOPE GLOBAL
@@ -489,7 +489,7 @@
VARIABLE_COMMENT Memory buffer size for index creation
NUMERIC_MIN_VALUE 65536
NUMERIC_MAX_VALUE 67108864
-@@ -1943,10 +1943,10 @@
+@@ -1957,10 +1957,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 6
VARIABLE_SCOPE GLOBAL
@@ -502,7 +502,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2139,7 +2139,7 @@
+@@ -2167,7 +2167,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 1
VARIABLE_SCOPE GLOBAL
@@ -511,7 +511,7 @@
VARIABLE_COMMENT Size of the mutex/lock wait array.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1024
-@@ -2153,10 +2153,10 @@
+@@ -2181,10 +2181,10 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 30
VARIABLE_SCOPE GLOBAL
@@ -524,7 +524,7 @@
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
-@@ -2181,7 +2181,7 @@
+@@ -2209,7 +2209,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -533,7 +533,7 @@
VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000
-@@ -2195,7 +2195,7 @@
+@@ -2223,7 +2223,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10000
VARIABLE_SCOPE GLOBAL
@@ -542,7 +542,7 @@
VARIABLE_COMMENT Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 1000000
-@@ -2251,7 +2251,7 @@
+@@ -2293,7 +2293,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 128
VARIABLE_SCOPE GLOBAL
@@ -551,7 +551,7 @@
VARIABLE_COMMENT Number of undo logs to use.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 128
-@@ -2265,7 +2265,7 @@
+@@ -2307,7 +2307,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
@@ -560,7 +560,7 @@
VARIABLE_COMMENT Number of undo tablespaces to use.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 126
-@@ -2363,7 +2363,7 @@
+@@ -2405,7 +2405,7 @@
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 4
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff
index af8777c4f4b..dc9a5fd05e6 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff
@@ -1,7 +1,7 @@
--- suite/sys_vars/r/sysvars_innodb.result
+++ suite/sys_vars/r/sysvars_innodb,xtradb.reject
@@ -47,6 +47,20 @@
- ENUM_VALUE_LIST NULL
+ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME INNODB_ADAPTIVE_HASH_INDEX_PARTITIONS
@@ -22,7 +22,7 @@
SESSION_VALUE NULL
GLOBAL_VALUE 150000
@@ -355,6 +369,20 @@
- ENUM_VALUE_LIST NULL
+ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
+VARIABLE_NAME INNODB_BUFFER_POOL_POPULATE
@@ -177,7 +177,7 @@
VARIABLE_NAME INNODB_DATA_FILE_PATH
SESSION_VALUE NULL
GLOBAL_VALUE ibdata1:12M:autoextend
-@@ -761,6 +901,20 @@
+@@ -775,6 +915,20 @@
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -198,7 +198,7 @@
VARIABLE_NAME INNODB_ENCRYPTION_ROTATE_KEY_AGE
SESSION_VALUE NULL
GLOBAL_VALUE 1
-@@ -831,6 +985,20 @@
+@@ -845,6 +999,20 @@
ENUM_VALUE_LIST OFF,ON,FORCE
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -219,7 +219,7 @@
VARIABLE_NAME INNODB_FAST_SHUTDOWN
SESSION_VALUE NULL
GLOBAL_VALUE 1
-@@ -958,11 +1126,11 @@
+@@ -972,11 +1140,11 @@
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_FLUSH_LOG_AT_TRX_COMMIT
@@ -296,7 +296,7 @@
VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -1349,6 +1559,62 @@
+@@ -1363,6 +1573,62 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -359,8 +359,8 @@
VARIABLE_NAME INNODB_LOG_BUFFER_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 1048576
-@@ -1377,6 +1643,20 @@
- ENUM_VALUE_LIST NULL
+@@ -1391,6 +1657,20 @@
+ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME INNODB_LOG_CHECKSUM_ALGORITHM
@@ -380,7 +380,7 @@
VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES
SESSION_VALUE NULL
GLOBAL_VALUE ON
-@@ -1447,6 +1727,34 @@
+@@ -1461,6 +1741,34 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
@@ -415,8 +415,8 @@
VARIABLE_NAME INNODB_MAX_DIRTY_PAGES_PCT
SESSION_VALUE NULL
GLOBAL_VALUE 75.000000
-@@ -1713,6 +2021,62 @@
- ENUM_VALUE_LIST NULL
+@@ -1727,6 +2035,62 @@
+ ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME INNODB_PRIORITY_CLEANER
@@ -478,7 +478,7 @@
VARIABLE_NAME INNODB_PURGE_BATCH_SIZE
SESSION_VALUE NULL
GLOBAL_VALUE 300
-@@ -1881,6 +2245,48 @@
+@@ -1895,6 +2259,48 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -527,7 +527,7 @@
VARIABLE_NAME INNODB_SCRUB_LOG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -1909,6 +2315,34 @@
+@@ -1923,6 +2329,34 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -562,7 +562,7 @@
VARIABLE_NAME INNODB_SIMULATE_COMP_FAILURES
SESSION_VALUE NULL
GLOBAL_VALUE 0
-@@ -1972,7 +2406,7 @@
+@@ -2000,7 +2434,7 @@
DEFAULT_VALUE nulls_equal
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
@@ -571,7 +571,7 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -2217,6 +2651,34 @@
+@@ -2245,6 +2679,34 @@
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
@@ -606,7 +606,7 @@
VARIABLE_NAME INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -2294,7 +2756,7 @@
+@@ -2322,7 +2784,7 @@
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
@@ -615,8 +615,8 @@
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
-@@ -2315,6 +2777,20 @@
- ENUM_VALUE_LIST NULL
+@@ -2343,6 +2805,20 @@
+ ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT NONE
+VARIABLE_NAME INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
@@ -636,8 +636,8 @@
VARIABLE_NAME INNODB_USE_MTFLUSH
SESSION_VALUE NULL
GLOBAL_VALUE OFF
-@@ -2329,6 +2805,20 @@
- ENUM_VALUE_LIST NULL
+@@ -2357,6 +2833,20 @@
+ ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT NONE
+VARIABLE_NAME INNODB_USE_STACKTRACE
@@ -657,12 +657,12 @@
VARIABLE_NAME INNODB_USE_SYS_MALLOC
SESSION_VALUE NULL
GLOBAL_VALUE ON
-@@ -2359,12 +2849,12 @@
+@@ -2387,12 +2877,12 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
--GLOBAL_VALUE 5.6.36
-+GLOBAL_VALUE 5.6.36-82.0
+-GLOBAL_VALUE 5.6.37
++GLOBAL_VALUE 5.6.36-82.1
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 879e3df0fb0..acdbd007e6e 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -2387,7 +2387,7 @@ READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.36
+GLOBAL_VALUE 5.6.37
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/t/alter_table_online.test b/mysql-test/t/alter_table_online.test
index 15df36e8009..f5a40734535 100644
--- a/mysql-test/t/alter_table_online.test
+++ b/mysql-test/t/alter_table_online.test
@@ -285,6 +285,8 @@ CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
+# End of 10.0 tests
+
#
# MDEV-11335 Changing delay_key_write option for MyISAM table should not copy rows
#
@@ -306,3 +308,5 @@ flush tables;
insert t1 values (1,2),(2,3),(3,4);
show status like 'Feature_delay_key_write';
drop table t1;
+
+# End of 10.1 tests
diff --git a/mysql-test/t/binary_to_hex.test b/mysql-test/t/binary_to_hex.test
new file mode 100644
index 00000000000..8312a246d0c
--- /dev/null
+++ b/mysql-test/t/binary_to_hex.test
@@ -0,0 +1,76 @@
+# === Purpose ===
+# The purpose of this test case is to make
+# sure that the binary data in tables is printed
+# as hex when the option binary-as-hex is enabled.
+#
+# === Related bugs and/or worklogs ===
+# Bug #25340722 - PRINT BINARY DATA AS HEX IN THE MYSQL
+# CLIENT (CONTRIBUTION)
+#
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+--source include/not_embedded.inc
+
+USE test;
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (c1 TINYBLOB,
+ c2 BLOB,
+ c3 MEDIUMBLOB,
+ c4 LONGBLOB,
+ c5 TEXT,
+ c6 BIT(1),
+ c7 CHAR,
+ c8 VARCHAR(10),
+ c9 GEOMETRY) CHARACTER SET = binary;
+
+SHOW CREATE TABLE t1;
+
+INSERT INTO t1 VALUES ('tinyblob-text readable', 'blob-text readable',
+ 'mediumblob-text readable', 'longblob-text readable',
+ 'text readable', b'1', 'c', 'variable',
+ POINT(1, 1));
+
+CREATE TABLE t2(id int, `col1` binary(10),`col2` blob);
+
+SHOW CREATE TABLE t2;
+
+INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF');
+
+--echo #Print the table contents when binary-as-hex option is off.
+--replace_column 6 # 9 #
+SELECT * FROM t1;
+
+--replace_column 2 # 3 #
+SELECT * FROM t2;
+
+--echo #Print the table contents after turning on the binary-as-hex option
+--echo
+--echo #Print the table contents in tab format
+--echo
+--exec $MYSQL test --binary-as-hex -e "SELECT * FROM t1; SELECT * FROM t2;"
+--echo
+--echo #Print the table contents in table format
+--echo
+--exec $MYSQL test --binary-as-hex --table -e "SELECT * FROM t1; SELECT * FROM t2 WHERE col2=0x123ABC;"
+--echo
+--echo #Print the table contents vertically
+--echo
+--exec $MYSQL test --binary-as-hex --vertical -e "SELECT * FROM t1;"
+--echo
+--echo #Print the table contents in xml format
+--echo
+--exec $MYSQL test --binary-as-hex --xml -e "SELECT * FROM t1; SELECT * FROM t2;"
+--echo
+--echo #Print the table contents in html format
+--echo
+--exec $MYSQL test --binary-as-hex --html -e "SELECT * FROM t1; SELECT * FROM t2;"
+
+#Cleanup
+DROP TABLE t1, t2;
+
+# Wait till all disconnects are completed
+ --source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/count_distinct.test b/mysql-test/t/count_distinct.test
index 10b4ac6f0e7..a00574b6cba 100644
--- a/mysql-test/t/count_distinct.test
+++ b/mysql-test/t/count_distinct.test
@@ -107,3 +107,19 @@ create view v1 as select * from t1;
select count(distinct i) from v1;
drop table t1;
drop view v1;
+
+#
+# MDEV-12136 SELECT COUNT(DISTINCT) returns the wrong value when tmp_table_size is limited
+#
+create table t1 (user_id char(64) character set utf8);
+insert t1 values(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17);
+set @@tmp_table_size = 1024;
+select count(distinct user_id) from t1;
+alter table t1 modify user_id char(128) character set utf8;
+select count(distinct user_id) from t1;
+drop table t1;
+set @@tmp_table_size = default;
+
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test
index a9895506975..cf83db794cf 100644
--- a/mysql-test/t/func_regexp_pcre.test
+++ b/mysql-test/t/func_regexp_pcre.test
@@ -432,6 +432,25 @@ SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck;
SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,Golf,Hotel,India,Juliet,Kilo,Lima,Mike,StrataL3,November,Oscar,StrataL2,Sand,P3,P4SwitchTest,Arsys,Poppa,ExtensionMgr,Arp,Quebec,Romeo,StrataApiV2,PtReyes,Sierra,SandAcl,Arrow,Artools,BridgeTest,Tango,SandT,PAlaska,Namespace,Agent,Qos,PatchPanel,ProjectReport,Ark,Gimp,Agent,SliceAgent,Arnet,Bgp,Ale,Tommy,Central,AsicPktTestLib,Hsc,SandL3,Abuild,Pca9555,Standby,ControllerDut,CalSys,SandLib,Sb820,PointV2,BfnLib,Evpn,BfnSdk,Sflow,ManagementActive,AutoTest,GatedTest,Bgp,Sand,xinetd,BfnAgentLib,bf-utils,Hello,BfnState,Eos,Artest,Qos,Scd,ThermoMgr,Uniform,EosUtils,Eb,FanController,Central,BfnL3,BfnL2,tcp_wrappers,Victor,Environment,Route,Failover,Whiskey,Xray,Gimp,BfnFixed,Strata,SoCal,XApi,Msrp,XpProfile,tcpdump,PatchPanel,ArosTest,FhTest,Arbus,XpAcl,MacConc,XpApi,telnet,QosTest,Alpha2,BfnVlan,Stp,VxlanControllerTest,MplsAgent,Bravo2,Lanz,BfnMbb,Intf,XCtrl,Unicast,SandTunnel,L3Unicast,Ipsec,MplsTest,Rsvp,EthIntf,StageMgr,Sol,MplsUtils,Nat,Ira,P4NamespaceDut,Counters,Charlie2,Aqlc,Mlag,Power,OpenFlow,Lag,RestApi,BfdTest,strongs,Sfa,CEosUtils,Adt746,MaintenanceMode,MlagDut,EosImage,IpEth,MultiProtocol,Launcher,Max3179,Snmp,Acl,IpEthTest,PhyEee,bf-syslibs,tacc,XpL2,p4-ar-switch,p4-bf-switch,LdpTest,BfnPhy,Mirroring,Phy6,Ptp' REGEXP '^((?!\b(Strata|StrataApi|StrataApiV2)\b).)*$');
#
+# MDEV-13173 An RLIKE that previously worked on 10.0 now returns "Got error 'pcre_exec: recursion limit of 100 exceeded' from regexp"
+#
+SELECT CONCAT(REPEAT('100,',133),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
+--replace_regex /[0-9]+ exceeded/NUM exceeded/
+SELECT CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
+
+SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
+--replace_regex /[0-9]+ exceeded/NUM exceeded/
+SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
+
+SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
+--replace_regex /[0-9]+ exceeded/NUM exceeded/
+SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
+
+SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',133),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
+--replace_regex /[0-9]+ exceeded/NUM exceeded/
+SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
+
+#
# MDEV-12942 REGEXP_INSTR returns 1 when using brackets
#
SELECT REGEXP_INSTR('a_kollision', 'oll');
diff --git a/mysql-test/t/gis-rt-precise.test b/mysql-test/t/gis-rt-precise.test
index 4cae10a9076..9c26aa05598 100644
--- a/mysql-test/t/gis-rt-precise.test
+++ b/mysql-test/t/gis-rt-precise.test
@@ -62,3 +62,25 @@ SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
DROP TABLE t1;
--echo End of 5.5 tests.
+
+#
+# MDEV-12078 Using spatial index changes type from point to geometry.
+#
+CREATE TABLE t1 (
+ coordinate point NOT NULL,
+ SPATIAL KEY coordinate (coordinate)
+) ENGINE=Aria DEFAULT CHARSET=ascii PAGE_CHECKSUM=1;
+
+SHOW COLUMNS FROM t1;
+
+INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(0 0)"));
+INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(10 0)"));
+INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(10 10)"));
+INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(0 10)"));
+INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(5 5)"));
+
+SELECT astext(coordinate) FROM t1 WHERE ST_Intersects(ST_LineFromText("LINESTRING(0 0, 10 0, 10 10, 0 10)"), coordinate);
+
+SHOW COLUMNS FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index b7a45418706..ca43e8d4e2f 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -351,15 +351,15 @@ insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
-# Expected result is 115.31877315203187, but IA64 returns 115.31877315203188
-# due to fused multiply-add instructions.
---replace_result 115.31877315203188 115.31877315203187
+# Expected results are 115.2970604672862 and 36.23335610879993, but IA64 returns
+# slightly different values due to fused multiply-add instructions.
+--replace_result 115.29706047613604 115.2970604672862 36.23335611157958 36.23335610879993
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85998;
-# Expected result is 36.3310176346905, but IA64 returns 36.3310176346904
+# Expected result is 36.34725218253213, but IA64 returns 36.34725217627852
# due to fused multiply-add instructions.
---replace_result 36.3310176346904 36.3310176346905 -114.87787186923326 -114.87787186923313 36.33101763469053 36.33101763469059 36.33101763469043 36.33101763469059
+--replace_result 36.34725217627852 36.34725218253213 -114.86854470090232 -114.86854472054372
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85984;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 334d9272e71..46d341affb4 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1726,6 +1726,44 @@ select a as x from t1 group by x having x > 1;
select a from t1 group by a having a > 1;
drop table t1;
set sql_mode= @save_sql_mode;
+
+#
+# MDEV-7826 Server crashes in Item_subselect::enumerate_field_refs_processor
+#
+create table t1 (f1 int);
+insert into t1 values (5),(9);
+create table t2 (f2 int);
+insert into t2 values (0),(6);
+create table t3 (f3 int);
+insert into t3 values (6),(3);
+create table t4 (f4 int);
+insert into t4 values (1),(0);
+--error ER_ILLEGAL_REFERENCE
+select
+(select min(f1) from t1 where f1 in (select min(f4) from t2)) as field7,
+(select count(*) from t3 where f3 in (select max(f4) from t2 group by field7))
+from t4;
+drop table t1, t2, t3, t4;
+
+#
+# MDEV-13180 Unused left join causes server crash
+#
+create table t1 (i1 int);
+insert into t1 values (1);
+create table t2 (i int);
+insert into t2 values (2);
+select 1 from t1 left join t2 b on b.i = (select max(b.i) from t2);
+drop table t1, t2;
+
+
+#
+# MDEV-12489 The select stmt may fail due to "having clause is ambiguous" unexpected
+#
+create table t1 (c1 int, c2 int);
+create table t2 (c1 int, c2 int);
+select t1.c1 as c1, t2.c2 as c1 from t1, t2 where t1.c1 < 20 and t2.c2 > 5 group by t1.c1, t2.c2 having t1.c1 < 3;
+drop table t1, t2;
+
#
# End of MariaDB 5.5 tests
#
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 9d33dd70e3a..681e47f778a 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -1,6 +1,7 @@
-- source include/mysql_upgrade_preparation.inc
-- source include/have_working_dns.inc
-- source include/have_innodb.inc
+-- source include/have_partition.inc
set sql_mode="";
@@ -168,6 +169,31 @@ SELECT grantor FROM mysql.tables_priv WHERE db = 'mysql' AND table_name = 'user'
DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost;
DROP PROCEDURE test.pr;
+#
+# MDEV-13274 mysql_upgrade fails if dbname+tablename+partioname > 64 chars
+#
+use test;
+call mtr.add_suppression('Column last_update in table "mysql"."innodb_table_stats" is INT NOT NULL but should be');
+alter table mysql.innodb_table_stats modify last_update int not null;
+
+create table extralongname_extralongname_extralongname_extralongname_ext (
+ id int(10) unsigned not null,
+ created_date date not null,
+ created timestamp not null,
+ primary key (created,id,created_date)
+) engine=innodb stats_persistent=1 default charset=latin1
+ partition by range (year(created_date))
+ subpartition by hash (month(created_date))
+ subpartitions 2 (
+ partition p2007 values less than (2008),
+ partition p2008 values less than (2009)
+ );
+--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
+select length(table_name) from mysql.innodb_table_stats;
+drop table extralongname_extralongname_extralongname_extralongname_ext;
+
+--echo End of 10.0 tests
+
set sql_mode=default;
#
@@ -192,4 +218,4 @@ DROP TABLE test.t1;
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
SET GLOBAL enforce_storage_engine=NULL;
---echo End of tests
+--echo End of 10.1 tests
diff --git a/mysql-test/t/read_only.test b/mysql-test/t/read_only.test
index 3e5d4fc8ce1..cd556684e4c 100644
--- a/mysql-test/t/read_only.test
+++ b/mysql-test/t/read_only.test
@@ -84,6 +84,9 @@ insert into t3 values(1);
insert into t4 select * from t3;
+--error ER_OPTION_PREVENTS_STATEMENT
+create table t3 (a int);
+
# a non-temp table updated:
--error ER_OPTION_PREVENTS_STATEMENT
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index bc84b6b9e26..e0e3ed1a14c 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -6055,6 +6055,23 @@ SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
drop view v1;
drop table t1,t2;
+#
+# MDEV-7828 Assertion `key_read == 0' failed in TABLE::enable_keyread with SELECT SQ and WHERE SQ
+#
+CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=MyISAM;
+INSERT t1 VALUES (4),(8);
+CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM;
+INSERT t2 VALUES (6);
+SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+--echo #
+--echo # Disable this query till MDEV-13399 is resolved
+--echo #
+--echo # INSERT t2 VALUES (9);
+--echo # --error ER_SUBQUERY_NO_1_ROW
+--echo # SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
+--echo #
+drop table t1, t2;
+
--echo # End of 10.0 tests
--echo #
diff --git a/mysql-test/t/subselect_nulls.test b/mysql-test/t/subselect_nulls.test
index 4b08e773b17..3e7b2189ed5 100644
--- a/mysql-test/t/subselect_nulls.test
+++ b/mysql-test/t/subselect_nulls.test
@@ -97,3 +97,9 @@ set optimizer_switch= @tmp_subselect_nulls;
drop table x1;
drop table x2;
+
+#
+# MDEV-7339 Server crashes in Item_func_trig_cond::val_int
+#
+select (select 1, 2) in (select 3, 4);
+select (select NULL, NULL) in (select 3, 4);
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 0580ee305c3..059bf9154cb 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1405,6 +1405,20 @@ drop table t1;
--echo End of 5.0 tests
+#
+# Bug #24595639: INCORRECT BEHAVIOR IN QUERY WITH UNION AND GROUP BY
+#
+create table t1 (a int, b int);
+insert into t1 values (1,1),(2,2),(3,3);
+create table t2 (c varchar(30), d varchar(30));
+insert into t1 values ('1','1'),('2','2'),('4','4');
+create table t3 (e int, f int);
+insert into t3 values (1,1),(2,2),(31,31),(32,32);
+select e,f, (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3;
+select avg(f), (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3 group by sub;
+drop table t1,t2,t3;
+
+--echo End of 5.5 tests
--echo #
--echo # WL#1763 Avoid creating temporary table in UNION ALL
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 48ff2285341..a1ebc683ed6 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -5577,6 +5577,22 @@ select *
drop view v1;
drop table t1,t2,t3;
+--echo #
+--echo # MDEV-11240: Server crashes in check_view_single_update or
+--echo # Assertion `derived->table' failed in mysql_derived_merge_for_insert
+--echo #
+
+CREATE TABLE t3 (a INT);
+CREATE ALGORITHM = MERGE VIEW v1 AS SELECT t2.a FROM t3 AS t1, t3 AS t2;
+CREATE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM v1;
+PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
+--error ER_VIEW_NO_INSERT_FIELD_LIST
+EXECUTE stmt;
+--error ER_VIEW_NO_INSERT_FIELD_LIST
+EXECUTE stmt;
+drop view v1,v2;
+drop table t3;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------
diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c
index 0bb431dd560..c720e2c9168 100644
--- a/mysys/my_fopen.c
+++ b/mysys/my_fopen.c
@@ -142,7 +142,7 @@ static int no_close(void *cookie __attribute__((unused)))
/*
A hack around a race condition in the implementation of freopen.
- The race condition steams from the fact that the current fd of
+ The race condition stems from the fact that the current fd of
the stream is closed before its number is used to duplicate the
new file descriptor. This defeats the desired atomicity of the
close and duplicate of dup2().
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c
index 395659238b3..0d4d5fce803 100644
--- a/mysys/stacktrace.c
+++ b/mysys/stacktrace.c
@@ -765,7 +765,7 @@ int my_safe_print_str(const char *val, int len)
size_t my_write_stderr(const void *buf, size_t count)
{
- return (size_t) write(STDERR_FILENO, buf, count);
+ return (size_t) write(fileno(stderr), buf, count);
}
diff --git a/pcre/ChangeLog b/pcre/ChangeLog
index 01511b1327c..590a7542885 100644
--- a/pcre/ChangeLog
+++ b/pcre/ChangeLog
@@ -4,6 +4,53 @@ ChangeLog for PCRE
Note that the PCRE 8.xx series (PCRE1) is now in a bugfix-only state. All
development is happening in the PCRE2 10.xx series.
+Version 8.41 05-July-2017
+-------------------------
+
+1. Fixed typo in CMakeLists.txt (wrong number of arguments for
+PCRE_STATIC_RUNTIME (affects MSVC only).
+
+2. Issue 1 for 8.40 below was not correctly fixed. If pcregrep in multiline
+mode with --only-matching matched several lines, it restarted scanning at the
+next line instead of moving on to the end of the matched string, which can be
+several lines after the start.
+
+3. Fix a missing else in the JIT compiler reported by 'idaifish'.
+
+4. A (?# style comment is now ignored between a basic quantifier and a
+following '+' or '?' (example: /X+(?#comment)?Y/.
+
+5. Avoid use of a potentially overflowing buffer in pcregrep (patch by Petr
+Pisar).
+
+6. Fuzzers have reported issues in pcretest. These are NOT serious (it is,
+after all, just a test program). However, to stop the reports, some easy ones
+are fixed:
+
+ (a) Check for values < 256 when calling isprint() in pcretest.
+ (b) Give an error for too big a number after \O.
+
+7. In the 32-bit library in non-UTF mode, an attempt to find a Unicode
+property for a character with a code point greater than 0x10ffff (the Unicode
+maximum) caused a crash.
+
+8. The alternative matching function, pcre_dfa_exec() misbehaved if it
+encountered a character class with a possessive repeat, for example [a-f]{3}+.
+
+9. When pcretest called pcre_copy_substring() in 32-bit mode, it set the buffer
+length incorrectly, which could result in buffer overflow.
+
+10. Remove redundant line of code (accidentally left in ages ago).
+
+11. Applied C++ patch from Irfan Adilovic to guard 'using std::' directives
+with namespace pcrecpp (Bugzilla #2084).
+
+12. Remove a duplication typo in pcre_tables.c.
+
+13. Fix returned offsets from regexec() when REG_STARTEND is used with a
+starting offset greater than zero.
+
+
Version 8.40 11-January-2017
----------------------------
diff --git a/pcre/NEWS b/pcre/NEWS
index b92c4f9605e..36be07cb880 100644
--- a/pcre/NEWS
+++ b/pcre/NEWS
@@ -1,6 +1,12 @@
News about PCRE releases
------------------------
+Release 8.41 13-June-2017
+-------------------------
+
+This is a bug-fix release.
+
+
Release 8.40 11-January-2017
----------------------------
diff --git a/pcre/configure.ac b/pcre/configure.ac
index 24ef7271e05..718a18508c9 100644
--- a/pcre/configure.ac
+++ b/pcre/configure.ac
@@ -9,18 +9,18 @@ dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might
dnl be defined as -RC2, for example. For real releases, it should be empty.
m4_define(pcre_major, [8])
-m4_define(pcre_minor, [40])
+m4_define(pcre_minor, [41])
m4_define(pcre_prerelease, [])
-m4_define(pcre_date, [2017-01-11])
+m4_define(pcre_date, [2017-07-05])
# NOTE: The CMakeLists.txt file searches for the above variables in the first
# 50 lines of this file. Please update that if the variables above are moved.
# Libtool shared library interface versions (current:revision:age)
-m4_define(libpcre_version, [3:8:2])
-m4_define(libpcre16_version, [2:8:2])
-m4_define(libpcre32_version, [0:8:0])
-m4_define(libpcreposix_version, [0:4:0])
+m4_define(libpcre_version, [3:9:2])
+m4_define(libpcre16_version, [2:9:2])
+m4_define(libpcre32_version, [0:9:0])
+m4_define(libpcreposix_version, [0:5:0])
m4_define(libpcrecpp_version, [0:1:0])
AC_PREREQ(2.57)
diff --git a/pcre/doc/html/pcrejit.html b/pcre/doc/html/pcrejit.html
index 210f1da0262..abb342522f9 100644
--- a/pcre/doc/html/pcrejit.html
+++ b/pcre/doc/html/pcrejit.html
@@ -79,9 +79,12 @@ API that is JIT-specific.
</P>
<P>
If your program may sometimes be linked with versions of PCRE that are older
-than 8.20, but you want to use JIT when it is available, you can test
-the values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such
-as PCRE_CONFIG_JIT, for compile-time control of your code.
+than 8.20, but you want to use JIT when it is available, you can test the
+values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such as
+PCRE_CONFIG_JIT, for compile-time control of your code. Also beware that the
+<b>pcre_jit_exec()</b> function was not available at all before 8.32,
+and may not be available at all if PCRE isn't compiled with
+--enable-jit. See the "JIT FAST PATH API" section below for details.
</P>
<br><a name="SEC4" href="#TOC1">SIMPLE USE OF JIT</a><br>
<P>
@@ -119,6 +122,20 @@ when you call <b>pcre_study()</b>:
PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE
PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE
</pre>
+If using <b>pcre_jit_exec()</b> and supporting a pre-8.32 version of
+PCRE, you can insert:
+<pre>
+ #if PCRE_MAJOR &#62;= 8 && PCRE_MINOR &#62;= 32
+ pcre_jit_exec(...);
+ #else
+ pcre_exec(...)
+ #endif
+</pre>
+but as described in the "JIT FAST PATH API" section below this assumes
+version 8.32 and later are compiled with --enable-jit, which may
+break.
+<br>
+<br>
The JIT compiler generates different optimized code for each of the three
modes (normal, soft partial, hard partial). When <b>pcre_exec()</b> is called,
the appropriate code is run if it is available. Otherwise, the pattern is
@@ -428,6 +445,36 @@ fast path, and if invalid data is passed, the result is undefined.
Bypassing the sanity checks and the <b>pcre_exec()</b> wrapping can give
speedups of more than 10%.
</P>
+<P>
+Note that the <b>pcre_jit_exec()</b> function is not available in versions of
+PCRE before 8.32 (released in November 2012). If you need to support versions
+that old you must either use the slower <b>pcre_exec()</b>, or switch between
+the two codepaths by checking the values of PCRE_MAJOR and PCRE_MINOR.
+</P>
+<P>
+Due to an unfortunate implementation oversight, even in versions 8.32
+and later there will be no <b>pcre_jit_exec()</b> stub function defined
+when PCRE is compiled with --disable-jit, which is the default, and
+there's no way to detect whether PCRE was compiled with --enable-jit
+via a macro.
+</P>
+<P>
+If you need to support versions older than 8.32, or versions that may
+not build with --enable-jit, you must either use the slower
+<b>pcre_exec()</b>, or switch between the two codepaths by checking the
+values of PCRE_MAJOR and PCRE_MINOR.
+</P>
+<P>
+Switching between the two by checking the version assumes that all the
+versions being targeted are built with --enable-jit. To also support
+builds that may use --disable-jit either <b>pcre_exec()</b> must be
+used, or a compile-time check for JIT via <b>pcre_config()</b> (which
+assumes the runtime environment will be the same), or as the Git
+project decided to do, simply assume that <b>pcre_jit_exec()</b> is
+present in 8.32 or later unless a compile-time flag is provided, see
+the "grep: un-break building with PCRE &#62;= 8.32 without --enable-jit"
+commit in git.git for an example of that.
+</P>
<br><a name="SEC12" href="#TOC1">SEE ALSO</a><br>
<P>
<b>pcreapi</b>(3)
@@ -443,9 +490,9 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC14" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 17 March 2013
+Last updated: 05 July 2017
<br>
-Copyright &copy; 1997-2013 University of Cambridge.
+Copyright &copy; 1997-2017 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE index page</a>.
diff --git a/pcre/doc/html/pcretest.html b/pcre/doc/html/pcretest.html
index 839fabf189b..ba540d3c385 100644
--- a/pcre/doc/html/pcretest.html
+++ b/pcre/doc/html/pcretest.html
@@ -74,6 +74,11 @@ newline as data characters. However, in some Windows environments character 26
maximum portability, therefore, it is safest to use only ASCII characters in
<b>pcretest</b> input files.
</P>
+<P>
+The input is processed using using C's string functions, so must not
+contain binary zeroes, even though in Unix-like environments, <b>fgets()</b>
+treats any bytes other than newline as data characters.
+</P>
<br><a name="SEC3" href="#TOC1">PCRE's 8-BIT, 16-BIT AND 32-BIT LIBRARIES</a><br>
<P>
From release 8.30, two separate PCRE libraries can be built. The original one
@@ -1149,9 +1154,9 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC17" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 09 February 2014
+Last updated: 23 February 2017
<br>
-Copyright &copy; 1997-2014 University of Cambridge.
+Copyright &copy; 1997-2017 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE index page</a>.
diff --git a/pcre/doc/pcre.txt b/pcre/doc/pcre.txt
index d68d5033ceb..c027538f500 100644
--- a/pcre/doc/pcre.txt
+++ b/pcre/doc/pcre.txt
@@ -8365,7 +8365,11 @@ AVAILABILITY OF JIT SUPPORT
If your program may sometimes be linked with versions of PCRE that are
older than 8.20, but you want to use JIT when it is available, you can
test the values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT
- macro such as PCRE_CONFIG_JIT, for compile-time control of your code.
+ macro such as PCRE_CONFIG_JIT, for compile-time control of your code.
+ Also beware that the pcre_jit_exec() function was not available at all
+ before 8.32, and may not be available at all if PCRE isn't compiled
+ with --enable-jit. See the "JIT FAST PATH API" section below for
+ details.
SIMPLE USE OF JIT
@@ -8407,6 +8411,18 @@ SIMPLE USE OF JIT
PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE
PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE
+ If using pcre_jit_exec() and supporting a pre-8.32 version of PCRE, you
+ can insert:
+
+ #if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32
+ pcre_jit_exec(...);
+ #else
+ pcre_exec(...)
+ #endif
+
+ but as described in the "JIT FAST PATH API" section below this assumes
+ version 8.32 and later are compiled with --enable-jit, which may break.
+
The JIT compiler generates different optimized code for each of the
three modes (normal, soft partial, hard partial). When pcre_exec() is
called, the appropriate code is run if it is available. Otherwise, the
@@ -8696,6 +8712,33 @@ JIT FAST PATH API
Bypassing the sanity checks and the pcre_exec() wrapping can give
speedups of more than 10%.
+ Note that the pcre_jit_exec() function is not available in versions of
+ PCRE before 8.32 (released in November 2012). If you need to support
+ versions that old you must either use the slower pcre_exec(), or switch
+ between the two codepaths by checking the values of PCRE_MAJOR and
+ PCRE_MINOR.
+
+ Due to an unfortunate implementation oversight, even in versions 8.32
+ and later there will be no pcre_jit_exec() stub function defined when
+ PCRE is compiled with --disable-jit, which is the default, and there's
+ no way to detect whether PCRE was compiled with --enable-jit via a
+ macro.
+
+ If you need to support versions older than 8.32, or versions that may
+ not build with --enable-jit, you must either use the slower
+ pcre_exec(), or switch between the two codepaths by checking the values
+ of PCRE_MAJOR and PCRE_MINOR.
+
+ Switching between the two by checking the version assumes that all the
+ versions being targeted are built with --enable-jit. To also support
+ builds that may use --disable-jit either pcre_exec() must be used, or a
+ compile-time check for JIT via pcre_config() (which assumes the runtime
+ environment will be the same), or as the Git project decided to do,
+ simply assume that pcre_jit_exec() is present in 8.32 or later unless a
+ compile-time flag is provided, see the "grep: un-break building with
+ PCRE >= 8.32 without --enable-jit" commit in git.git for an example of
+ that.
+
SEE ALSO
@@ -8711,8 +8754,8 @@ AUTHOR
REVISION
- Last updated: 17 March 2013
- Copyright (c) 1997-2013 University of Cambridge.
+ Last updated: 05 July 2017
+ Copyright (c) 1997-2017 University of Cambridge.
------------------------------------------------------------------------------
diff --git a/pcre/doc/pcrejit.3 b/pcre/doc/pcrejit.3
index 341403f7c84..3b785f0f631 100644
--- a/pcre/doc/pcrejit.3
+++ b/pcre/doc/pcrejit.3
@@ -1,4 +1,4 @@
-.TH PCREJIT 3 "17 March 2013" "PCRE 8.33"
+.TH PCREJIT 3 "05 July 2017" "PCRE 8.41"
.SH NAME
PCRE - Perl-compatible regular expressions
.SH "PCRE JUST-IN-TIME COMPILER SUPPORT"
@@ -54,9 +54,12 @@ programs that need the best possible performance, there is also a "fast path"
API that is JIT-specific.
.P
If your program may sometimes be linked with versions of PCRE that are older
-than 8.20, but you want to use JIT when it is available, you can test
-the values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such
-as PCRE_CONFIG_JIT, for compile-time control of your code.
+than 8.20, but you want to use JIT when it is available, you can test the
+values of PCRE_MAJOR and PCRE_MINOR, or the existence of a JIT macro such as
+PCRE_CONFIG_JIT, for compile-time control of your code. Also beware that the
+\fBpcre_jit_exec()\fP function was not available at all before 8.32,
+and may not be available at all if PCRE isn't compiled with
+--enable-jit. See the "JIT FAST PATH API" section below for details.
.
.
.SH "SIMPLE USE OF JIT"
@@ -96,6 +99,19 @@ when you call \fBpcre_study()\fP:
PCRE_STUDY_JIT_PARTIAL_HARD_COMPILE
PCRE_STUDY_JIT_PARTIAL_SOFT_COMPILE
.sp
+If using \fBpcre_jit_exec()\fP and supporting a pre-8.32 version of
+PCRE, you can insert:
+.sp
+ #if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32
+ pcre_jit_exec(...);
+ #else
+ pcre_exec(...)
+ #endif
+.sp
+but as described in the "JIT FAST PATH API" section below this assumes
+version 8.32 and later are compiled with --enable-jit, which may
+break.
+.sp
The JIT compiler generates different optimized code for each of the three
modes (normal, soft partial, hard partial). When \fBpcre_exec()\fP is called,
the appropriate code is run if it is available. Otherwise, the pattern is
@@ -404,6 +420,32 @@ fast path, and if invalid data is passed, the result is undefined.
.P
Bypassing the sanity checks and the \fBpcre_exec()\fP wrapping can give
speedups of more than 10%.
+.P
+Note that the \fBpcre_jit_exec()\fP function is not available in versions of
+PCRE before 8.32 (released in November 2012). If you need to support versions
+that old you must either use the slower \fBpcre_exec()\fP, or switch between
+the two codepaths by checking the values of PCRE_MAJOR and PCRE_MINOR.
+.P
+Due to an unfortunate implementation oversight, even in versions 8.32
+and later there will be no \fBpcre_jit_exec()\fP stub function defined
+when PCRE is compiled with --disable-jit, which is the default, and
+there's no way to detect whether PCRE was compiled with --enable-jit
+via a macro.
+.P
+If you need to support versions older than 8.32, or versions that may
+not build with --enable-jit, you must either use the slower
+\fBpcre_exec()\fP, or switch between the two codepaths by checking the
+values of PCRE_MAJOR and PCRE_MINOR.
+.P
+Switching between the two by checking the version assumes that all the
+versions being targeted are built with --enable-jit. To also support
+builds that may use --disable-jit either \fBpcre_exec()\fP must be
+used, or a compile-time check for JIT via \fBpcre_config()\fP (which
+assumes the runtime environment will be the same), or as the Git
+project decided to do, simply assume that \fBpcre_jit_exec()\fP is
+present in 8.32 or later unless a compile-time flag is provided, see
+the "grep: un-break building with PCRE >= 8.32 without --enable-jit"
+commit in git.git for an example of that.
.
.
.SH "SEE ALSO"
@@ -426,6 +468,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 17 March 2013
-Copyright (c) 1997-2013 University of Cambridge.
+Last updated: 05 July 2017
+Copyright (c) 1997-2017 University of Cambridge.
.fi
diff --git a/pcre/doc/pcretest.1 b/pcre/doc/pcretest.1
index 92640da8e1b..ea7457c03d0 100644
--- a/pcre/doc/pcretest.1
+++ b/pcre/doc/pcretest.1
@@ -1,4 +1,4 @@
-.TH PCRETEST 1 "09 February 2014" "PCRE 8.35"
+.TH PCRETEST 1 "23 February 2017" "PCRE 8.41"
.SH NAME
pcretest - a program for testing Perl-compatible regular expressions.
.SH SYNOPSIS
@@ -50,6 +50,10 @@ newline as data characters. However, in some Windows environments character 26
(hex 1A) causes an immediate end of file, and no further data is read. For
maximum portability, therefore, it is safest to use only ASCII characters in
\fBpcretest\fP input files.
+.P
+The input is processed using using C's string functions, so must not
+contain binary zeroes, even though in Unix-like environments, \fBfgets()\fP
+treats any bytes other than newline as data characters.
.
.
.SH "PCRE's 8-BIT, 16-BIT AND 32-BIT LIBRARIES"
@@ -1151,6 +1155,6 @@ Cambridge CB2 3QH, England.
.rs
.sp
.nf
-Last updated: 09 February 2014
-Copyright (c) 1997-2014 University of Cambridge.
+Last updated: 23 February 2017
+Copyright (c) 1997-2017 University of Cambridge.
.fi
diff --git a/pcre/doc/pcretest.txt b/pcre/doc/pcretest.txt
index 55de5024431..6d7305cfe82 100644
--- a/pcre/doc/pcretest.txt
+++ b/pcre/doc/pcretest.txt
@@ -39,6 +39,10 @@ INPUT DATA FORMAT
For maximum portability, therefore, it is safest to use only ASCII
characters in pcretest input files.
+ The input is processed using using C's string functions, so must not
+ contain binary zeroes, even though in Unix-like environments, fgets()
+ treats any bytes other than newline as data characters.
+
PCRE's 8-BIT, 16-BIT AND 32-BIT LIBRARIES
@@ -1083,5 +1087,5 @@ AUTHOR
REVISION
- Last updated: 09 February 2014
- Copyright (c) 1997-2014 University of Cambridge.
+ Last updated: 23 February 2017
+ Copyright (c) 1997-2017 University of Cambridge.
diff --git a/pcre/pcre_compile.c b/pcre/pcre_compile.c
index de92313e2f8..42f204cdfff 100644
--- a/pcre/pcre_compile.c
+++ b/pcre/pcre_compile.c
@@ -5739,6 +5739,21 @@ for (;; ptr++)
ptr = p - 1; /* Character before the next significant one. */
}
+ /* We also need to skip over (?# comments, which are not dependent on
+ extended mode. */
+
+ if (ptr[1] == CHAR_LEFT_PARENTHESIS && ptr[2] == CHAR_QUESTION_MARK &&
+ ptr[3] == CHAR_NUMBER_SIGN)
+ {
+ ptr += 4;
+ while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
+ if (*ptr == CHAR_NULL)
+ {
+ *errorcodeptr = ERR18;
+ goto FAILED;
+ }
+ }
+
/* If the next character is '+', we have a possessive quantifier. This
implies greediness, whatever the setting of the PCRE_UNGREEDY option.
If the next character is '?' this is a minimizing repeat, by default,
@@ -8210,7 +8225,6 @@ for (;; ptr++)
if (mclength == 1 || req_caseopt == 0)
{
- firstchar = mcbuffer[0] | req_caseopt;
firstchar = mcbuffer[0];
firstcharflags = req_caseopt;
diff --git a/pcre/pcre_dfa_exec.c b/pcre/pcre_dfa_exec.c
index 170ce6a0016..bc09ced3a7c 100644
--- a/pcre/pcre_dfa_exec.c
+++ b/pcre/pcre_dfa_exec.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language (but see
below for why this module is different).
Written by Philip Hazel
- Copyright (c) 1997-2014 University of Cambridge
+ Copyright (c) 1997-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -2625,7 +2625,7 @@ for (;;)
if (isinclass)
{
int max = (int)GET2(ecode, 1 + IMM2_SIZE);
- if (*ecode == OP_CRPOSRANGE)
+ if (*ecode == OP_CRPOSRANGE && count >= (int)GET2(ecode, 1))
{
active_count--; /* Remove non-match possibility */
next_active_state--;
diff --git a/pcre/pcre_exec.c b/pcre/pcre_exec.c
index 24b23ca2864..1a9bdd546ee 100644
--- a/pcre/pcre_exec.c
+++ b/pcre/pcre_exec.c
@@ -669,7 +669,7 @@ if (ecode == NULL)
return match((PCRE_PUCHAR)&rdepth, NULL, NULL, 0, NULL, NULL, 1);
else
{
- int len = (char *)&rdepth - (char *)eptr;
+ int len = (int)((char *)&rdepth - (char *)eptr);
return (len > 0)? -len : len;
}
}
diff --git a/pcre/pcre_internal.h b/pcre/pcre_internal.h
index 2923b29f82d..97ff55d03b3 100644
--- a/pcre/pcre_internal.h
+++ b/pcre/pcre_internal.h
@@ -2772,6 +2772,9 @@ extern const pcre_uint8 PRIV(ucd_stage1)[];
extern const pcre_uint16 PRIV(ucd_stage2)[];
extern const pcre_uint32 PRIV(ucp_gentype)[];
extern const pcre_uint32 PRIV(ucp_gbtable)[];
+#ifdef COMPILE_PCRE32
+extern const ucd_record PRIV(dummy_ucd_record)[];
+#endif
#ifdef SUPPORT_JIT
extern const int PRIV(ucp_typerange)[];
#endif
@@ -2780,10 +2783,16 @@ extern const int PRIV(ucp_typerange)[];
/* UCD access macros */
#define UCD_BLOCK_SIZE 128
-#define GET_UCD(ch) (PRIV(ucd_records) + \
+#define REAL_GET_UCD(ch) (PRIV(ucd_records) + \
PRIV(ucd_stage2)[PRIV(ucd_stage1)[(int)(ch) / UCD_BLOCK_SIZE] * \
UCD_BLOCK_SIZE + (int)(ch) % UCD_BLOCK_SIZE])
+#ifdef COMPILE_PCRE32
+#define GET_UCD(ch) ((ch > 0x10ffff)? PRIV(dummy_ucd_record) : REAL_GET_UCD(ch))
+#else
+#define GET_UCD(ch) REAL_GET_UCD(ch)
+#endif
+
#define UCD_CHARTYPE(ch) GET_UCD(ch)->chartype
#define UCD_SCRIPT(ch) GET_UCD(ch)->script
#define UCD_CATEGORY(ch) PRIV(ucp_gentype)[UCD_CHARTYPE(ch)]
diff --git a/pcre/pcre_jit_compile.c b/pcre/pcre_jit_compile.c
index 46ce6c65d54..249edbe8e7f 100644
--- a/pcre/pcre_jit_compile.c
+++ b/pcre/pcre_jit_compile.c
@@ -487,7 +487,7 @@ typedef struct compare_context {
#undef CMP
/* Used for accessing the elements of the stack. */
-#define STACK(i) ((-(i) - 1) * (int)sizeof(sljit_sw))
+#define STACK(i) ((i) * (int)sizeof(sljit_sw))
#define TMP1 SLJIT_R0
#define TMP2 SLJIT_R2
@@ -552,13 +552,15 @@ the start pointers when the end of the capturing group has not yet reached. */
sljit_emit_cmp(compiler, (type), (src1), (src1w), (src2), (src2w))
#define CMPTO(type, src1, src1w, src2, src2w, label) \
sljit_set_label(sljit_emit_cmp(compiler, (type), (src1), (src1w), (src2), (src2w)), (label))
-#define OP_FLAGS(op, dst, dstw, src, srcw, type) \
- sljit_emit_op_flags(compiler, (op), (dst), (dstw), (src), (srcw), (type))
+#define OP_FLAGS(op, dst, dstw, type) \
+ sljit_emit_op_flags(compiler, (op), (dst), (dstw), (type))
#define GET_LOCAL_BASE(dst, dstw, offset) \
sljit_get_local_base(compiler, (dst), (dstw), (offset))
#define READ_CHAR_MAX 0x7fffffff
+#define INVALID_UTF_CHAR 888
+
static pcre_uchar *bracketend(pcre_uchar *cc)
{
SLJIT_ASSERT((*cc >= OP_ASSERT && *cc <= OP_ASSERTBACK_NOT) || (*cc >= OP_ONCE && *cc <= OP_SCOND));
@@ -784,7 +786,7 @@ switch(*cc)
default:
/* All opcodes are supported now! */
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return NULL;
}
}
@@ -1660,9 +1662,9 @@ while (cc < ccend)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -OVECTOR(0));
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setsom_found = TRUE;
}
cc += 1;
@@ -1676,9 +1678,9 @@ while (cc < ccend)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setmark_found = TRUE;
}
cc += 1 + 2 + cc[1];
@@ -1689,27 +1691,27 @@ while (cc < ccend)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -OVECTOR(0));
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setsom_found = TRUE;
}
if (common->mark_ptr != 0 && !setmark_found)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->mark_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
setmark_found = TRUE;
}
if (common->capture_last_ptr != 0 && !capture_last_found)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
capture_last_found = TRUE;
}
cc += 1 + LINK_SIZE;
@@ -1723,20 +1725,20 @@ while (cc < ccend)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->capture_last_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, -common->capture_last_ptr);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
capture_last_found = TRUE;
}
offset = (GET2(cc, 1 + LINK_SIZE)) << 1;
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, SLJIT_IMM, OVECTOR(offset));
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset));
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP1, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), stackpos, TMP2, 0);
- stackpos += (int)sizeof(sljit_sw);
+ stackpos -= (int)sizeof(sljit_sw);
cc += 1 + LINK_SIZE + IMM2_SIZE;
break;
@@ -1887,18 +1889,17 @@ BOOL tmp1empty = TRUE;
BOOL tmp2empty = TRUE;
pcre_uchar *alternative;
enum {
- start,
loop,
end
} status;
-status = save ? start : loop;
-stackptr = STACK(stackptr - 2);
+status = loop;
+stackptr = STACK(stackptr);
stacktop = STACK(stacktop - 1);
if (!save)
{
- stackptr += (needs_control_head ? 2 : 1) * sizeof(sljit_sw);
+ stacktop -= (needs_control_head ? 2 : 1) * sizeof(sljit_sw);
if (stackptr < stacktop)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), stackptr);
@@ -1914,196 +1915,186 @@ if (!save)
/* The tmp1next must be TRUE in either way. */
}
+SLJIT_ASSERT(common->recursive_head_ptr != 0);
+
do
{
count = 0;
- switch(status)
+ if (cc >= ccend)
{
- case start:
- SLJIT_ASSERT(save && common->recursive_head_ptr != 0);
+ if (!save)
+ break;
+
count = 1;
srcw[0] = common->recursive_head_ptr;
if (needs_control_head)
{
SLJIT_ASSERT(common->control_head_ptr != 0);
count = 2;
- srcw[1] = common->control_head_ptr;
+ srcw[0] = common->control_head_ptr;
+ srcw[1] = common->recursive_head_ptr;
+ }
+ status = end;
+ }
+ else switch(*cc)
+ {
+ case OP_KET:
+ if (PRIVATE_DATA(cc) != 0)
+ {
+ count = 1;
+ srcw[0] = PRIVATE_DATA(cc);
+ SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
+ cc += PRIVATE_DATA(cc + 1);
}
- status = loop;
+ cc += 1 + LINK_SIZE;
+ break;
+
+ case OP_ASSERT:
+ case OP_ASSERT_NOT:
+ case OP_ASSERTBACK:
+ case OP_ASSERTBACK_NOT:
+ case OP_ONCE:
+ case OP_ONCE_NC:
+ case OP_BRAPOS:
+ case OP_SBRA:
+ case OP_SBRAPOS:
+ case OP_SCOND:
+ count = 1;
+ srcw[0] = PRIVATE_DATA(cc);
+ SLJIT_ASSERT(srcw[0] != 0);
+ cc += 1 + LINK_SIZE;
break;
- case loop:
- if (cc >= ccend)
+ case OP_CBRA:
+ case OP_SCBRA:
+ if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
{
- status = end;
- break;
+ count = 1;
+ srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
}
+ cc += 1 + LINK_SIZE + IMM2_SIZE;
+ break;
- switch(*cc)
- {
- case OP_KET:
- if (PRIVATE_DATA(cc) != 0)
- {
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
- cc += PRIVATE_DATA(cc + 1);
- }
- cc += 1 + LINK_SIZE;
- break;
+ case OP_CBRAPOS:
+ case OP_SCBRAPOS:
+ count = 2;
+ srcw[0] = PRIVATE_DATA(cc);
+ srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
+ SLJIT_ASSERT(srcw[0] != 0 && srcw[1] != 0);
+ cc += 1 + LINK_SIZE + IMM2_SIZE;
+ break;
- case OP_ASSERT:
- case OP_ASSERT_NOT:
- case OP_ASSERTBACK:
- case OP_ASSERTBACK_NOT:
- case OP_ONCE:
- case OP_ONCE_NC:
- case OP_BRAPOS:
- case OP_SBRA:
- case OP_SBRAPOS:
- case OP_SCOND:
+ case OP_COND:
+ /* Might be a hidden SCOND. */
+ alternative = cc + GET(cc, 1);
+ if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
+ {
count = 1;
srcw[0] = PRIVATE_DATA(cc);
SLJIT_ASSERT(srcw[0] != 0);
- cc += 1 + LINK_SIZE;
- break;
-
- case OP_CBRA:
- case OP_SCBRA:
- if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
- {
- count = 1;
- srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
- }
- cc += 1 + LINK_SIZE + IMM2_SIZE;
- break;
+ }
+ cc += 1 + LINK_SIZE;
+ break;
- case OP_CBRAPOS:
- case OP_SCBRAPOS:
- count = 2;
+ CASE_ITERATOR_PRIVATE_DATA_1
+ if (PRIVATE_DATA(cc))
+ {
+ count = 1;
srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
- SLJIT_ASSERT(srcw[0] != 0 && srcw[1] != 0);
- cc += 1 + LINK_SIZE + IMM2_SIZE;
- break;
-
- case OP_COND:
- /* Might be a hidden SCOND. */
- alternative = cc + GET(cc, 1);
- if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
- {
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- SLJIT_ASSERT(srcw[0] != 0);
- }
- cc += 1 + LINK_SIZE;
- break;
-
- CASE_ITERATOR_PRIVATE_DATA_1
- if (PRIVATE_DATA(cc))
- {
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- }
- cc += 2;
+ }
+ cc += 2;
#ifdef SUPPORT_UTF
- if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
+ if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
- break;
+ break;
- CASE_ITERATOR_PRIVATE_DATA_2A
- if (PRIVATE_DATA(cc))
- {
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
- }
- cc += 2;
+ CASE_ITERATOR_PRIVATE_DATA_2A
+ if (PRIVATE_DATA(cc))
+ {
+ count = 2;
+ srcw[0] = PRIVATE_DATA(cc);
+ srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
+ }
+ cc += 2;
#ifdef SUPPORT_UTF
- if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
+ if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
- break;
+ break;
- CASE_ITERATOR_PRIVATE_DATA_2B
- if (PRIVATE_DATA(cc))
- {
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
- }
- cc += 2 + IMM2_SIZE;
+ CASE_ITERATOR_PRIVATE_DATA_2B
+ if (PRIVATE_DATA(cc))
+ {
+ count = 2;
+ srcw[0] = PRIVATE_DATA(cc);
+ srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
+ }
+ cc += 2 + IMM2_SIZE;
#ifdef SUPPORT_UTF
- if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
+ if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
#endif
- break;
+ break;
- CASE_ITERATOR_TYPE_PRIVATE_DATA_1
- if (PRIVATE_DATA(cc))
+ CASE_ITERATOR_TYPE_PRIVATE_DATA_1
+ if (PRIVATE_DATA(cc))
+ {
+ count = 1;
+ srcw[0] = PRIVATE_DATA(cc);
+ }
+ cc += 1;
+ break;
+
+ CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
+ if (PRIVATE_DATA(cc))
+ {
+ count = 2;
+ srcw[0] = PRIVATE_DATA(cc);
+ srcw[1] = srcw[0] + sizeof(sljit_sw);
+ }
+ cc += 1;
+ break;
+
+ CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
+ if (PRIVATE_DATA(cc))
+ {
+ count = 2;
+ srcw[0] = PRIVATE_DATA(cc);
+ srcw[1] = srcw[0] + sizeof(sljit_sw);
+ }
+ cc += 1 + IMM2_SIZE;
+ break;
+
+ case OP_CLASS:
+ case OP_NCLASS:
+#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
+ case OP_XCLASS:
+ size = (*cc == OP_XCLASS) ? GET(cc, 1) : 1 + 32 / (int)sizeof(pcre_uchar);
+#else
+ size = 1 + 32 / (int)sizeof(pcre_uchar);
+#endif
+ if (PRIVATE_DATA(cc))
+ switch(get_class_iterator_size(cc + size))
{
+ case 1:
count = 1;
srcw[0] = PRIVATE_DATA(cc);
- }
- cc += 1;
- break;
+ break;
- CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
- if (PRIVATE_DATA(cc))
- {
+ case 2:
count = 2;
srcw[0] = PRIVATE_DATA(cc);
srcw[1] = srcw[0] + sizeof(sljit_sw);
- }
- cc += 1;
- break;
+ break;
- CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
- if (PRIVATE_DATA(cc))
- {
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = srcw[0] + sizeof(sljit_sw);
+ default:
+ SLJIT_UNREACHABLE();
+ break;
}
- cc += 1 + IMM2_SIZE;
- break;
-
- case OP_CLASS:
- case OP_NCLASS:
-#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
- case OP_XCLASS:
- size = (*cc == OP_XCLASS) ? GET(cc, 1) : 1 + 32 / (int)sizeof(pcre_uchar);
-#else
- size = 1 + 32 / (int)sizeof(pcre_uchar);
-#endif
- if (PRIVATE_DATA(cc))
- switch(get_class_iterator_size(cc + size))
- {
- case 1:
- count = 1;
- srcw[0] = PRIVATE_DATA(cc);
- break;
-
- case 2:
- count = 2;
- srcw[0] = PRIVATE_DATA(cc);
- srcw[1] = srcw[0] + sizeof(sljit_sw);
- break;
-
- default:
- SLJIT_ASSERT_STOP();
- break;
- }
- cc += size;
- break;
-
- default:
- cc = next_opcode(common, cc);
- SLJIT_ASSERT(cc != NULL);
- break;
- }
+ cc += size;
break;
- case end:
- SLJIT_ASSERT_STOP();
+ default:
+ cc = next_opcode(common, cc);
+ SLJIT_ASSERT(cc != NULL);
break;
}
@@ -2312,7 +2303,7 @@ static SLJIT_INLINE void count_match(compiler_common *common)
{
DEFINE_COMPILER;
-OP2(SLJIT_SUB | SLJIT_SET_E, COUNT_MATCH, 0, COUNT_MATCH, 0, SLJIT_IMM, 1);
+OP2(SLJIT_SUB | SLJIT_SET_Z, COUNT_MATCH, 0, COUNT_MATCH, 0, SLJIT_IMM, 1);
add_jump(compiler, &common->calllimit, JUMP(SLJIT_ZERO));
}
@@ -2322,7 +2313,7 @@ static SLJIT_INLINE void allocate_stack(compiler_common *common, int size)
DEFINE_COMPILER;
SLJIT_ASSERT(size > 0);
-OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
+OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
#ifdef DESTROY_REGISTERS
OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, 12345);
OP1(SLJIT_MOV, TMP3, 0, TMP1, 0);
@@ -2330,7 +2321,7 @@ OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, TMP1, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP1, 0);
#endif
-add_stub(common, CMP(SLJIT_GREATER, STACK_TOP, 0, STACK_LIMIT, 0));
+add_stub(common, CMP(SLJIT_LESS, STACK_TOP, 0, STACK_LIMIT, 0));
}
static SLJIT_INLINE void free_stack(compiler_common *common, int size)
@@ -2338,7 +2329,7 @@ static SLJIT_INLINE void free_stack(compiler_common *common, int size)
DEFINE_COMPILER;
SLJIT_ASSERT(size > 0);
-OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
+OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, size * sizeof(sljit_sw));
}
static sljit_uw * allocate_read_only_data(compiler_common *common, sljit_uw size)
@@ -2396,7 +2387,7 @@ else
OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, length - 1);
loop = LABEL();
OP1(SLJIT_MOVU, SLJIT_MEM1(SLJIT_R1), sizeof(sljit_sw), SLJIT_R0, 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, loop);
}
}
@@ -2434,7 +2425,7 @@ else
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_IMM, length - 2);
loop = LABEL();
OP1(SLJIT_MOVU, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, loop);
}
@@ -2452,22 +2443,22 @@ static sljit_sw SLJIT_CALL do_search_mark(sljit_sw *current, const pcre_uchar *s
{
while (current != NULL)
{
- switch (current[-2])
+ switch (current[1])
{
case type_then_trap:
break;
case type_mark:
- if (STRCMP_UC_UC(skip_arg, (pcre_uchar *)current[-3]) == 0)
- return current[-4];
+ if (STRCMP_UC_UC(skip_arg, (pcre_uchar *)current[2]) == 0)
+ return current[3];
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
- SLJIT_ASSERT(current > (sljit_sw*)current[-1]);
- current = (sljit_sw*)current[-1];
+ SLJIT_ASSERT(current[0] == 0 || current < (sljit_sw*)current[0]);
+ current = (sljit_sw*)current[0];
}
return -1;
}
@@ -2501,7 +2492,7 @@ OP2(SLJIT_ADD, SLJIT_S0, 0, SLJIT_S0, 0, SLJIT_IMM, sizeof(sljit_sw));
OP2(SLJIT_ASHR, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
OP1(SLJIT_MOVU_S32, SLJIT_MEM1(SLJIT_R2), sizeof(int), SLJIT_S1, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, loop);
JUMPHERE(early_quit);
@@ -3106,8 +3097,8 @@ if (common->utf)
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
/* Skip low surrogate if necessary. */
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xdc00);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xdc00);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
return;
@@ -3126,6 +3117,7 @@ struct sljit_jump *jump;
if (nltype == NLTYPE_ANY)
{
add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(jumpifmatch ? SLJIT_NOT_ZERO : SLJIT_ZERO));
}
else if (nltype == NLTYPE_ANYCRLF)
@@ -3167,7 +3159,7 @@ OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
/* Searching for the first zero. */
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
@@ -3181,7 +3173,7 @@ OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 6);
OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x10000);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x10000);
jump = JUMP(SLJIT_NOT_ZERO);
/* Three byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
@@ -3215,15 +3207,15 @@ OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0x3f);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, TMP2, 0);
/* Searching for the first zero. */
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x800);
jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
JUMPHERE(jump);
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x400);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_NOT_ZERO);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x400);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_NOT_ZERO);
/* This code runs only in 8 bit mode. No need to shift the value. */
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
OP1(MOV_UCHAR, TMP2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
@@ -3246,7 +3238,7 @@ struct sljit_jump *compare;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
-OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x20);
+OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x20);
jump = JUMP(SLJIT_NOT_ZERO);
/* Two byte sequence. */
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
@@ -3287,10 +3279,30 @@ static void do_getucd(compiler_common *common)
/* Search the UCD record for the character comes in TMP1.
Returns chartype in TMP1 and UCD offset in TMP2. */
DEFINE_COMPILER;
+#ifdef COMPILE_PCRE32
+struct sljit_jump *jump;
+#endif
+
+#if defined SLJIT_DEBUG && SLJIT_DEBUG
+/* dummy_ucd_record */
+const ucd_record *record = GET_UCD(INVALID_UTF_CHAR);
+SLJIT_ASSERT(record->script == ucp_Common && record->chartype == ucp_Cn && record->gbprop == ucp_gbOther);
+SLJIT_ASSERT(record->caseset == 0 && record->other_case == 0);
+#endif
SLJIT_ASSERT(UCD_BLOCK_SIZE == 128 && sizeof(ucd_record) == 8);
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
+
+#ifdef COMPILE_PCRE32
+if (!common->utf)
+ {
+ jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0x10ffff + 1);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR);
+ JUMPHERE(jump);
+ }
+#endif
+
OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
@@ -3365,8 +3377,8 @@ if (newlinecheck)
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
end = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, common->newline & 0xff);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, common->newline & 0xff);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
#if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -3403,8 +3415,8 @@ if (common->utf)
{
singlechar = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
JUMPHERE(singlechar);
@@ -3853,7 +3865,7 @@ while (TRUE)
}
}
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
+#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND)
static sljit_s32 character_to_int32(pcre_uchar chr)
{
@@ -4019,6 +4031,7 @@ instruction[0] = 0x0f;
instruction[1] = 0xbc;
instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
sljit_emit_op_custom(compiler, instruction, 3);
+sljit_set_current_flags(compiler, SLJIT_SET_Z);
nomatch = JUMP(SLJIT_ZERO);
@@ -4119,6 +4132,7 @@ instruction[0] = 0x0f;
instruction[1] = 0xbc;
instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind;
sljit_emit_op_custom(compiler, instruction, 3);
+sljit_set_current_flags(compiler, SLJIT_SET_Z);
JUMPTO(SLJIT_ZERO, start);
@@ -4155,18 +4169,8 @@ if (has_match_end)
OP1(SLJIT_MOV, TMP3, 0, STR_END, 0);
OP2(SLJIT_ADD, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr, SLJIT_IMM, IN_UCHARS(offset + 1));
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
- if (sljit_x86_is_cmov_available())
- {
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_END, 0, TMP3, 0);
- sljit_x86_emit_cmov(compiler, SLJIT_GREATER, STR_END, TMP3, 0);
- }
-#endif
- {
- quit = CMP(SLJIT_LESS_EQUAL, STR_END, 0, TMP3, 0);
- OP1(SLJIT_MOV, STR_END, 0, TMP3, 0);
- JUMPHERE(quit);
- }
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_END, 0, TMP3, 0);
+ sljit_emit_cmov(compiler, SLJIT_GREATER, STR_END, TMP3, 0);
}
#if defined SUPPORT_UTF && !defined COMPILE_PCRE32
@@ -4174,11 +4178,11 @@ if (common->utf && offset > 0)
utf_start = LABEL();
#endif
-#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
+#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND)
/* SSE2 accelerated first character search. */
-if (sljit_x86_is_sse2_available())
+if (sljit_has_cpu_feature(SLJIT_HAS_SSE2))
{
fast_forward_first_char2_sse2(common, char1, char2);
@@ -4213,16 +4217,16 @@ if (sljit_x86_is_sse2_available())
if (offset > 0)
OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset));
}
- else if (sljit_x86_is_cmov_available())
- {
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0);
- sljit_x86_emit_cmov(compiler, SLJIT_GREATER_EQUAL, STR_PTR, has_match_end ? SLJIT_MEM1(SLJIT_SP) : STR_END, has_match_end ? common->match_end_ptr : 0);
- }
else
{
- quit = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0);
- OP1(SLJIT_MOV, STR_PTR, 0, has_match_end ? SLJIT_MEM1(SLJIT_SP) : STR_END, has_match_end ? common->match_end_ptr : 0);
- JUMPHERE(quit);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0);
+ if (has_match_end)
+ {
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr);
+ sljit_emit_cmov(compiler, SLJIT_GREATER_EQUAL, STR_PTR, TMP1, 0);
+ }
+ else
+ sljit_emit_cmov(compiler, SLJIT_GREATER_EQUAL, STR_PTR, STR_END, 0);
}
if (has_match_end)
@@ -4249,10 +4253,10 @@ else
}
else
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char1);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char2);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char1);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char2);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
found = JUMP(SLJIT_NOT_ZERO);
}
}
@@ -4571,8 +4575,8 @@ if (common->nltype == NLTYPE_FIXED && common->newline > 255)
firstchar = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0);
OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(2));
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, STR_PTR, 0, TMP1, 0);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, STR_PTR, 0, TMP1, 0);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_GREATER_EQUAL);
#if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -4616,8 +4620,8 @@ if (common->nltype == NLTYPE_ANY || common->nltype == NLTYPE_ANYCRLF)
JUMPHERE(foundcr);
notfoundnl = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0);
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_NL);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, CHAR_NL);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
#if defined COMPILE_PCRE16 || defined COMPILE_PCRE32
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT);
#endif
@@ -4670,7 +4674,7 @@ if (!check_class_ranges(common, start_bits, (start_bits[31] & 0x80) != 0, TRUE,
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)start_bits);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
found = JUMP(SLJIT_NOT_ZERO);
}
@@ -4692,8 +4696,8 @@ if (common->utf)
{
CMPTO(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800, start);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
}
@@ -4780,31 +4784,31 @@ struct sljit_jump *jump;
struct sljit_label *mainloop;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
-OP1(SLJIT_MOV, TMP1, 0, STACK_TOP, 0);
-GET_LOCAL_BASE(TMP3, 0, 0);
+OP1(SLJIT_MOV, TMP3, 0, STACK_TOP, 0);
+GET_LOCAL_BASE(TMP1, 0, 0);
/* Drop frames until we reach STACK_TOP. */
mainloop = LABEL();
-OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), 0);
-OP2(SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0);
-jump = JUMP(SLJIT_SIG_LESS_EQUAL);
-
-OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP3, 0);
-OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));
-OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(TMP1), 2 * sizeof(sljit_sw));
-OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_sw));
+OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), -sizeof(sljit_sw));
+jump = CMP(SLJIT_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, 0);
+
+OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
+OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -2 * sizeof(sljit_sw));
+OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(STACK_TOP), -3 * sizeof(sljit_sw));
+OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 3 * sizeof(sljit_sw));
JUMPTO(SLJIT_JUMP, mainloop);
JUMPHERE(jump);
-jump = JUMP(SLJIT_SIG_LESS);
-/* End of dropping frames. */
+jump = CMP(SLJIT_NOT_ZERO /* SIG_LESS */, TMP2, 0, SLJIT_IMM, 0);
+/* End of reverting values. */
+OP1(SLJIT_MOV, STACK_TOP, 0, TMP3, 0);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
JUMPHERE(jump);
OP1(SLJIT_NEG, TMP2, 0, TMP2, 0);
-OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP3, 0);
-OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(TMP1), sizeof(sljit_sw));
-OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
+OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0);
+OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -2 * sizeof(sljit_sw));
+OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
JUMPTO(SLJIT_JUMP, mainloop);
}
@@ -4837,11 +4841,11 @@ if (common->use_ucp)
jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Nd - ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
JUMPHERE(jump);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP2, 0);
}
@@ -4881,11 +4885,11 @@ if (common->use_ucp)
jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Nd - ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
JUMPHERE(jump);
}
else
@@ -4913,7 +4917,7 @@ else
}
set_jumps(skipread_list, LABEL());
-OP2(SLJIT_XOR | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
+OP2(SLJIT_XOR | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
sljit_emit_fast_return(compiler, SLJIT_MEM1(SLJIT_SP), LOCALS0);
}
@@ -5064,7 +5068,7 @@ switch(length)
return TRUE;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return FALSE;
}
}
@@ -5077,22 +5081,22 @@ DEFINE_COMPILER;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);
-OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
+OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
#ifdef COMPILE_PCRE8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
#ifdef COMPILE_PCRE8
}
#endif
#endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -5103,34 +5107,34 @@ DEFINE_COMPILER;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x09);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);
-OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xa0);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x09);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x20);
+OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xa0);
#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
#ifdef COMPILE_PCRE8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x1680);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x1680);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x2000);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x200A - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x202f - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x205f - 0x2000);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x3000 - 0x2000);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x200A - 0x2000);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x202f - 0x2000);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x205f - 0x2000);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x3000 - 0x2000);
#ifdef COMPILE_PCRE8
}
#endif
#endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -5143,22 +5147,22 @@ DEFINE_COMPILER;
sljit_emit_fast_enter(compiler, RETURN_ADDR, 0);
OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x0a);
-OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
-OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
-OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
+OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x0d - 0x0a);
+OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
+OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x0a);
#if defined SUPPORT_UTF || defined COMPILE_PCRE16 || defined COMPILE_PCRE32
#ifdef COMPILE_PCRE8
if (common->utf)
{
#endif
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, 0x1);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2029 - 0x0a);
#ifdef COMPILE_PCRE8
}
#endif
#endif /* SUPPORT_UTF || COMPILE_PCRE16 || COMPILE_PCRE32 */
-OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
sljit_emit_fast_return(compiler, RETURN_ADDR, 0);
}
@@ -5183,7 +5187,7 @@ label = LABEL();
OP1(MOVU_UCHAR, CHAR1, 0, SLJIT_MEM1(TMP1), IN_UCHARS(1));
OP1(MOVU_UCHAR, CHAR2, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
jump = CMP(SLJIT_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
+OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
JUMPTO(SLJIT_NOT_ZERO, label);
JUMPHERE(jump);
@@ -5227,7 +5231,7 @@ OP1(SLJIT_MOV_U8, CHAR2, 0, SLJIT_MEM2(LCC_TABLE, CHAR2), 0);
JUMPHERE(jump);
#endif
jump = CMP(SLJIT_NOT_EQUAL, CHAR1, 0, CHAR2, 0);
-OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
+OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, IN_UCHARS(1));
JUMPTO(SLJIT_NOT_ZERO, label);
JUMPHERE(jump);
@@ -5394,7 +5398,7 @@ do
#endif
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
context->ucharptr = 0;
@@ -5568,7 +5572,7 @@ while (*cc != XCL_END)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
cc += 2;
@@ -5592,7 +5596,7 @@ if ((cc[-1] & XCL_HASPROP) == 0)
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
add_jump(compiler, &found, JUMP(SLJIT_NOT_ZERO));
}
@@ -5625,7 +5629,7 @@ else if ((cc[-1] & XCL_MAP) != 0)
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
add_jump(compiler, list, JUMP(SLJIT_NOT_ZERO));
#ifdef COMPILE_PCRE8
@@ -5644,6 +5648,15 @@ if (needstype || needsscript)
if (needschar && !charsaved)
OP1(SLJIT_MOV, RETURN_ADDR, 0, TMP1, 0);
+#ifdef COMPILE_PCRE32
+ if (!common->utf)
+ {
+ jump = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0x10ffff + 1);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR);
+ JUMPHERE(jump);
+ }
+#endif
+
OP2(SLJIT_LSHR, TMP2, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_SHIFT);
OP1(SLJIT_MOV_U8, TMP2, 0, SLJIT_MEM1(TMP2), (sljit_sw)PRIV(ucd_stage1));
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, UCD_BLOCK_MASK);
@@ -5735,14 +5748,14 @@ while (*cc != XCL_END)
if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
numberofcmps++;
}
else if (numberofcmps > 0)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
numberofcmps = 0;
}
@@ -5761,14 +5774,14 @@ while (*cc != XCL_END)
if (numberofcmps < 3 && (*cc == XCL_SINGLE || *cc == XCL_RANGE))
{
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, numberofcmps == 0 ? SLJIT_UNUSED : TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(numberofcmps == 0 ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
numberofcmps++;
}
else if (numberofcmps > 0)
{
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(c - charoffset));
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
numberofcmps = 0;
}
@@ -5793,12 +5806,12 @@ while (*cc != XCL_END)
break;
case PT_LAMP:
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - typeoffset);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ll - typeoffset);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lt - typeoffset);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - typeoffset);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ll - typeoffset);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lt - typeoffset);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
@@ -5820,33 +5833,33 @@ while (*cc != XCL_END)
case PT_SPACE:
case PT_PXSPACE:
SET_CHAR_OFFSET(9);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd - 0x9);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd - 0x9);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x9);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x85 - 0x9);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x9);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x9);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
SET_TYPE_OFFSET(ucp_Zl);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Zl);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Zl);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_WORD:
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_UNDERSCORE - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_UNDERSCORE - charoffset));
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
/* Fall through. */
case PT_ALNUM:
SET_TYPE_OFFSET(ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
- OP_FLAGS((*cc == PT_ALNUM) ? SLJIT_MOV : SLJIT_OR, TMP2, 0, (*cc == PT_ALNUM) ? SLJIT_UNUSED : TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);
+ OP_FLAGS((*cc == PT_ALNUM) ? SLJIT_MOV : SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
SET_TYPE_OFFSET(ucp_Nd);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_No - ucp_Nd);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_No - ucp_Nd);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
@@ -5868,8 +5881,8 @@ while (*cc != XCL_END)
OP2(SLJIT_ADD, TMP2, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)charoffset);
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]);
}
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[1]);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[1]);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
other_cases += 2;
}
else if (is_powerof2(other_cases[2] ^ other_cases[1]))
@@ -5881,63 +5894,63 @@ while (*cc != XCL_END)
OP2(SLJIT_ADD, TMP2, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)charoffset);
OP2(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_IMM, other_cases[1] ^ other_cases[0]);
}
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[2]);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, other_cases[2]);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(other_cases[0] - charoffset));
- OP_FLAGS(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(other_cases[0] - charoffset));
+ OP_FLAGS(SLJIT_OR | ((other_cases[3] == NOTACHAR) ? SLJIT_SET_Z : 0), TMP2, 0, SLJIT_EQUAL);
other_cases += 3;
}
else
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
}
while (*other_cases != NOTACHAR)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
- OP_FLAGS(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_E : 0), TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(*other_cases++ - charoffset));
+ OP_FLAGS(SLJIT_OR | ((*other_cases == NOTACHAR) ? SLJIT_SET_Z : 0), TMP2, 0, SLJIT_EQUAL);
}
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_UCNC:
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_DOLLAR_SIGN - charoffset));
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_COMMERCIAL_AT - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_GRAVE_ACCENT - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_DOLLAR_SIGN - charoffset));
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_COMMERCIAL_AT - charoffset));
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(CHAR_GRAVE_ACCENT - charoffset));
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
SET_CHAR_OFFSET(0xa0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(0xd7ff - charoffset));
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (sljit_sw)(0xd7ff - charoffset));
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_LESS_EQUAL);
SET_CHAR_OFFSET(0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xe000 - 0);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_GREATER_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xe000 - 0);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_GREATER_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
case PT_PXGRAPH:
/* C and Z groups are the farthest two groups. */
SET_TYPE_OFFSET(ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_GREATER);
jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
/* In case of ucp_Cf, we overwrite the result. */
SET_CHAR_OFFSET(0x2066);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x180e - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
JUMPHERE(jump);
jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
@@ -5946,21 +5959,21 @@ while (*cc != XCL_END)
case PT_PXPRINT:
/* C and Z groups are the farthest two groups. */
SET_TYPE_OFFSET(ucp_Ll);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_GREATER);
+ OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Ll);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_GREATER);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Ll);
- OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_NOT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Zs - ucp_Ll);
+ OP_FLAGS(SLJIT_AND, TMP2, 0, SLJIT_NOT_EQUAL);
jump = CMP(SLJIT_NOT_EQUAL, typereg, 0, SLJIT_IMM, ucp_Cf - ucp_Ll);
/* In case of ucp_Cf, we overwrite the result. */
SET_CHAR_OFFSET(0x2066);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x2069 - 0x2066);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
- OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x061c - 0x2066);
+ OP_FLAGS(SLJIT_OR, TMP2, 0, SLJIT_EQUAL);
JUMPHERE(jump);
jump = CMP(SLJIT_ZERO ^ invertcmp, TMP2, 0, SLJIT_IMM, 0);
@@ -5968,21 +5981,21 @@ while (*cc != XCL_END)
case PT_PXPUNCT:
SET_TYPE_OFFSET(ucp_Sc);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Sc);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_So - ucp_Sc);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS_EQUAL);
SET_CHAR_OFFSET(0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x7f);
- OP_FLAGS(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x7f);
+ OP_FLAGS(SLJIT_AND, TMP2, 0, SLJIT_LESS_EQUAL);
SET_TYPE_OFFSET(ucp_Pc);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ps - ucp_Pc);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_LESS_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS_EQUAL, SLJIT_UNUSED, 0, typereg, 0, SLJIT_IMM, ucp_Ps - ucp_Pc);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_LESS_EQUAL);
jump = JUMP(SLJIT_NOT_ZERO ^ invertcmp);
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
cc += 2;
@@ -6028,6 +6041,7 @@ switch(type)
case OP_NOT_WORD_BOUNDARY:
case OP_WORD_BOUNDARY:
add_jump(compiler, &common->wordboundary, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(type == OP_NOT_WORD_BOUNDARY ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
@@ -6043,10 +6057,10 @@ switch(type)
else
{
jump[1] = CMP(SLJIT_EQUAL, TMP2, 0, STR_END, 0);
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
- OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_LESS);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
- OP_FLAGS(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_NOT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_LESS);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, (common->newline >> 8) & 0xff);
+ OP_FLAGS(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, SLJIT_NOT_EQUAL);
add_jump(compiler, backtracks, JUMP(SLJIT_NOT_EQUAL));
check_partial(common, TRUE);
add_jump(compiler, backtracks, JUMP(SLJIT_JUMP));
@@ -6068,9 +6082,9 @@ switch(type)
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0));
jump[1] = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_CR);
OP2(SLJIT_ADD, TMP2, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(2));
- OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, TMP2, 0, STR_END, 0);
jump[2] = JUMP(SLJIT_GREATER);
- add_jump(compiler, backtracks, JUMP(SLJIT_LESS));
+ add_jump(compiler, backtracks, JUMP(SLJIT_NOT_EQUAL) /* LESS */);
/* Equal. */
OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(1));
jump[3] = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_NL);
@@ -6089,6 +6103,7 @@ switch(type)
read_char_range(common, common->nlmin, common->nlmax, TRUE);
add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, STR_END, 0));
add_jump(compiler, &common->anynewline, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(SLJIT_ZERO));
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1);
}
@@ -6204,7 +6219,7 @@ switch(type)
label = LABEL();
add_jump(compiler, backtracks, CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP3, 0));
skip_char_back(common);
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -6217,7 +6232,7 @@ switch(type)
check_start_used_ptr(common);
return cc + LINK_SIZE;
}
-SLJIT_ASSERT_STOP();
+SLJIT_UNREACHABLE();
return cc;
}
@@ -6250,7 +6265,7 @@ switch(type)
#endif
read_char8_type(common, type == OP_NOT_DIGIT);
/* Flip the starting bit in the negative case. */
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_digit);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_digit);
add_jump(compiler, backtracks, JUMP(type == OP_DIGIT ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
@@ -6264,7 +6279,7 @@ switch(type)
else
#endif
read_char8_type(common, type == OP_NOT_WHITESPACE);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_space);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_space);
add_jump(compiler, backtracks, JUMP(type == OP_WHITESPACE ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
@@ -6278,7 +6293,7 @@ switch(type)
else
#endif
read_char8_type(common, type == OP_NOT_WORDCHAR);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_word);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ctype_word);
add_jump(compiler, backtracks, JUMP(type == OP_WORDCHAR ? SLJIT_ZERO : SLJIT_NOT_ZERO));
return cc;
@@ -6320,8 +6335,8 @@ switch(type)
#elif defined COMPILE_PCRE16
jump[0] = CMP(SLJIT_LESS, TMP1, 0, SLJIT_IMM, 0xd800);
OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, 0xfc00);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
- OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_UNUSED, 0, SLJIT_EQUAL);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0xd800);
+ OP_FLAGS(SLJIT_MOV, TMP1, 0, SLJIT_EQUAL);
OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
#endif
@@ -6383,6 +6398,7 @@ switch(type)
detect_partial_match(common, backtracks);
read_char_range(common, 0x9, 0x3000, type == OP_NOT_HSPACE);
add_jump(compiler, &common->hspace, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(type == OP_NOT_HSPACE ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
@@ -6392,6 +6408,7 @@ switch(type)
detect_partial_match(common, backtracks);
read_char_range(common, 0xa, 0x2029, type == OP_NOT_VSPACE);
add_jump(compiler, &common->vspace, JUMP(SLJIT_FAST_CALL));
+ sljit_set_current_flags(compiler, SLJIT_SET_Z);
add_jump(compiler, backtracks, JUMP(type == OP_NOT_VSPACE ? SLJIT_NOT_ZERO : SLJIT_ZERO));
return cc;
@@ -6418,7 +6435,7 @@ switch(type)
OP1(SLJIT_MOV_U32, TMP1, 0, SLJIT_MEM1(STACK_TOP), (sljit_sw)PRIV(ucp_gbtable));
OP1(SLJIT_MOV, STACK_TOP, 0, TMP2, 0);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
JUMPTO(SLJIT_NOT_ZERO, label);
OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0);
@@ -6587,7 +6604,7 @@ switch(type)
OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3);
OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)cc);
OP2(SLJIT_SHL, TMP2, 0, SLJIT_IMM, 1, TMP2, 0);
- OP2(SLJIT_AND | SLJIT_SET_E, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
+ OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP2, 0);
add_jump(compiler, backtracks, JUMP(SLJIT_ZERO));
#if defined SUPPORT_UTF || !defined COMPILE_PCRE8
@@ -6604,7 +6621,7 @@ switch(type)
return cc + GET(cc, 0) - 1;
#endif
}
-SLJIT_ASSERT_STOP();
+SLJIT_UNREACHABLE();
return cc;
}
@@ -6790,9 +6807,9 @@ else
#endif /* SUPPORT_UTF && SUPPORT_UCP */
{
if (ref)
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP1, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), TMP1, 0);
else
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw), TMP1, 0);
if (withchecks)
jump = JUMP(SLJIT_ZERO);
@@ -6883,7 +6900,7 @@ switch(type)
cc += 1 + IMM2_SIZE + 1 + 2 * IMM2_SIZE;
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -6897,7 +6914,7 @@ if (!minimize)
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, 0);
/* Temporary release of STR_PTR. */
- OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
/* Handles both invalid and empty cases. Since the minimum repeat,
is zero the invalid case is basically the same as an empty case. */
if (ref)
@@ -6910,7 +6927,7 @@ if (!minimize)
zerolength = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_MEM1(TMP2), sizeof(sljit_sw));
}
/* Restore if not zero length. */
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
}
else
{
@@ -7157,7 +7174,7 @@ return (*PUBL(callout))(callout_block);
(((int)sizeof(PUBL(callout_block)) + 7) & ~7)
#define CALLOUT_ARG_OFFSET(arg) \
- (-CALLOUT_ARG_SIZE + SLJIT_OFFSETOF(PUBL(callout_block), arg))
+ SLJIT_OFFSETOF(PUBL(callout_block), arg)
static SLJIT_INLINE pcre_uchar *compile_callout_matchingpath(compiler_common *common, pcre_uchar *cc, backtrack_common *parent)
{
@@ -7187,7 +7204,8 @@ OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), CALLOUT_ARG_OFFSET(mark), (common->mark_pt
/* Needed to save important temporary registers. */
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STACK_TOP, 0);
-OP2(SLJIT_SUB, SLJIT_R1, 0, STACK_TOP, 0, SLJIT_IMM, CALLOUT_ARG_SIZE);
+/* SLJIT_R0 = arguments */
+OP1(SLJIT_MOV, SLJIT_R1, 0, STACK_TOP, 0);
GET_LOCAL_BASE(SLJIT_R2, 0, OVECTOR_START);
sljit_emit_ijump(compiler, SLJIT_CALL3, SLJIT_IMM, SLJIT_FUNC_OFFSET(do_callout));
OP1(SLJIT_MOV_S32, SLJIT_RETURN_REG, 0, SLJIT_RETURN_REG, 0);
@@ -7195,12 +7213,12 @@ OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0);
free_stack(common, CALLOUT_ARG_SIZE / sizeof(sljit_sw));
/* Check return value. */
-OP2(SLJIT_SUB | SLJIT_SET_S, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
+OP2(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_SIG_GREATER, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_SIG_GREATER));
if (common->forced_quit_label == NULL)
- add_jump(compiler, &common->forced_quit, JUMP(SLJIT_SIG_LESS));
+ add_jump(compiler, &common->forced_quit, JUMP(SLJIT_NOT_EQUAL) /* SIG_LESS */);
else
- JUMPTO(SLJIT_SIG_LESS, common->forced_quit_label);
+ JUMPTO(SLJIT_NOT_EQUAL /* SIG_LESS */, common->forced_quit_label);
return cc + 2 + 2 * LINK_SIZE;
}
@@ -7321,7 +7339,7 @@ else
allocate_stack(common, framesize + extrasize);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw));
+ OP2(SLJIT_ADD, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP2, 0);
if (needs_control_head)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
@@ -7392,22 +7410,22 @@ while (1)
free_stack(common, extrasize);
if (needs_control_head)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-1));
}
else
{
if ((opcode != OP_ASSERT_NOT && opcode != OP_ASSERTBACK_NOT) || conditional)
{
/* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
if (needs_control_head)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-1));
}
else
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
if (needs_control_head)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), (framesize + 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_MEM1(STACK_TOP), STACK(-framesize - 2));
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
}
}
@@ -7418,25 +7436,25 @@ while (1)
if (conditional)
{
if (extrasize > 0)
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), needs_control_head ? sizeof(sljit_sw) : 0);
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), needs_control_head ? STACK(-2) : STACK(-1));
}
else if (bra == OP_BRAZERO)
{
if (framesize < 0)
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (extrasize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-extrasize));
else
{
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw));
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (framesize + extrasize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-framesize - 1));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-framesize - extrasize));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, TMP1, 0);
}
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
}
else if (framesize >= 0)
{
/* For OP_BRA and OP_BRAMINZERO. */
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-framesize - 1));
}
}
add_jump(compiler, found, JUMP(SLJIT_JUMP));
@@ -7480,12 +7498,12 @@ if (common->positive_assert_quit != NULL)
set_jumps(common->positive_assert_quit, LABEL());
SLJIT_ASSERT(framesize != no_stack);
if (framesize < 0)
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, extrasize * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, extrasize * sizeof(sljit_sw));
else
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + extrasize) * sizeof(sljit_sw));
}
JUMPHERE(jump);
}
@@ -7534,18 +7552,18 @@ if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK)
{
/* We know that STR_PTR was stored on the top of the stack. */
if (extrasize > 0)
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (extrasize - 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-extrasize));
/* Keep the STR_PTR on the top of the stack. */
if (bra == OP_BRAZERO)
{
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
if (extrasize == 2)
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), STR_PTR, 0);
}
else if (bra == OP_BRAMINZERO)
{
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
}
}
@@ -7554,13 +7572,13 @@ if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK)
if (bra == OP_BRA)
{
/* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), (extrasize - 2) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(-extrasize + 1));
}
else
{
/* We don't need to keep the STR_PTR, only the previous private_data_ptr. */
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 2) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + 2) * sizeof(sljit_sw));
if (extrasize == 2)
{
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
@@ -7588,7 +7606,7 @@ if (opcode == OP_ASSERT || opcode == OP_ASSERTBACK)
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-framesize - 1));
}
set_jumps(backtrack->common.topbacktracks, LABEL());
}
@@ -7675,23 +7693,23 @@ if (framesize < 0)
}
if (needs_control_head)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), (ket != OP_KET || has_alternatives) ? sizeof(sljit_sw) : 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), (ket != OP_KET || has_alternatives) ? STACK(-2) : STACK(-1));
/* TMP2 which is set here used by OP_KETRMAX below. */
if (ket == OP_KETRMAX)
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(-1));
else if (ket == OP_KETRMIN)
{
/* Move the STR_PTR to the private_data_ptr. */
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-1));
}
}
else
{
stacksize = (ket != OP_KET || has_alternatives) ? 2 : 1;
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + stacksize) * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, (framesize + stacksize) * sizeof(sljit_sw));
if (needs_control_head)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-1));
if (ket == OP_KETRMAX)
{
@@ -7927,7 +7945,7 @@ if (bra == OP_BRAMINZERO)
{
/* Except when the whole stack frame must be saved. */
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- braminzero = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (BACKTRACK_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_sw));
+ braminzero = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), STACK(-BACKTRACK_AS(bracket_backtrack)->u.framesize - 2));
}
JUMPHERE(skip);
}
@@ -8000,7 +8018,7 @@ if (opcode == OP_ONCE)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), STR_PTR, 0);
if (BACKTRACK_AS(bracket_backtrack)->u.framesize == no_frame)
- OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, needs_control_head ? (2 * sizeof(sljit_sw)) : sizeof(sljit_sw));
+ OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, needs_control_head ? (2 * sizeof(sljit_sw)) : sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize + 1), TMP2, 0);
}
else if (ket == OP_KETRMAX || has_alternatives)
@@ -8018,7 +8036,7 @@ if (opcode == OP_ONCE)
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), TMP2, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP2(SLJIT_SUB, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
+ OP2(SLJIT_ADD, TMP2, 0, STACK_TOP, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
stacksize = needs_control_head ? 1 : 0;
if (ket != OP_KET || has_alternatives)
@@ -8090,13 +8108,13 @@ if (opcode == OP_COND || opcode == OP_SCOND)
slot = common->name_table + GET2(matchingpath, 1) * common->name_entry_size;
OP1(SLJIT_MOV, TMP3, 0, STR_PTR, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1));
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(slot, 0) << 1), TMP1, 0);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(slot, 0) << 1), TMP1, 0);
slot += common->name_entry_size;
i--;
while (i-- > 0)
{
OP2(SLJIT_SUB, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(GET2(slot, 0) << 1), TMP1, 0);
- OP2(SLJIT_OR | SLJIT_SET_E, TMP2, 0, TMP2, 0, STR_PTR, 0);
+ OP2(SLJIT_OR | SLJIT_SET_Z, TMP2, 0, TMP2, 0, STR_PTR, 0);
slot += common->name_entry_size;
}
OP1(SLJIT_MOV, STR_PTR, 0, TMP3, 0);
@@ -8111,7 +8129,7 @@ if (opcode == OP_COND || opcode == OP_SCOND)
if (*matchingpath == OP_FAIL)
stacksize = 0;
- if (*matchingpath == OP_RREF)
+ else if (*matchingpath == OP_RREF)
{
stacksize = GET2(matchingpath, 1);
if (common->currententry == NULL)
@@ -8244,7 +8262,7 @@ if (ket == OP_KETRMAX)
{
if (has_alternatives)
BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = LABEL();
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, rmax_label);
/* Drop STR_PTR for greedy plus quantifier. */
if (opcode != OP_ONCE)
@@ -8274,7 +8292,7 @@ if (ket == OP_KETRMAX)
if (repeat_type == OP_EXACT)
{
count_match(common);
- OP2(SLJIT_SUB | SLJIT_SET_E, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_MEM1(SLJIT_SP), repeat_ptr, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, rmax_label);
}
else if (repeat_type == OP_UPTO)
@@ -8374,7 +8392,7 @@ switch(opcode)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -8452,7 +8470,7 @@ else
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
if (needs_control_head)
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
- OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, -STACK(stacksize - 1));
+ OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), private_data_ptr, STACK_TOP, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
stack = 0;
if (!zero)
@@ -8524,7 +8542,7 @@ while (*cc != OP_KETRPOS)
{
if (offset != 0)
{
- OP2(SLJIT_ADD, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, stacksize * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_IMM, stacksize * sizeof(sljit_sw));
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), cbraprivptr);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(offset + 1), STR_PTR, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), cbraprivptr, STR_PTR, 0);
@@ -8535,10 +8553,10 @@ while (*cc != OP_KETRPOS)
else
{
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP2(SLJIT_ADD, STACK_TOP, 0, TMP2, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, TMP2, 0, SLJIT_IMM, stacksize * sizeof(sljit_sw));
if (opcode == OP_SBRAPOS)
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw));
- OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw), STR_PTR, 0);
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), STACK(-framesize - 2));
+ OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), STACK(-framesize - 2), STR_PTR, 0);
}
/* Even if the match is empty, we need to reset the control head. */
@@ -8584,7 +8602,7 @@ while (*cc != OP_KETRPOS)
else
{
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP2), (framesize + 1) * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(TMP2), STACK(-framesize - 2));
}
}
@@ -8601,7 +8619,7 @@ if (!zero)
if (framesize < 0)
add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(stacksize - 1), SLJIT_IMM, 0));
else /* TMP2 is set to [private_data_ptr] above. */
- add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(TMP2), (stacksize - 1) * sizeof(sljit_sw), SLJIT_IMM, 0));
+ add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_NOT_EQUAL, SLJIT_MEM1(TMP2), STACK(-stacksize), SLJIT_IMM, 0));
}
/* None of them matched. */
@@ -8824,7 +8842,7 @@ if (exact > 1)
OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, exact);
label = LABEL();
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -8832,7 +8850,7 @@ if (exact > 1)
OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, exact);
label = LABEL();
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, TRUE);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
}
@@ -8862,7 +8880,7 @@ switch(opcode)
if (opcode == OP_UPTO)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0);
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
jump = JUMP(SLJIT_ZERO);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE0, TMP1, 0);
}
@@ -8924,7 +8942,7 @@ switch(opcode)
label = LABEL();
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_ZERO));
}
compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE);
@@ -8944,7 +8962,7 @@ switch(opcode)
OP1(SLJIT_MOV, base, offset1, STR_PTR, 0);
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
add_jump(compiler, &no_match, JUMP(SLJIT_ZERO));
}
@@ -8971,7 +8989,7 @@ switch(opcode)
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -9000,7 +9018,7 @@ switch(opcode)
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
}
else
@@ -9026,7 +9044,7 @@ switch(opcode)
compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE);
if (opcode == OP_UPTO)
{
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
}
@@ -9113,7 +9131,7 @@ switch(opcode)
label = LABEL();
compile_char1_matchingpath(common, type, cc, &no_match, TRUE);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, STR_PTR, 0);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
set_jumps(no_match, LABEL());
OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1);
@@ -9124,7 +9142,7 @@ switch(opcode)
label = LABEL();
detect_partial_match(common, &no_match);
compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE);
- OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
JUMPTO(SLJIT_NOT_ZERO, label);
OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1));
set_jumps(no_char1_match, LABEL());
@@ -9142,7 +9160,7 @@ switch(opcode)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -9264,7 +9282,7 @@ size = 3 + (size < 0 ? 0 : size);
OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr);
allocate_stack(common, size);
if (size > 3)
- OP2(SLJIT_SUB, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0, SLJIT_IMM, (size - 3) * sizeof(sljit_sw));
+ OP2(SLJIT_ADD, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0, SLJIT_IMM, (size - 3) * sizeof(sljit_sw));
else
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, STACK_TOP, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(size - 1), SLJIT_IMM, BACKTRACK_AS(then_trap_backtrack)->start);
@@ -9569,7 +9587,7 @@ while (cc < ccend)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
return;
}
if (cc == NULL)
@@ -9677,7 +9695,7 @@ switch(opcode)
case OP_MINUPTO:
OP1(SLJIT_MOV, TMP1, 0, base, offset1);
OP1(SLJIT_MOV, STR_PTR, 0, base, offset0);
- OP2(SLJIT_SUB | SLJIT_SET_E, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, TMP1, 0, TMP1, 0, SLJIT_IMM, 1);
add_jump(compiler, &jumplist, JUMP(SLJIT_ZERO));
OP1(SLJIT_MOV, base, offset1, TMP1, 0);
@@ -9723,7 +9741,7 @@ switch(opcode)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
@@ -9831,7 +9849,7 @@ if (*cc == OP_ASSERT || *cc == OP_ASSERTBACK)
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(assert_backtrack)->private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(assert_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(assert_backtrack)->framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(assert_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-CURRENT_AS(assert_backtrack)->framesize - 1));
set_jumps(current->topbacktracks, LABEL());
}
@@ -9841,7 +9859,7 @@ else
if (bra == OP_BRAZERO)
{
/* We know there is enough place on the stack. */
- OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, sizeof(sljit_sw));
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(0), SLJIT_IMM, 0);
JUMPTO(SLJIT_JUMP, CURRENT_AS(assert_backtrack)->matchingpath);
JUMPHERE(brajump);
@@ -9954,7 +9972,7 @@ else if (ket == OP_KETRMIN)
else
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), private_data_ptr);
- CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), (CURRENT_AS(bracket_backtrack)->u.framesize + 1) * sizeof(sljit_sw), CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
+ CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(TMP1), STACK(-CURRENT_AS(bracket_backtrack)->u.framesize - 2), CURRENT_AS(bracket_backtrack)->recursive_matchingpath);
}
/* Drop STR_PTR for non-greedy plus quantifier. */
if (opcode != OP_ONCE)
@@ -10060,7 +10078,7 @@ if (SLJIT_UNLIKELY(opcode == OP_COND) || SLJIT_UNLIKELY(opcode == OP_SCOND))
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-assert->framesize - 1));
}
cond = JUMP(SLJIT_JUMP);
set_jumps(CURRENT_AS(bracket_backtrack)->u.assert->condfailed, LABEL());
@@ -10201,7 +10219,7 @@ if (has_alternatives)
{
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr);
add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), assert->framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), assert->private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-assert->framesize - 1));
}
JUMPHERE(cond);
}
@@ -10256,7 +10274,7 @@ else if (opcode == OP_ONCE)
JUMPHERE(once);
/* Restore previous private_data_ptr */
if (CURRENT_AS(bracket_backtrack)->u.framesize >= 0)
- OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracket_backtrack)->u.framesize * sizeof(sljit_sw));
+ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-CURRENT_AS(bracket_backtrack)->u.framesize - 1));
else if (ket == OP_KETRMIN)
{
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1));
@@ -10346,7 +10364,7 @@ if (current->topbacktracks)
free_stack(common, CURRENT_AS(bracketpos_backtrack)->stacksize);
JUMPHERE(jump);
}
-OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(bracketpos_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), CURRENT_AS(bracketpos_backtrack)->framesize * sizeof(sljit_sw));
+OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), CURRENT_AS(bracketpos_backtrack)->private_data_ptr, SLJIT_MEM1(STACK_TOP), STACK(-CURRENT_AS(bracketpos_backtrack)->framesize - 1));
}
static SLJIT_INLINE void compile_braminzero_backtrackingpath(compiler_common *common, struct backtrack_common *current)
@@ -10392,10 +10410,10 @@ if (opcode == OP_THEN || opcode == OP_THEN_ARG)
jump = JUMP(SLJIT_JUMP);
loop = LABEL();
- OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), -(int)sizeof(sljit_sw));
+ OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), STACK(0));
JUMPHERE(jump);
- CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), -(int)(2 * sizeof(sljit_sw)), TMP1, 0, loop);
- CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), -(int)(3 * sizeof(sljit_sw)), TMP2, 0, loop);
+ CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), TMP1, 0, loop);
+ CMPTO(SLJIT_NOT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(2), TMP2, 0, loop);
add_jump(compiler, &common->then_trap->quit, JUMP(SLJIT_JUMP));
return;
}
@@ -10645,7 +10663,7 @@ while (current)
break;
default:
- SLJIT_ASSERT_STOP();
+ SLJIT_UNREACHABLE();
break;
}
current = current->prev;
@@ -10684,7 +10702,7 @@ sljit_emit_fast_enter(compiler, TMP2, 0);
count_match(common);
allocate_stack(common, private_data_size + framesize + alternativesize);
OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(private_data_size + framesize + alternativesize - 1), TMP2, 0);
-copy_private_data(common, ccbegin, ccend, TRUE, private_data_size + framesize + alternativesize, framesize + alternativesize, needs_control_head);
+copy_private_data(common, ccbegin, ccend, TRUE, framesize + alternativesize, private_data_size + framesize + alternativesize, needs_control_head);
if (needs_control_head)
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, STACK_TOP, 0);
@@ -10737,9 +10755,9 @@ if (common->quit != NULL)
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr);
if (needs_frame)
{
- OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
- add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
+ add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
}
OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 0);
common->quit = NULL;
@@ -10750,32 +10768,32 @@ set_jumps(common->accept, LABEL());
OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr);
if (needs_frame)
{
- OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
- add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
OP2(SLJIT_ADD, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
+ add_jump(compiler, &common->revertframes, JUMP(SLJIT_FAST_CALL));
+ OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, (framesize + alternativesize) * sizeof(sljit_sw));
}
OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 1);
JUMPHERE(jump);
if (common->quit != NULL)
set_jumps(common->quit, LABEL());
-copy_private_data(common, ccbegin, ccend, FALSE, private_data_size + framesize + alternativesize, framesize + alternativesize, needs_control_head);
+copy_private_data(common, ccbegin, ccend, FALSE, framesize + alternativesize, private_data_size + framesize + alternativesize, needs_control_head);
free_stack(common, private_data_size + framesize + alternativesize);
if (needs_control_head)
{
- OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), 2 * sizeof(sljit_sw));
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(-3));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(-2));
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, TMP1, 0);
OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, TMP2, 0);
}
else
{
- OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), sizeof(sljit_sw));
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(-2));
OP1(SLJIT_MOV, TMP1, 0, TMP3, 0);
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr, TMP2, 0);
}
-sljit_emit_fast_return(compiler, SLJIT_MEM1(STACK_TOP), 0);
+sljit_emit_fast_return(compiler, SLJIT_MEM1(STACK_TOP), STACK(-1));
}
#undef COMPILE_BACKTRACKINGPATH
@@ -11237,7 +11255,7 @@ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP2, 0);
OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, stack));
OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, top), STACK_TOP, 0);
-OP2(SLJIT_ADD, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, limit), SLJIT_IMM, STACK_GROWTH_RATE);
+OP2(SLJIT_SUB, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(struct sljit_stack, limit), SLJIT_IMM, STACK_GROWTH_RATE);
sljit_emit_ijump(compiler, SLJIT_CALL2, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_stack_resize));
jump = CMP(SLJIT_NOT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
@@ -11391,10 +11409,10 @@ union {
sljit_u8 local_space[MACHINE_STACK_SIZE];
struct sljit_stack local_stack;
-local_stack.top = (sljit_sw)&local_space;
-local_stack.base = local_stack.top;
-local_stack.limit = local_stack.base + MACHINE_STACK_SIZE;
-local_stack.max_limit = local_stack.limit;
+local_stack.max_limit = local_space;
+local_stack.limit = local_space;
+local_stack.base = local_space + MACHINE_STACK_SIZE;
+local_stack.top = local_space + MACHINE_STACK_SIZE;
arguments->stack = &local_stack;
convert_executable_func.executable_func = executable_func;
return convert_executable_func.call_executable_func(arguments);
diff --git a/pcre/pcre_scanner_unittest.cc b/pcre/pcre_scanner_unittest.cc
index c00312c4f63..623e2afda80 100644
--- a/pcre/pcre_scanner_unittest.cc
+++ b/pcre/pcre_scanner_unittest.cc
@@ -57,6 +57,7 @@
} while (0)
using std::vector;
+using std::string;
using pcrecpp::StringPiece;
using pcrecpp::Scanner;
diff --git a/pcre/pcre_stringpiece.h.in b/pcre/pcre_stringpiece.h.in
index eb25826b453..f54f3f3b31b 100644
--- a/pcre/pcre_stringpiece.h.in
+++ b/pcre/pcre_stringpiece.h.in
@@ -52,12 +52,12 @@
#include <pcre.h>
+namespace pcrecpp {
+
using std::memcmp;
using std::strlen;
using std::string;
-namespace pcrecpp {
-
class PCRECPP_EXP_DEFN StringPiece {
private:
const char* ptr_;
diff --git a/pcre/pcre_stringpiece_unittest.cc b/pcre/pcre_stringpiece_unittest.cc
index 1c4759da3b0..88e73a1f976 100644
--- a/pcre/pcre_stringpiece_unittest.cc
+++ b/pcre/pcre_stringpiece_unittest.cc
@@ -24,6 +24,7 @@
} \
} while (0)
+using std::string;
using pcrecpp::StringPiece;
static void CheckSTLComparator() {
diff --git a/pcre/pcre_tables.c b/pcre/pcre_tables.c
index 4960af57c4d..5e18e8cf904 100644
--- a/pcre/pcre_tables.c
+++ b/pcre/pcre_tables.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2012 University of Cambridge
+ Copyright (c) 1997-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -161,7 +161,7 @@ const pcre_uint32 PRIV(ucp_gbtable[]) = {
(1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark), /* 5 SpacingMark */
(1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbL)| /* 6 L */
- (1<<ucp_gbL)|(1<<ucp_gbV)|(1<<ucp_gbLV)|(1<<ucp_gbLVT),
+ (1<<ucp_gbV)|(1<<ucp_gbLV)|(1<<ucp_gbLVT),
(1<<ucp_gbExtend)|(1<<ucp_gbSpacingMark)|(1<<ucp_gbV)| /* 7 V */
(1<<ucp_gbT),
diff --git a/pcre/pcre_ucd.c b/pcre/pcre_ucd.c
index 69c4fd42c34..f22f826c4c2 100644
--- a/pcre/pcre_ucd.c
+++ b/pcre/pcre_ucd.c
@@ -38,6 +38,20 @@ const pcre_uint16 PRIV(ucd_stage2)[] = {0};
const pcre_uint32 PRIV(ucd_caseless_sets)[] = {0};
#else
+/* If the 32-bit library is run in non-32-bit mode, character values
+greater than 0x10ffff may be encountered. For these we set up a
+special record. */
+
+#ifdef COMPILE_PCRE32
+const ucd_record PRIV(dummy_ucd_record)[] = {{
+ ucp_Common, /* script */
+ ucp_Cn, /* type unassigned */
+ ucp_gbOther, /* grapheme break property */
+ 0, /* case set */
+ 0, /* other case */
+ }};
+#endif
+
/* When recompiling tables with a new Unicode version, please check the
types in this structure definition from pcre_internal.h (the actual
field names will be different):
diff --git a/pcre/pcrecpp_unittest.cc b/pcre/pcrecpp_unittest.cc
index 92cae8fbea5..4b15fbef1c3 100644
--- a/pcre/pcrecpp_unittest.cc
+++ b/pcre/pcrecpp_unittest.cc
@@ -43,6 +43,7 @@
#include <vector>
#include "pcrecpp.h"
+using std::string;
using pcrecpp::StringPiece;
using pcrecpp::RE;
using pcrecpp::RE_Options;
diff --git a/pcre/pcregrep.c b/pcre/pcregrep.c
index fd2a67622ba..317f7454e13 100644
--- a/pcre/pcregrep.c
+++ b/pcre/pcregrep.c
@@ -1804,11 +1804,6 @@ while (ptr < endptr)
if (line_buffered) fflush(stdout);
rc = 0; /* Had some success */
- /* If the current match ended past the end of the line (only possible
- in multiline mode), we are done with this line. */
-
- if ((unsigned int)offsets[1] > linelength) goto END_ONE_MATCH;
-
startoffset = offsets[1]; /* Restart after the match */
if (startoffset <= oldstartoffset)
{
@@ -1818,6 +1813,22 @@ while (ptr < endptr)
if (utf8)
while ((matchptr[startoffset] & 0xc0) == 0x80) startoffset++;
}
+
+ /* If the current match ended past the end of the line (only possible
+ in multiline mode), we must move on to the line in which it did end
+ before searching for more matches. */
+
+ while (startoffset > (int)linelength)
+ {
+ matchptr = ptr += linelength + endlinelength;
+ filepos += (int)(linelength + endlinelength);
+ linenumber++;
+ startoffset -= (int)(linelength + endlinelength);
+ t = end_of_line(ptr, endptr, &endlinelength);
+ linelength = t - ptr - endlinelength;
+ length = (size_t)(endptr - ptr);
+ }
+
goto ONLY_MATCHING_RESTART;
}
}
@@ -3179,9 +3190,11 @@ for (j = 1, cp = patterns; cp != NULL; j++, cp = cp->next)
cp->hint = pcre_study(cp->compiled, study_options, &error);
if (error != NULL)
{
- char s[16];
- if (patterns->next == NULL) s[0] = 0; else sprintf(s, " number %d", j);
- fprintf(stderr, "pcregrep: Error while studying regex%s: %s\n", s, error);
+ if (patterns->next == NULL)
+ fprintf(stderr, "pcregrep: Error while studying regex: %s\n", error);
+ else
+ fprintf(stderr, "pcregrep: Error while studying regex number %d: %s\n",
+ j, error);
goto EXIT2;
}
#ifdef SUPPORT_PCREGREP_JIT
diff --git a/pcre/pcreposix.c b/pcre/pcreposix.c
index cf75588c40d..7b404a71100 100644
--- a/pcre/pcreposix.c
+++ b/pcre/pcreposix.c
@@ -6,7 +6,7 @@
and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel
- Copyright (c) 1997-2016 University of Cambridge
+ Copyright (c) 1997-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -389,8 +389,8 @@ if (rc >= 0)
{
for (i = 0; i < (size_t)rc; i++)
{
- pmatch[i].rm_so = ovector[i*2];
- pmatch[i].rm_eo = ovector[i*2+1];
+ pmatch[i].rm_so = ovector[i*2] + so;
+ pmatch[i].rm_eo = ovector[i*2+1] + so;
}
if (allocated_ovector) free(ovector);
for (; i < nmatch; i++) pmatch[i].rm_so = pmatch[i].rm_eo = -1;
diff --git a/pcre/pcretest.c b/pcre/pcretest.c
index 5b73a918075..f1303037281 100644
--- a/pcre/pcretest.c
+++ b/pcre/pcretest.c
@@ -177,7 +177,7 @@ that differ in their output from isprint() even in the "C" locale. */
#define PRINTABLE(c) ((c) >= 32 && (c) < 127)
#endif
-#define PRINTOK(c) (locale_set? isprint(c) : PRINTABLE(c))
+#define PRINTOK(c) (locale_set? (((c) < 256) && isprint(c)) : PRINTABLE(c))
/* Posix support is disabled in 16 or 32 bit only mode. */
#if !defined SUPPORT_PCRE8 && !defined NOPOSIX
@@ -426,11 +426,11 @@ argument, the casting might be incorrectly applied. */
#define PCRE_COPY_NAMED_SUBSTRING32(rc, re, bptr, offsets, count, \
namesptr, cbuffer, size) \
rc = pcre32_copy_named_substring((pcre32 *)re, (PCRE_SPTR32)bptr, offsets, \
- count, (PCRE_SPTR32)namesptr, (PCRE_UCHAR32 *)cbuffer, size/2)
+ count, (PCRE_SPTR32)namesptr, (PCRE_UCHAR32 *)cbuffer, size/4)
#define PCRE_COPY_SUBSTRING32(rc, bptr, offsets, count, i, cbuffer, size) \
rc = pcre32_copy_substring((PCRE_SPTR32)bptr, offsets, count, i, \
- (PCRE_UCHAR32 *)cbuffer, size/2)
+ (PCRE_UCHAR32 *)cbuffer, size/4)
#define PCRE_DFA_EXEC32(count, re, extra, bptr, len, start_offset, options, \
offsets, size_offsets, workspace, size_workspace) \
@@ -4834,7 +4834,16 @@ while (!done)
continue;
case 'O':
- while(isdigit(*p)) n = n * 10 + *p++ - '0';
+ while(isdigit(*p))
+ {
+ if (n > (INT_MAX-10)/10) /* Hack to stop fuzzers */
+ {
+ printf("** \\O argument is too big\n");
+ yield = 1;
+ goto EXIT;
+ }
+ n = n * 10 + *p++ - '0';
+ }
if (n > size_offsets_max)
{
size_offsets_max = n;
diff --git a/pcre/testdata/testinput1 b/pcre/testdata/testinput1
index 93abab3c851..5c23f41fa81 100644
--- a/pcre/testdata/testinput1
+++ b/pcre/testdata/testinput1
@@ -5739,4 +5739,7 @@ AbcdCBefgBhiBqz
/(?=.*X)X$/
\ X
+/X+(?#comment)?/
+ >XXX<
+
/-- End of testinput1 --/
diff --git a/pcre/testdata/testinput12 b/pcre/testdata/testinput12
index 944be6943f5..89ed4564bcd 100644
--- a/pcre/testdata/testinput12
+++ b/pcre/testdata/testinput12
@@ -104,4 +104,6 @@ and a couple of things that are different with JIT. --/
/(.|.)*?bx/
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax
+/((?(?!))x)(?'name')(?1)/S++
+
/-- End of testinput12 --/
diff --git a/pcre/testdata/testinput15 b/pcre/testdata/testinput15
index 83e26773471..c065105b1ec 100644
--- a/pcre/testdata/testinput15
+++ b/pcre/testdata/testinput15
@@ -363,4 +363,7 @@ correctly, but that messes up comparisons). --/
/abc/89
+//8+L
+ \xf1\xad\xae\xae
+
/-- End of testinput15 --/
diff --git a/pcre/testdata/testinput8 b/pcre/testdata/testinput8
index 7f8fa8292c5..e931410479f 100644
--- a/pcre/testdata/testinput8
+++ b/pcre/testdata/testinput8
@@ -4845,4 +4845,7 @@
aaa\D
a\D
+/(02-)?[0-9]{3}-[0-9]{3}/
+ 02-123-123
+
/-- End of testinput8 --/
diff --git a/pcre/testdata/testoutput1 b/pcre/testdata/testoutput1
index a2b3cffe9d4..eff8ecc948c 100644
--- a/pcre/testdata/testoutput1
+++ b/pcre/testdata/testoutput1
@@ -9442,4 +9442,8 @@ No match
\ X
0: X
+/X+(?#comment)?/
+ >XXX<
+ 0: X
+
/-- End of testinput1 --/
diff --git a/pcre/testdata/testoutput12 b/pcre/testdata/testoutput12
index 87911086f49..7632c4e5801 100644
--- a/pcre/testdata/testoutput12
+++ b/pcre/testdata/testoutput12
@@ -201,4 +201,6 @@ No match, mark = m (JIT)
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabax
Error -8 (match limit exceeded)
+/((?(?!))x)(?'name')(?1)/S++
+
/-- End of testinput12 --/
diff --git a/pcre/testdata/testoutput15 b/pcre/testdata/testoutput15
index bad2807c2fd..e4e123c3983 100644
--- a/pcre/testdata/testoutput15
+++ b/pcre/testdata/testoutput15
@@ -1136,4 +1136,9 @@ Failed: setting UTF is disabled by the application at offset 0
/abc/89
Failed: setting UTF is disabled by the application at offset 0
+//8+L
+ \xf1\xad\xae\xae
+ 0:
+ 0+ \x{6dbae}
+
/-- End of testinput15 --/
diff --git a/pcre/testdata/testoutput8 b/pcre/testdata/testoutput8
index 17b667a980c..4984376d3c8 100644
--- a/pcre/testdata/testoutput8
+++ b/pcre/testdata/testoutput8
@@ -7801,4 +7801,8 @@ No match
** Show all captures ignored after DFA matching
0: a
+/(02-)?[0-9]{3}-[0-9]{3}/
+ 02-123-123
+ 0: 02-123-123
+
/-- End of testinput8 --/
diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc
index 7901853c3f8..ab437bcfa7e 100644
--- a/plugin/semisync/semisync_master.cc
+++ b/plugin/semisync/semisync_master.cc
@@ -555,7 +555,7 @@ int ReplSemiSyncMaster::reportReplyBinlog(uint32 server_id,
if (need_copy_send_pos)
{
- strcpy(reply_file_name_, log_file_name);
+ strmake_buf(reply_file_name_, log_file_name);
reply_file_pos_ = log_file_pos;
reply_file_name_inited_ = true;
@@ -663,7 +663,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
if (cmp <= 0)
{
/* This thd has a lower position, let's update the minimum info. */
- strcpy(wait_file_name_, trx_wait_binlog_name);
+ strmake_buf(wait_file_name_, trx_wait_binlog_name);
wait_file_pos_ = trx_wait_binlog_pos;
rpl_semi_sync_master_wait_pos_backtraverse++;
@@ -674,7 +674,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
}
else
{
- strcpy(wait_file_name_, trx_wait_binlog_name);
+ strmake_buf(wait_file_name_, trx_wait_binlog_name);
wait_file_pos_ = trx_wait_binlog_pos;
wait_file_name_inited_ = true;
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index e303855f38c..2f9c18569e3 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2017, Oracle and/or its affiliates.
+# Copyright (c) 2011, 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
@@ -116,6 +117,13 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles|Ninja")
ENDFOREACH()
ENDIF()
+
+IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ SET (PERL_PATH "/usr/local/bin/perl")
+ELSE()
+ SET (PERL_PATH "/usr/bin/perl")
+ENDIF()
+
IF(UNIX)
# FIND_PROC and CHECK_PID are used by mysqld_safe
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
@@ -384,4 +392,3 @@ IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_FLAGS MATCHES "-static")
COMPONENT Development)
ENDIF()
ENDIF()
-
diff --git a/scripts/dheadgen.pl b/scripts/dheadgen.pl
index c42bd49b32e..69ece2e7c81 100755..100644
--- a/scripts/dheadgen.pl
+++ b/scripts/dheadgen.pl
@@ -1,10 +1,4 @@
-#!/usr/bin/perl -w
-
-#
-# Copyright (c) 2008, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
-#
-
+# Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
diff --git a/scripts/mysql_config.pl.in b/scripts/mysql_config.pl.in
index d7b36ec9b09..f2c27bc0b84 100644
--- a/scripts/mysql_config.pl.in
+++ b/scripts/mysql_config.pl.in
@@ -1,7 +1,7 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
# -*- cperl -*-
#
-# Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 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
diff --git a/scripts/mysql_convert_table_format.sh b/scripts/mysql_convert_table_format.sh
index d8258726347..8fe7e9b2276 100644
--- a/scripts/mysql_convert_table_format.sh
+++ b/scripts/mysql_convert_table_format.sh
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-# Copyright (c) 2000-2002, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+#!@PERL_PATH@
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/scripts/mysql_find_rows.sh b/scripts/mysql_find_rows.sh
index 8a163e0edf1..4a9c3dbd41c 100644
--- a/scripts/mysql_find_rows.sh
+++ b/scripts/mysql_find_rows.sh
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-# Copyright (c) 2000, 2004, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+#!@PERL_PATH@
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/scripts/mysql_fix_extensions.sh b/scripts/mysql_fix_extensions.sh
index 79a9461fbb4..edc209589e8 100644
--- a/scripts/mysql_fix_extensions.sh
+++ b/scripts/mysql_fix_extensions.sh
@@ -1,7 +1,6 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2001 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in
index 3ad733884fb..9d2c1f6874a 100644
--- a/scripts/mysql_install_db.pl.in
+++ b/scripts/mysql_install_db.pl.in
@@ -1,7 +1,7 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
# -*- cperl -*-
#
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates.
+# Copyright (c) 2007, 2017, Oracle and/or its affiliates.
#
# 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
diff --git a/scripts/mysql_secure_installation.pl.in b/scripts/mysql_secure_installation.pl.in
index 32331c3d601..01d34c4af4d 100644
--- a/scripts/mysql_secure_installation.pl.in
+++ b/scripts/mysql_secure_installation.pl.in
@@ -1,7 +1,7 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
# -*- cperl -*-
#
-# Copyright (c) 2007, 2012, Oracle and/or its affiliates.
+# Copyright (c) 2007, 2017, Oracle and/or its affiliates.
#
# 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
@@ -388,6 +388,3 @@ Thanks for using MySQL!
HERE
-
-
-
diff --git a/scripts/mysql_setpermission.sh b/scripts/mysql_setpermission.sh
index 6e9d0e9fabe..1d67ff82f3b 100644
--- a/scripts/mysql_setpermission.sh
+++ b/scripts/mysql_setpermission.sh
@@ -1,8 +1,7 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
## Emacs, this is -*- perl -*- mode? :-)
-# Copyright (c) 2000, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index ea1059cdd78..47459d58bd2 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -672,6 +672,15 @@ DROP PROCEDURE mysql.count_duplicate_host_names;
# Convering the host name to lower case for existing users
UPDATE user SET host=LOWER( host ) WHERE LOWER( host ) <> host;
+# fix bad data when upgrading from unfixed InnoDB (MDEV-13360)
+set @str="delete from innodb_index_stats where length(table_name) > 64";
+set @str=if(@have_innodb <> 0, @str, "set @dummy = 0");
+prepare stmt from @str;
+execute stmt;
+set @str=replace(@str, "innodb_index_stats", "innodb_table_stats");
+prepare stmt from @str;
+execute stmt;
+
# update timestamp fields in the innodb stat tables
set @str="alter table mysql.innodb_index_stats modify last_update timestamp not null default current_timestamp on update current_timestamp";
set @str=if(@have_innodb <> 0, @str, "set @dummy = 0");
diff --git a/scripts/mysql_zap.sh b/scripts/mysql_zap.sh
index 98c3603df15..a2ee225c0c6 100644
--- a/scripts/mysql_zap.sh
+++ b/scripts/mysql_zap.sh
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-# Copyright (c) 2000-2002, 2004, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+#!@PERL_PATH@
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh
index a7cc2eccf38..e7c1f8d1fd6 100644
--- a/scripts/mysqlaccess.sh
+++ b/scripts/mysqlaccess.sh
@@ -1,6 +1,6 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -477,16 +477,23 @@ MySQLaccess::Report::Print_Header();
# *****************************
# Read configuration-file
MySQLaccess::Debug::Print(1, "Reading configuration file...");
- if (-f "./$script_conf") {
- require "./$script_conf";
+ if (-f "@sysconfdir@/$script_conf") {
+ print "Configuration file '$script_conf' is found in '@sysconfdir@/'\n";
+ require "@sysconfdir@/$script_conf";
}
elsif (-f "@prefix@/$script_conf") {
+ print "Configuration file '$script_conf' is found in '@prefix@/'\n";
require "@prefix@/$script_conf";
}
- elsif (-f "@sysconfdir@/$script_conf") {
- require "@sysconfdir@/$script_conf";
+ elsif (-f "./$script_conf") {
+ print "\nERROR! Configuration file '$script_conf' is found in the current ";
+ print "directory.\nThe permissible locations for this file are either ";
+ print "@sysconfdir@/ or @prefix@/\n";
+ print "Please move it to one of these locations and retry.\n\n";
+ exit 0;
}
+
# ****************************
# Read in all parameters
if ($MySQLaccess::CMD) { #command-line version
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index a0bc06e5e58..c6515a3986b 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -1,23 +1,7 @@
-#!/usr/bin/perl
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates.
-# Copyright (c) 2000-2011 Monty Program Ab, Jani Tolonen
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this library; if not, write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-# MA 02110-1301, USA
+#!@PERL_PATH@
-# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates.
+# Copyright (c) 2010, 2017, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh
index d8b6158ecbe..98241da3cba 100644
--- a/scripts/mysqldumpslow.sh
+++ b/scripts/mysqldumpslow.sh
@@ -1,7 +1,6 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2000-2002, 2005-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index b6ff7e1b28d..d6184d9ef10 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -1,6 +1,6 @@
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
diff --git a/sql-common/client.c b/sql-common/client.c
index a918060a848..b7796cebead 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1148,6 +1148,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
break;
case OPT_pipe:
options->protocol = MYSQL_PROTOCOL_PIPE;
+ break;
case OPT_connect_timeout:
case OPT_timeout:
if (opt_arg)
diff --git a/sql/item.cc b/sql/item.cc
index 82b7cacbabb..ae77e90fa85 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2010, 2017, MariaDB
+ Copyright (c) 2010, 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
@@ -770,6 +770,7 @@ Item_ident::Item_ident(THD *thd, Name_resolution_context *context_arg,
cached_table(0), depended_from(0), can_be_depended(TRUE)
{
name = (char*) field_name_arg;
+ name_length= name ? strlen(name) : 0;
}
@@ -783,6 +784,7 @@ Item_ident::Item_ident(THD *thd, TABLE_LIST *view_arg, const char *field_name_ar
cached_table(NULL), depended_from(NULL), can_be_depended(TRUE)
{
name = (char*) field_name_arg;
+ name_length= name ? strlen(name) : 0;
}
@@ -4454,7 +4456,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
int cur_match_degree= 0;
/* SELECT list element with explicit alias */
- if ((*(cur_group->item))->name &&
+ if ((*(cur_group->item))->name && !table_name &&
!(*(cur_group->item))->is_autogenerated_name &&
!my_strcasecmp(system_charset_info,
(*(cur_group->item))->name, field_name))
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index fe79e5f083d..e45e568e3da 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -5317,7 +5317,7 @@ void Regexp_processor_pcre::set_recursion_limit(THD *thd)
DBUG_ASSERT(thd == current_thd);
stack_used= available_stack_size(thd->thread_stack, &stack_used);
m_pcre_extra.match_limit_recursion=
- (my_thread_stack_size - stack_used)/my_pcre_frame_size;
+ (my_thread_stack_size - STACK_MIN_SIZE - stack_used)/my_pcre_frame_size;
}
@@ -5581,6 +5581,12 @@ void Regexp_processor_pcre::fix_owner(Item_func *owner,
}
+bool Item_func_regex::fix_fields(THD *thd, Item **ref)
+{
+ re.set_recursion_limit(thd);
+ return Item_bool_func::fix_fields(thd, ref);
+}
+
void
Item_func_regex::fix_length_and_dec()
{
@@ -5607,6 +5613,13 @@ longlong Item_func_regex::val_int()
}
+bool Item_func_regexp_instr::fix_fields(THD *thd, Item **ref)
+{
+ re.set_recursion_limit(thd);
+ return Item_int_func::fix_fields(thd, ref);
+}
+
+
void
Item_func_regexp_instr::fix_length_and_dec()
{
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 56c5a4afe54..a34e70f9918 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1991,6 +1991,7 @@ public:
DBUG_VOID_RETURN;
}
longlong val_int();
+ bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const { return "regexp"; }
@@ -2018,6 +2019,7 @@ public:
DBUG_VOID_RETURN;
}
longlong val_int();
+ bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const { return "regexp_instr"; }
};
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index e14fc1526cd..a89c51ad87b 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1281,6 +1281,13 @@ void Item_func_replace::fix_length_and_dec()
/*********************************************************************/
+bool Item_func_regexp_replace::fix_fields(THD *thd, Item **ref)
+{
+ re.set_recursion_limit(thd);
+ return Item_str_func::fix_fields(thd, ref);
+}
+
+
void Item_func_regexp_replace::fix_length_and_dec()
{
if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 3))
@@ -1416,6 +1423,13 @@ err:
}
+bool Item_func_regexp_substr::fix_fields(THD *thd, Item **ref)
+{
+ re.set_recursion_limit(thd);
+ return Item_str_func::fix_fields(thd, ref);
+}
+
+
void Item_func_regexp_substr::fix_length_and_dec()
{
if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 2))
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 9818982b411..95eac328a47 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -305,6 +305,7 @@ public:
DBUG_VOID_RETURN;
}
String *val_str(String *str);
+ bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const { return "regexp_replace"; }
};
@@ -325,6 +326,7 @@ public:
DBUG_VOID_RETURN;
}
String *val_str(String *str);
+ bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
const char *func_name() const { return "regexp_substr"; }
};
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 3ca7d3afa6c..12230014f59 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -330,7 +330,8 @@ bool Item_subselect::enumerate_field_refs_processor(uchar *arg)
while ((upper= it++))
{
- if (upper->item->walk(&Item::enumerate_field_refs_processor, FALSE, arg))
+ if (upper->item &&
+ upper->item->walk(&Item::enumerate_field_refs_processor, FALSE, arg))
return TRUE;
}
return FALSE;
@@ -3413,7 +3414,8 @@ bool Item_in_subselect::init_cond_guards()
{
DBUG_ASSERT(thd);
uint cols_num= left_expr->cols();
- if (!abort_on_null && left_expr->maybe_null && !pushed_cond_guards)
+ if (!abort_on_null && !pushed_cond_guards &&
+ (left_expr->maybe_null || cols_num > 1))
{
if (!(pushed_cond_guards= (bool*)thd->alloc(sizeof(bool) * cols_num)))
return TRUE;
diff --git a/sql/log.cc b/sql/log.cc
index 665157a06c5..e36f974709b 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -9769,8 +9769,8 @@ int TC_LOG_BINLOG::recover(LOG_INFO *linfo, const char *last_log_name,
sizeof(xev->xid));
if (!x || my_hash_insert(&xids, x))
goto err2;
- break;
}
+ break;
}
case BINLOG_CHECKPOINT_EVENT:
if (first_round && do_xa)
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index 53d0c3204a1..50918d8dcf2 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -1224,28 +1224,18 @@ bool DsMrr_impl::setup_buffer_sharing(uint key_size_in_keybuf,
ptrdiff_t bytes_for_keys= (full_buf_end - full_buf) - bytes_for_rowids;
- if (bytes_for_keys < key_buff_elem_size + 1)
- {
- ptrdiff_t add= key_buff_elem_size + 1 - bytes_for_keys;
- bytes_for_keys= key_buff_elem_size + 1;
- bytes_for_rowids -= add;
- }
-
- if (bytes_for_rowids < (ptrdiff_t)rowid_buf_elem_size + 1)
- {
- ptrdiff_t add= (ptrdiff_t)(rowid_buf_elem_size + 1 - bytes_for_rowids);
- bytes_for_rowids= (ptrdiff_t)rowid_buf_elem_size + 1;
- bytes_for_keys -= add;
- }
+ if (bytes_for_keys < key_buff_elem_size + 1 ||
+ bytes_for_rowids < (ptrdiff_t)rowid_buf_elem_size + 1)
+ return TRUE; /* Failed to provide minimum space for one of the buffers */
rowid_buffer_end= full_buf + bytes_for_rowids;
rowid_buffer.set_buffer_space(full_buf, rowid_buffer_end);
key_buffer= &backward_key_buf;
key_buffer->set_buffer_space(rowid_buffer_end, full_buf_end);
- if (!key_buffer->have_space_for(key_buff_elem_size) ||
- !rowid_buffer.have_space_for((size_t)rowid_buf_elem_size))
- return TRUE; /* Failed to provide minimum space for one of the buffers */
+ /* The above code guarantees that the buffers are big enough */
+ DBUG_ASSERT(key_buffer->have_space_for(key_buff_elem_size) &&
+ rowid_buffer.have_space_for((size_t)rowid_buf_elem_size));
return FALSE;
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e363c6de3f1..3af8750de13 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3587,7 +3587,6 @@ sizeof(load_default_groups)/sizeof(load_default_groups[0]);
#endif
-#ifndef EMBEDDED_LIBRARY
/**
This function is used to check for stack overrun for pathological
cases of regular expressions and 'like' expressions.
@@ -3616,8 +3615,6 @@ check_enough_stack_size(int recurse_level)
return 0;
return check_enough_stack_size_slow();
}
-#endif
-
/*
@@ -3639,11 +3636,12 @@ static void init_pcre()
{
pcre_malloc= pcre_stack_malloc= my_str_malloc_mysqld;
pcre_free= pcre_stack_free= my_str_free_mysqld;
-#ifndef EMBEDDED_LIBRARY
pcre_stack_guard= check_enough_stack_size_slow;
/* See http://pcre.org/original/doc/html/pcrestack.html */
- my_pcre_frame_size= -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0) + 16;
-#endif
+ my_pcre_frame_size= -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0);
+ // pcre can underestimate its stack usage. Use a safe value, as in the manual
+ set_if_bigger(my_pcre_frame_size, 500);
+ my_pcre_frame_size += 16; // Again, safety margin, see the manual
}
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index da3c5646e84..ed283863d31 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2012, 2016, MariaDB
+ Copyright (c) 2012, 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
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index e4e29378c25..1c41aa79af2 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -7306,8 +7306,10 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
table_map param_comp= ~(param->prev_tables | param->read_tables |
param->current_table);
#ifdef HAVE_SPATIAL
+ Field::geometry_type sav_geom_type;
if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
{
+ sav_geom_type= ((Field_geom*) field_item->field)->geom_type;
/* We have to be able to store all sorts of spatial features here */
((Field_geom*) field_item->field)->geom_type= Field::GEOM_GEOMETRY;
}
@@ -7338,6 +7340,13 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
}
}
}
+
+#ifdef HAVE_SPATIAL
+ if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
+ {
+ ((Field_geom*) field_item->field)->geom_type= sav_geom_type;
+ }
+#endif /*HAVE_SPATIAL*/
DBUG_RETURN(ftree);
}
diff --git a/sql/records.cc b/sql/records.cc
index 3901161a2cb..d98c6939e04 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2009, 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
diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc
index 733af6c61c8..520fb61d8c4 100644
--- a/sql/rpl_handler.cc
+++ b/sql/rpl_handler.cc
@@ -267,7 +267,7 @@ int Binlog_storage_delegate::after_flush(THD *thd,
thd->semisync_info= log_info;
}
- strcpy(log_info->log_file, log_file+dirname_length(log_file));
+ strmake_buf(log_info->log_file, log_file+dirname_length(log_file));
log_info->log_pos = log_pos;
FOREACH_OBSERVER(ret, after_flush, false,
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index ed756a996ca..ab54f0bfbb7 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2006, 2012, Oracle and/or its affiliates.
- Copyright (c) 2010, 2011, Monty Program Ab
+/* Copyright (c) 2006, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2010, 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
@@ -844,7 +844,6 @@ void end_master_info(Master_info* mi)
if (!mi->inited)
DBUG_VOID_RETURN;
- end_relay_log_info(&mi->rli);
if (mi->fd >= 0)
{
end_io_cache(&mi->file);
@@ -883,6 +882,7 @@ void free_key_master_info(Master_info *mi)
/* We use 2 here instead of 1 just to make it easier when debugging */
mi->killed= 2;
end_master_info(mi);
+ end_relay_log_info(&mi->rli);
mi->unlock_slave_threads();
delete mi;
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 363f114ce9a..64a1b535307 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2006, 2013, Oracle and/or its affiliates.
- Copyright (c) 2010, 2013, Monty Program Ab
+/* Copyright (c) 2006, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2011, 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
@@ -54,8 +54,8 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
sync_counter(0), is_relay_log_recovery(is_slave_recovery),
save_temporary_tables(0), mi(0),
inuse_relaylog_list(0), last_inuse_relaylog(0),
- cur_log_old_open_count(0), group_relay_log_pos(0),
- event_relay_log_pos(0),
+ cur_log_old_open_count(0), error_on_rli_init_info(false),
+ group_relay_log_pos(0), event_relay_log_pos(0),
#if HAVE_valgrind
is_fake(FALSE),
#endif
@@ -119,7 +119,7 @@ int init_relay_log_info(Relay_log_info* rli,
const char* info_fname)
{
char fname[FN_REFLEN+128];
- int info_fd;
+ int info_fd= -1;
const char* msg = 0;
int error = 0;
mysql_mutex_t *log_lock;
@@ -132,6 +132,8 @@ int init_relay_log_info(Relay_log_info* rli,
log_lock= rli->relay_log.get_log_lock();
fn_format(fname, info_fname, mysql_data_home, "", 4+32);
mysql_mutex_lock(&rli->data_lock);
+ if (rli->error_on_rli_init_info)
+ goto err;
info_fd = rli->info_fd;
rli->cur_log_fd = -1;
rli->slave_skip_counter=0;
@@ -255,8 +257,8 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
if ((info_fd= mysql_file_open(key_file_relay_log_info,
fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0)
{
- sql_print_error("Failed to create a new relay log info file (\
-file '%s', errno %d)", fname, my_errno);
+ sql_print_error("Failed to create a new relay log info file ("
+ "file '%s', errno %d)", fname, my_errno);
msg= current_thd->get_stmt_da()->message();
goto err;
}
@@ -431,11 +433,14 @@ Failed to open the existing relay log info file '%s' (errno %d)",
goto err;
}
rli->inited= 1;
+ rli->error_on_rli_init_info= false;
mysql_mutex_unlock(&rli->data_lock);
DBUG_RETURN(0);
err:
- sql_print_error("%s", msg);
+ rli->error_on_rli_init_info= true;
+ if (msg)
+ sql_print_error("%s", msg);
end_io_cache(&rli->info_file);
if (info_fd >= 0)
mysql_file_close(info_fd, MYF(0));
@@ -1108,6 +1113,8 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
const char** errmsg)
{
int error=0;
+ const char *ln;
+ char name_buf[FN_REFLEN];
DBUG_ENTER("purge_relay_logs");
/*
@@ -1134,12 +1141,37 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
if (!rli->inited)
{
DBUG_PRINT("info", ("rli->inited == 0"));
- DBUG_RETURN(0);
- }
-
- DBUG_ASSERT(rli->slave_running == 0);
- DBUG_ASSERT(rli->mi->slave_running == 0);
+ if (rli->error_on_rli_init_info)
+ {
+ ln= rli->relay_log.generate_name(opt_relay_logname, "-relay-bin",
+ 1, name_buf);
+ if (rli->relay_log.open_index_file(opt_relaylog_index_name, ln, TRUE))
+ {
+ sql_print_error("Unable to purge relay log files. Failed to open relay "
+ "log index file:%s.", rli->relay_log.get_index_fname());
+ DBUG_RETURN(1);
+ }
+ mysql_mutex_lock(rli->relay_log.get_log_lock());
+ if (rli->relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND,
+ (rli->max_relay_log_size ? rli->max_relay_log_size :
+ max_binlog_size), 1, TRUE))
+ {
+ sql_print_error("Unable to purge relay log files. Failed to open relay "
+ "log file:%s.", rli->relay_log.get_log_fname());
+ mysql_mutex_unlock(rli->relay_log.get_log_lock());
+ DBUG_RETURN(1);
+ }
+ mysql_mutex_unlock(rli->relay_log.get_log_lock());
+ }
+ else
+ DBUG_RETURN(0);
+ }
+ else
+ {
+ DBUG_ASSERT(rli->slave_running == 0);
+ DBUG_ASSERT(rli->mi->slave_running == 0);
+ }
mysql_mutex_lock(&rli->data_lock);
/*
@@ -1186,6 +1218,12 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
rli->group_relay_log_name[0]= rli->event_relay_log_name[0]= 0;
}
+ if (!rli->inited && rli->error_on_rli_init_info)
+ {
+ mysql_mutex_lock(rli->relay_log.get_log_lock());
+ rli->relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
+ mysql_mutex_unlock(rli->relay_log.get_log_lock());
+ }
err:
DBUG_PRINT("info",("log_space_total: %llu",rli->log_space_total));
mysql_mutex_unlock(&rli->data_lock);
diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h
index b9fc2127440..74d5b6fe416 100644
--- a/sql/rpl_rli.h
+++ b/sql/rpl_rli.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2005, 2012, Oracle and/or its affiliates.
+/* Copyright (c) 2005, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2009, 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
@@ -176,7 +177,14 @@ public:
a different log under our feet
*/
uint32 cur_log_old_open_count;
-
+
+ /*
+ If on init_info() call error_on_rli_init_info is true that means
+ that previous call to init_info() terminated with an error, RESET
+ SLAVE must be executed and the problem fixed manually.
+ */
+ bool error_on_rli_init_info;
+
/*
Let's call a group (of events) :
- a transaction
diff --git a/sql/slave.cc b/sql/slave.cc
index 1e093f97fa8..db1c3305b98 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2009, 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
@@ -483,6 +483,7 @@ int init_slave()
{
delete active_mi;
active_mi= 0;
+ sql_print_error("Failed to allocate memory for the Master Info structure");
goto err;
}
@@ -545,7 +546,6 @@ end:
DBUG_RETURN(error);
err:
- sql_print_error("Failed to allocate memory for the Master Info structure");
error= 1;
goto end;
}
@@ -6339,6 +6339,7 @@ void end_relay_log_info(Relay_log_info* rli)
mysql_mutex_t *log_lock;
DBUG_ENTER("end_relay_log_info");
+ rli->error_on_rli_init_info= false;
if (!rli->inited)
DBUG_VOID_RETURN;
if (rli->info_fd >= 0)
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 9c4fe168fe3..e8d2fb42383 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -1149,8 +1149,8 @@ int Gis_polygon::centroid_xy(double *x, double *y) const
uint32 n_points, org_n_points;
double prev_x, prev_y;
double cur_area= 0;
- double cur_cx= 0;
- double cur_cy= 0;
+ double cur_cx= 0, cur_cy= 0;
+ double sum_cx= 0, sum_cy= 0;
if (no_data(data, 4))
return 1;
@@ -1164,17 +1164,32 @@ int Gis_polygon::centroid_xy(double *x, double *y) const
while (--n_points) // One point is already read
{
double tmp_x, tmp_y;
+ double loc_area;
get_point(&tmp_x, &tmp_y, data);
data+= POINT_DATA_SIZE;
- cur_area+= (prev_x + tmp_x) * (prev_y - tmp_y);
+ loc_area= prev_x * tmp_y - tmp_x * prev_y;
+ cur_area+= loc_area;
cur_cx+= tmp_x;
cur_cy+= tmp_y;
+ sum_cx+= (prev_x + tmp_x) * loc_area;
+ sum_cy+= (prev_y + tmp_y) * loc_area;
+
prev_x= tmp_x;
prev_y= tmp_y;
}
- cur_area= fabs(cur_area) / 2;
- cur_cx= cur_cx / (org_n_points - 1);
- cur_cy= cur_cy / (org_n_points - 1);
+
+ if (fabs(cur_area) > 1e-10)
+ {
+ cur_cx= sum_cx / cur_area / 3.0;
+ cur_cy= sum_cy / cur_area / 3.0;
+ }
+ else
+ {
+ cur_cx= cur_cx / (org_n_points - 1);
+ cur_cy= cur_cy / (org_n_points - 1);
+ }
+
+ cur_area= fabs(cur_area);
if (!first_loop)
{
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 63663cdd037..4df257b96a4 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -691,12 +691,6 @@ extern "C"
@param buffer pointer to preferred result buffer
@param length length of buffer
@param max_query_len how many chars of query to copy (0 for all)
-
- @req LOCK_thread_count
-
- @note LOCK_thread_count mutex is not necessary when the function is invoked on
- the currently running thread (current_thd) or if the caller in some other
- way guarantees that access to thd->query is serialized.
@return Pointer to string
*/
@@ -710,6 +704,9 @@ char *thd_get_error_context_description(THD *thd, char *buffer,
const Security_context *sctx= &thd->main_security_ctx;
char header[256];
int len;
+
+ mysql_mutex_lock(&LOCK_thread_count);
+
/*
The pointers thd->query and thd->proc_info might change since they are
being modified concurrently. This is acceptable for proc_info since its
@@ -765,6 +762,7 @@ char *thd_get_error_context_description(THD *thd, char *buffer,
}
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
+ mysql_mutex_unlock(&LOCK_thread_count);
if (str.c_ptr_safe() == buffer)
return buffer;
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index d9457ba6624..d8386666de4 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -537,6 +537,8 @@ bool mysql_derived_merge_for_insert(THD *thd, LEX *lex, TABLE_LIST *derived)
DBUG_ASSERT(derived->table);
}
}
+ else
+ derived->table= derived->merge_underlying_list->table;
DBUG_RETURN(FALSE);
}
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 25bc29de401..1ba9de297d4 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2010, 2016, MariaDB
+ Copyright (c) 2010, 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
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index a1da14d5c53..65a2382f0d0 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1184,18 +1184,14 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
if (lex->sql_command == SQLCOM_UPDATE_MULTI)
DBUG_RETURN(FALSE);
- const my_bool create_temp_tables=
- (lex->sql_command == SQLCOM_CREATE_TABLE) && lex->tmp_table();
-
- const my_bool drop_temp_tables=
- (lex->sql_command == SQLCOM_DROP_TABLE) && lex->tmp_table();
-
- const my_bool update_real_tables=
- some_non_temp_table_to_be_updated(thd, all_tables) &&
- !(create_temp_tables || drop_temp_tables);
-
+ /*
+ a table-to-be-created is not in the temp table list yet,
+ so CREATE TABLE needs a special treatment
+ */
+ const bool update_real_tables= lex->sql_command == SQLCOM_CREATE_TABLE ?
+ !lex->tmp_table() : some_non_temp_table_to_be_updated(thd, all_tables);
- const my_bool create_or_drop_databases=
+ const bool create_or_drop_databases=
(lex->sql_command == SQLCOM_CREATE_DB) ||
(lex->sql_command == SQLCOM_DROP_DB);
@@ -1723,9 +1719,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
kill_zombie_dump_threads(slave_server_id);
thd->variables.server_id = slave_server_id;
- general_log_print(thd, command, "Log: '%s' Pos: %ld", packet+10,
- (long) pos);
- mysql_binlog_send(thd, thd->strdup(packet + 10), (my_off_t) pos, flags);
+ const char *name= packet + 10;
+ size_t nlen= strlen(name);
+
+ general_log_print(thd, command, "Log: '%s' Pos: %lu", name, pos);
+ if (nlen < FN_REFLEN)
+ mysql_binlog_send(thd, thd->strmake(name, nlen), (my_off_t)pos, flags);
unregister_slave(thd,1,1);
/* fake COM_QUIT -- if we get here, the thread needs to terminate */
error = TRUE;
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 09248486bec..764047e4720 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2014, SkySQL Ab.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2008, 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
@@ -3348,6 +3348,7 @@ int reset_slave(THD *thd, Master_info* mi)
// close master_info_file, relay_log_info_file, set mi->inited=rli->inited=0
end_master_info(mi);
+ end_relay_log_info(&mi->rli);
// and delete these two files
create_logfile_name_with_suffix(master_info_file_tmp,
sizeof(master_info_file_tmp),
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 7ca0a9bb867..9d825f55fcb 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2010, 2014, SkySQL Ab.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2017, 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
@@ -484,6 +484,19 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
Item *item_tmp;
while ((item_tmp= it++))
{
+ /*
+ If the outer query has a GROUP BY clause, an outer reference to this
+ query block may have been wrapped in a Item_outer_ref, which has not
+ been fixed yet. An Item_type_holder must be created based on a fixed
+ Item, so use the inner Item instead.
+ */
+ DBUG_ASSERT(item_tmp->fixed ||
+ (item_tmp->type() == Item::REF_ITEM &&
+ ((Item_ref *)(item_tmp))->ref_type() ==
+ Item_ref::OUTER_REF));
+ if (!item_tmp->fixed)
+ item_tmp= item_tmp->real_item();
+
/* Error's in 'new' will be detected after loop */
types.push_back(new (thd_arg->mem_root)
Item_type_holder(thd_arg, item_tmp));
@@ -1240,4 +1253,3 @@ void st_select_lex_unit::set_unique_exclude()
}
}
}
-
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 63eb6e0eb90..e88cd035549 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -483,7 +483,7 @@ void put_counter_into_merged_element(void *ptr, uint ofs, element_count cnt)
<> 0 error
*/
-static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size,
+static bool merge_walk(uchar *merge_buffer, size_t merge_buffer_size,
uint key_length, BUFFPEK *begin, BUFFPEK *end,
tree_walk_action walk_action, void *walk_action_arg,
qsort_cmp2 compare, void *compare_arg,
@@ -492,7 +492,7 @@ static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size,
BUFFPEK_COMPARE_CONTEXT compare_context = { compare, compare_arg };
QUEUE queue;
if (end <= begin ||
- merge_buffer_size < (ulong) (key_length * (end - begin + 1)) ||
+ merge_buffer_size < (size_t) (key_length * (end - begin + 1)) ||
init_queue(&queue, (uint) (end - begin), offsetof(BUFFPEK, key), 0,
buffpek_compare, &compare_context, 0, 0))
return 1;
@@ -642,15 +642,19 @@ bool Unique::walk(TABLE *table, tree_walk_action action, void *walk_action_arg)
return 1;
if (flush_io_cache(&file) || reinit_io_cache(&file, READ_CACHE, 0L, 0, 0))
return 1;
- size_t buff_sz= (max_in_memory_size / full_size + 1) * full_size;
+ /*
+ merge_buffer must fit at least MERGEBUFF2 keys, because
+ merge_index() can merge that many BUFFPEKs at once.
+ */
+ size_t buff_sz= MY_MAX(MERGEBUFF2, max_in_memory_size/full_size+1) * full_size;
if (!(merge_buffer = (uchar *)my_malloc(buff_sz, MYF(MY_THREAD_SPECIFIC|MY_WME))))
return 1;
if (buff_sz < full_size * (file_ptrs.elements + 1UL))
res= merge(table, merge_buffer, buff_sz >= full_size * MERGEBUFF2) ;
-
+
if (!res)
- {
- res= merge_walk(merge_buffer, (ulong) max_in_memory_size, full_size,
+ {
+ res= merge_walk(merge_buffer, buff_sz, full_size,
(BUFFPEK *) file_ptrs.buffer,
(BUFFPEK *) file_ptrs.buffer + file_ptrs.elements,
action, walk_action_arg,
diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp
index 6e0da312ca3..4868925f3c2 100644
--- a/storage/connect/array.cpp
+++ b/storage/connect/array.cpp
@@ -520,7 +520,7 @@ bool ARRAY::FilTest(PGLOBAL g, PVAL valp, OPVAL opc, int opm)
} else if (opc != OP_EXIST) {
sprintf(g->Message, MSG(MISSING_ARG), opc);
- throw TYPE_ARRAY;
+ throw (int)TYPE_ARRAY;
} else // OP_EXIST
return Nval > 0;
@@ -683,14 +683,14 @@ void ARRAY::SetPrecision(PGLOBAL g, int p)
{
if (Vblp == NULL) {
strcpy(g->Message, MSG(PREC_VBLP_NULL));
- throw TYPE_ARRAY;
+ throw (int)TYPE_ARRAY;
} // endif Vblp
bool was = Vblp->IsCi();
if (was && !p) {
strcpy(g->Message, MSG(BAD_SET_CASE));
- throw TYPE_ARRAY;
+ throw (int)TYPE_ARRAY;
} // endif Vblp
if (was || !p)
@@ -701,7 +701,7 @@ void ARRAY::SetPrecision(PGLOBAL g, int p)
if (!was && Type == TYPE_STRING)
// Must be resorted to eliminate duplicate strings
if (Sort(g))
- throw TYPE_ARRAY;
+ throw (int)TYPE_ARRAY;
} // end of SetPrecision
@@ -1035,7 +1035,7 @@ void ARRAY::Printf(PGLOBAL g, FILE *f, uint n)
} else
fprintf(f, "%sVALLST: numval=%d\n", m, Nval);
- } // end of Print
+ } // end of Printf
/***********************************************************************/
/* Make string output of ARRAY contents. */
@@ -1047,7 +1047,7 @@ void ARRAY::Prints(PGLOBAL, char *ps, uint z)
sprintf(ps, "ARRAY: type=%d\n", Type);
// More to be implemented later
- } // end of Print
+ } // end of Prints
/* -------------------------- Class MULAR ---------------------------- */
diff --git a/storage/connect/blkfil.cpp b/storage/connect/blkfil.cpp
index 77a46260934..802095f2f82 100644
--- a/storage/connect/blkfil.cpp
+++ b/storage/connect/blkfil.cpp
@@ -65,7 +65,7 @@ void BLOCKFILTER::Printf(PGLOBAL, FILE *f, uint n)
fprintf(f, "%sBLOCKFILTER: at %p opc=%d opm=%d result=%d\n",
m, this, Opc, Opm, Result);
- } // end of Print
+ } // end of Printf
/***********************************************************************/
/* Make string output of BLOCKFILTER contents. */
@@ -73,7 +73,7 @@ void BLOCKFILTER::Printf(PGLOBAL, FILE *f, uint n)
void BLOCKFILTER::Prints(PGLOBAL, char *ps, uint z)
{
strncat(ps, "BlockFilter(s)", z);
- } // end of Print
+ } // end of Prints
/* ---------------------- Class BLKFILLOG ---------------------------- */
@@ -1006,9 +1006,9 @@ void BLOCKINDEX::Printf(PGLOBAL g, FILE *f, UINT n)
m, this, Next, (Colp) ? Colp->GetName() : "Rowid", Kxp, Result);
if (Next)
- Next->Print(g, f, n);
+ Next->Printf(g, f, n);
- } // end of Print
+ } // end of Printf
/***********************************************************************/
/* Make string output of BLOCKINDEX contents. */
@@ -1016,7 +1016,7 @@ void BLOCKINDEX::Printf(PGLOBAL g, FILE *f, UINT n)
void BLOCKINDEX::Prints(PGLOBAL g, char *ps, UINT z)
{
strncat(ps, "BlockIndex(es)", z);
- } // end of Print
+ } // end of Prints
/* ------------------------------------------------------------------- */
diff --git a/storage/connect/colblk.cpp b/storage/connect/colblk.cpp
index 324d59ab40e..2ffe51d2009 100644
--- a/storage/connect/colblk.cpp
+++ b/storage/connect/colblk.cpp
@@ -197,7 +197,7 @@ int COLBLK::GetLengthEx(void)
void COLBLK::ReadColumn(PGLOBAL g)
{
sprintf(g->Message, MSG(UNDEFINED_AM), "ReadColumn");
- throw TYPE_COLBLK;
+ throw (int)TYPE_COLBLK;
} // end of ReadColumn
/***********************************************************************/
@@ -208,7 +208,7 @@ void COLBLK::ReadColumn(PGLOBAL g)
void COLBLK::WriteColumn(PGLOBAL g)
{
sprintf(g->Message, MSG(UNDEFINED_AM), "WriteColumn");
- throw TYPE_COLBLK;
+ throw (int)TYPE_COLBLK;
} // end of WriteColumn
/***********************************************************************/
@@ -232,7 +232,7 @@ void COLBLK::Printf(PGLOBAL, FILE *f, uint n)
fprintf(f,
" coluse=%04X status=%04X buftyp=%d value=%p name=%s\n",
ColUse, Status, Buf_Type, Value, Name);
- } // end of Print
+ } // end of Printf
/***********************************************************************/
/* Make string output of a column descriptor block. */
@@ -240,7 +240,7 @@ void COLBLK::Printf(PGLOBAL, FILE *f, uint n)
void COLBLK::Prints(PGLOBAL, char *ps, uint)
{
sprintf(ps, "R%d.%s", To_Tdb->GetTdb_No(), Name);
- } // end of Print
+ } // end of Prints
/***********************************************************************/
@@ -262,7 +262,7 @@ SPCBLK::SPCBLK(PCOLUMN cp)
void SPCBLK::WriteColumn(PGLOBAL g)
{
sprintf(g->Message, MSG(SPCOL_READONLY), Name);
- throw TYPE_COLBLK;
+ throw (int)TYPE_COLBLK;
} // end of WriteColumn
/***********************************************************************/
diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc
index e15cc724b85..c5a29fe7416 100644
--- a/storage/connect/connect.cc
+++ b/storage/connect/connect.cc
@@ -1,4 +1,5 @@
/* Copyright (C) Olivier Bertrand 2004 - 2017
+ Copyright (C) MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -66,8 +67,10 @@ PGLOBAL CntExit(PGLOBAL g)
if (g) {
CntEndDB(g);
- if (g->Activityp)
- delete g->Activityp;
+ if (g->Activityp) {
+ delete g->Activityp;
+ g->Activityp = NULL;
+ } // endif Activityp
PlugExit(g);
g= NULL;
@@ -185,10 +188,10 @@ bool CntInfo(PGLOBAL g, PTDB tp, PXF info)
/***********************************************************************/
PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
{
- PTDB tdbp;
+ PTDB tdbp = NULL;
PTABLE tabp;
PDBUSER dup = PlgGetUser(g);
- volatile PCATLG cat = (dup) ? dup->Catalog : NULL; // Safe over longjmp
+ volatile PCATLG cat = (dup) ? dup->Catalog : NULL; // Safe over throw
if (trace)
printf("CntGetTDB: name=%s mode=%d cat=%p\n", name, mode, cat);
diff --git a/storage/connect/connect.h b/storage/connect/connect.h
index 128561b80f3..2bca8bf54cb 100644
--- a/storage/connect/connect.h
+++ b/storage/connect/connect.h
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2011
+/* Copyright (C) MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,6 +15,7 @@
/**************** Cnt H Declares Source Code File (.H) *****************/
/* Name: CONNECT.H Version 2.4 */
+/* Author Olivier BERTRAND bertrandop@gmail.com */
/* This file contains the some based classes declares. */
/***********************************************************************/
#include "filamtxt.h"
diff --git a/storage/connect/engmsg.h b/storage/connect/engmsg.h
index 14808758efd..c072511065e 100644
--- a/storage/connect/engmsg.h
+++ b/storage/connect/engmsg.h
@@ -1,3 +1,4 @@
+/* Copyright (C) MariaDB Corporation Ab */
#define MSG_ACCESS_VIOLATN "Access violation"
#define MSG_ADD_BAD_TYPE "Array add value type mismatch (%s -> %s)"
#define MSG_ALLOC_ERROR "Error allocating %s"
diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp
index da44b129ccb..d592dc27cf3 100644
--- a/storage/connect/filter.cpp
+++ b/storage/connect/filter.cpp
@@ -87,7 +87,7 @@ BYTE OpBmp(PGLOBAL g, OPVAL opc)
case OP_EXIST: bt = 0x00; break;
default:
sprintf(g->Message, MSG(BAD_FILTER_OP), opc);
- throw TYPE_ARRAY;
+ throw (int)TYPE_FILTER;
} // endswitch opc
return bt;
@@ -1437,7 +1437,7 @@ void FILTER::Printf(PGLOBAL g, FILE *f, uint n)
} // endfor fp
- } // end of Print
+ } // end of Printf
/***********************************************************************/
/* Make string output of TABLE contents (z should be checked). */
@@ -1579,7 +1579,7 @@ void FILTER::Prints(PGLOBAL g, char *ps, uint z)
bcp = bxp;
} while (bcp); // enddo
- } // end of Print
+ } // end of Prints
/* -------------------- Derived Classes Functions -------------------- */
@@ -1697,8 +1697,6 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
if (trace)
htrc("PrepareFilter: fp=%p having=%d\n", fp, having);
-//if (fp)
-// fp->Print(g, debug, 0);
while (fp) {
if (fp->Opc == OP_SEP)
@@ -1712,7 +1710,7 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
break; // Remove eventual ending separator(s)
// if (fp->Convert(g, having))
-// throw TYPE_ARRAY;
+// throw (int)TYPE_FILTER;
filp = fp;
fp = fp->Next;
@@ -1721,8 +1719,6 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
if (trace)
htrc(" returning filp=%p\n", filp);
-//if (filp)
-// filp->Print(g, debug, 0);
return filp;
} // end of PrepareFilter
@@ -1745,7 +1741,7 @@ DllExport bool ApplyFilter(PGLOBAL g, PFIL filp)
// return TRUE;
if (filp->Eval(g))
- throw TYPE_FILTER;
+ throw (int)TYPE_FILTER;
if (trace > 1)
htrc("PlugFilter filp=%p result=%d\n",
diff --git a/storage/connect/global.h b/storage/connect/global.h
index a2030fdb5d0..cb756494efc 100644
--- a/storage/connect/global.h
+++ b/storage/connect/global.h
@@ -1,6 +1,7 @@
/***********************************************************************/
/* GLOBAL.H: Declaration file used by all CONNECT implementations. */
-/* (C) Copyright Olivier Bertrand 1993-2017 */
+/* (C) Copyright MariaDB Corporation Ab */
+/* Author Olivier Bertrand 1993-2017 */
/***********************************************************************/
/***********************************************************************/
@@ -90,6 +91,7 @@
#define TYPE_BIGINT 5
#define TYPE_LIST 6
#define TYPE_INT 7
+#define TYPE_DATE 8
#define TYPE_DECIM 9
#define TYPE_BIN 10
#define TYPE_PCHAR 11
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index e525447fa03..d6e37700e4f 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2017
+/* Copyright (C) MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -98,9 +98,8 @@
rnd_next signals that it has reached the end of its data. Calls to
ha_connect::extra() are hints as to what will be occuring to the request.
- Happy use!<br>
- -Olivier
-*/
+ Author Olivier Bertrand
+ */
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
@@ -198,11 +197,13 @@ extern "C" {
char *ClassPath;
#endif // JDBC_SUPPORT
-#if defined(__WIN__)
-CRITICAL_SECTION parsec; // Used calling the Flex parser
-#else // !__WIN__
-pthread_mutex_t parmut = PTHREAD_MUTEX_INITIALIZER;
-#endif // !__WIN__
+//#if defined(__WIN__)
+//CRITICAL_SECTION parsec; // Used calling the Flex parser
+//#else // !__WIN__
+//pthread_mutex_t parmut = PTHREAD_MUTEX_INITIALIZER;
+//#endif // !__WIN__
+pthread_mutex_t parmut;
+pthread_mutex_t usrmut;
/***********************************************************************/
/* Utility functions. */
@@ -221,6 +222,7 @@ void mongo_init(bool);
USETEMP UseTemp(void);
int GetConvSize(void);
TYPCONV GetTypeConv(void);
+char *GetJsonNull(void);
uint GetJsonGrpSize(void);
char *GetJavaWrapper(void);
uint GetWorkSize(void);
@@ -330,6 +332,13 @@ static MYSQL_THDVAR_ENUM(
0, // def (no)
&xconv_typelib); // typelib
+// Null representation for JSON values
+static MYSQL_THDVAR_STR(json_null,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
+ "Representation of Json null values",
+ // check_json_null, update_json_null,
+ NULL, NULL, "<null>");
+
// Estimate max number of rows for JSON aggregate functions
static MYSQL_THDVAR_UINT(json_grp_size,
PLUGIN_VAR_RQCMDARG, // opt
@@ -381,6 +390,8 @@ bool ExactInfo(void) {return THDVAR(current_thd, exact_info);}
USETEMP UseTemp(void) {return (USETEMP)THDVAR(current_thd, use_tempfile);}
int GetConvSize(void) {return THDVAR(current_thd, conv_size);}
TYPCONV GetTypeConv(void) {return (TYPCONV)THDVAR(current_thd, type_conv);}
+char *GetJsonNull(void)
+ {return connect_hton ? THDVAR(current_thd, json_null) : NULL;}
uint GetJsonGrpSize(void)
{return connect_hton ? THDVAR(current_thd, json_grp_size) : 10;}
uint GetWorkSize(void) {return THDVAR(current_thd, work_size);}
@@ -666,10 +677,12 @@ static int connect_init_func(void *p)
#if defined(__WIN__)
sql_print_information("CONNECT: %s", compver);
- InitializeCriticalSection((LPCRITICAL_SECTION)&parsec);
+//InitializeCriticalSection((LPCRITICAL_SECTION)&parsec);
#else // !__WIN__
sql_print_information("CONNECT: %s", version);
#endif // !__WIN__
+ pthread_mutex_init(&parmut, NULL);
+ pthread_mutex_init(&usrmut, NULL);
#if defined(LIBXML2_SUPPORT)
XmlInitParserLib();
@@ -718,12 +731,13 @@ static int connect_done_func(void *)
#endif // JDBC_SUPPORT
#if defined(__WIN__)
- DeleteCriticalSection((LPCRITICAL_SECTION)&parsec);
+//DeleteCriticalSection((LPCRITICAL_SECTION)&parsec);
#else // !__WIN__
PROFILE_End();
#endif // !__WIN__
- for (pc= user_connect::to_users; pc; pc= pn) {
+ pthread_mutex_lock(&usrmut);
+ for (pc= user_connect::to_users; pc; pc= pn) {
if (pc->g)
PlugCleanup(pc->g, true);
@@ -731,6 +745,10 @@ static int connect_done_func(void *)
delete pc;
} // endfor pc
+ pthread_mutex_unlock(&usrmut);
+
+ pthread_mutex_destroy(&usrmut);
+ pthread_mutex_destroy(&parmut);
connect_hton= NULL;
DBUG_RETURN(error);
} // end of connect_done_func
@@ -843,6 +861,7 @@ ha_connect::~ha_connect(void)
static void PopUser(PCONNECT xp)
{
if (xp) {
+ pthread_mutex_lock(&usrmut);
xp->count--;
if (!xp->count) {
@@ -867,6 +886,7 @@ static void PopUser(PCONNECT xp)
delete xp;
} // endif count
+ pthread_mutex_unlock(&usrmut);
} // endif xp
} // end of PopUser
@@ -880,23 +900,33 @@ static PCONNECT GetUser(THD *thd, PCONNECT xp)
if (!thd)
return NULL;
- if (xp && thd == xp->thdp)
- return xp;
+ if (xp) {
+ if (thd == xp->thdp)
+ return xp;
- for (xp= user_connect::to_users; xp; xp= xp->next)
+ PopUser(xp); // Avoid memory leak
+ } // endif xp
+
+ pthread_mutex_lock(&usrmut);
+
+ for (xp= user_connect::to_users; xp; xp= xp->next)
if (thd == xp->thdp)
break;
- if (!xp) {
+ if (xp)
+ xp->count++;
+
+ pthread_mutex_unlock(&usrmut);
+
+ if (!xp) {
xp= new user_connect(thd);
if (xp->user_init()) {
delete xp;
xp= NULL;
- } // endif user_init
+ } // endif user_init
- } else
- xp->count++;
+ } // endif xp
return xp;
} // end of GetUser
@@ -1024,37 +1054,55 @@ PCSZ GetListOption(PGLOBAL g, PCSZ opname, PCSZ oplist, PCSZ def)
if (!oplist)
return (char*)def;
- char key[16], val[256];
- char *pk, *pv, *pn;
- PCSZ opval= def;
- int n;
-
- for (pk= (char*)oplist; pk; pk= ++pn) {
- pn= strchr(pk, ',');
- pv= strchr(pk, '=');
-
- if (pv && (!pn || pv < pn)) {
- n= MY_MIN(static_cast<size_t>(pv - pk), sizeof(key) - 1);
- memcpy(key, pk, n);
- key[n]= 0;
- pv++;
- n= MY_MIN((pn ? pn - pv : strlen(pv)), sizeof(val) - 1);
- memcpy(val, pv, n);
- val[n]= 0;
- } else {
- n= MY_MIN((pn ? pn - pk : strlen(pk)), sizeof(key) - 1);
- memcpy(key, pk, n);
- key[n]= 0;
- val[0]= 0;
- } // endif pv
-
- if (!stricmp(opname, key)) {
- opval= PlugDup(g, val);
- break;
- } else if (!pn)
- break;
+ char key[16], val[256];
+ char *pv, *pn, *pk = (char*)oplist;
+ PCSZ opval = def;
+ int n;
- } // endfor pk
+ while (*pk == ' ')
+ pk++;
+
+ for (; pk; pk = pn) {
+ pn = strchr(pk, ',');
+ pv = strchr(pk, '=');
+
+ if (pv && (!pn || pv < pn)) {
+ n = MY_MIN(static_cast<size_t>(pv - pk), sizeof(key) - 1);
+ memcpy(key, pk, n);
+
+ while (n && key[n - 1] == ' ')
+ n--;
+
+ key[n] = 0;
+
+ while (*(++pv) == ' ');
+
+ n = MY_MIN((pn ? pn - pv : strlen(pv)), sizeof(val) - 1);
+ memcpy(val, pv, n);
+
+ while (n && val[n - 1] == ' ')
+ n--;
+
+ val[n] = 0;
+ } else {
+ n = MY_MIN((pn ? pn - pk : strlen(pk)), sizeof(key) - 1);
+ memcpy(key, pk, n);
+
+ while (n && key[n - 1] == ' ')
+ n--;
+
+ key[n] = 0;
+ val[0] = 0;
+ } // endif pv
+
+ if (!stricmp(opname, key)) {
+ opval = PlugDup(g, val);
+ break;
+ } else if (!pn)
+ break;
+
+ while (*(++pn) == ' ');
+ } // endfor pk
return opval;
} // end of GetListOption
@@ -1427,7 +1475,7 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
pcf->Flags |= U_VAR;
- /* fall through */
+ // fall through
default:
pcf->Type= MYSQLtoPLG(fp->type(), &v);
break;
@@ -2802,7 +2850,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
case Item_func::LIKE_FUNC: vop= OP_LIKE; break;
case Item_func::ISNOTNULL_FUNC:
neg = true;
- /* fall through */
+ // fall through
case Item_func::ISNULL_FUNC: vop= OP_NULL; break;
case Item_func::IN_FUNC: vop= OP_IN;
case Item_func::BETWEEN:
@@ -4052,7 +4100,12 @@ int ha_connect::info(uint flag)
DBUG_ENTER("ha_connect::info");
- if (trace)
+ if (!g) {
+ my_message(ER_UNKNOWN_ERROR, "Cannot get g pointer", MYF(0));
+ DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
+ } // endif g
+
+ if (trace)
htrc("%p In info: flag=%u valid_info=%d\n", this, flag, valid_info);
// tdbp must be available to get updated info
@@ -4063,7 +4116,7 @@ int ha_connect::info(uint flag)
if (xmod == MODE_ANY || xmod == MODE_ALTER) {
// Pure info, not a query
pure= true;
- xp->CheckCleanup();
+ xp->CheckCleanup(xmod == MODE_ANY && valid_query_id == 0);
} // endif xmod
// This is necessary for getting file length
@@ -4247,8 +4300,8 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick)
} else
return false;
- /* check FILE_ACL */
- /* fall through */
+ // check FILE_ACL
+ // fall through
case TAB_ODBC:
case TAB_JDBC:
case TAB_MYSQL:
@@ -7060,7 +7113,8 @@ static struct st_mysql_sys_var* connect_system_variables[]= {
#if defined(XMSG)
MYSQL_SYSVAR(errmsg_dir_path),
#endif // XMSG
- MYSQL_SYSVAR(json_grp_size),
+ MYSQL_SYSVAR(json_null),
+ MYSQL_SYSVAR(json_grp_size),
#if defined(JDBC_SUPPORT)
MYSQL_SYSVAR(jvm_path),
MYSQL_SYSVAR(class_path),
diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h
index 8d8307b4bd1..9d71aaa5433 100644
--- a/storage/connect/ha_connect.h
+++ b/storage/connect/ha_connect.h
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2015
+/* Copyright (C) MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,6 +14,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
/** @file ha_connect.h
+ Author Olivier Bertrand
@brief
The ha_connect engine is a prototype storage engine to access external data.
diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp
index f162a7ae645..811f998b55f 100644
--- a/storage/connect/jdbconn.cpp
+++ b/storage/connect/jdbconn.cpp
@@ -120,66 +120,81 @@ int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v)
int type;
switch (stp) {
- case -1: // LONGVARCHAR
- if (GetTypeConv() != TPC_YES)
- return TYPE_ERROR;
- else
- len = MY_MIN(abs(len), GetConvSize());
- case 12: // VARCHAR
- v = 'V';
- case 1: // CHAR
- type = TYPE_STRING;
- break;
- case 2: // NUMERIC
- case 3: // DECIMAL
- case -3: // VARBINARY
- type = TYPE_DECIM;
- break;
- case 4: // INTEGER
- type = TYPE_INT;
- break;
- case 5: // SMALLINT
- type = TYPE_SHORT;
- break;
- case -6: // TINYINT
- case -7: // BIT
- type = TYPE_TINY;
- break;
- case 6: // FLOAT
- case 7: // REAL
- case 8: // DOUBLE
- type = TYPE_DOUBLE;
- break;
- case 93: // TIMESTAMP, DATETIME
- type = TYPE_DATE;
- len = 19 + ((prec) ? (prec+1) : 0);
- v = (tn && toupper(tn[0]) == 'T') ? 'S' : 'E';
- break;
- case 91: // DATE, YEAR
- type = TYPE_DATE;
+ case -1: // LONGVARCHAR
+ case -16: // LONGNVARCHAR (unicode)
+ if (GetTypeConv() != TPC_YES)
+ return TYPE_ERROR;
+ else
+ len = MY_MIN(abs(len), GetConvSize());
+ case 12: // VARCHAR
+ case -9: // NVARCHAR (unicode)
+ v = 'V';
+ case 1: // CHAR
+ case -15: // NCHAR (unicode)
+ case -8: // ROWID
+ type = TYPE_STRING;
+ break;
+ case 2: // NUMERIC
+ case 3: // DECIMAL
+ case -3: // VARBINARY
+ type = TYPE_DECIM;
+ break;
+ case 4: // INTEGER
+ type = TYPE_INT;
+ break;
+ case 5: // SMALLINT
+ type = TYPE_SHORT;
+ break;
+ case -6: // TINYINT
+ case -7: // BIT
+ case 16: // BOOLEAN
+ type = TYPE_TINY;
+ break;
+ case 6: // FLOAT
+ case 7: // REAL
+ case 8: // DOUBLE
+ type = TYPE_DOUBLE;
+ break;
+ case 93: // TIMESTAMP, DATETIME
+ type = TYPE_DATE;
+ len = 19 + ((prec) ? (prec + 1) : 0);
+ v = (tn && toupper(tn[0]) == 'T') ? 'S' : 'E';
+ break;
+ case 91: // DATE, YEAR
+ type = TYPE_DATE;
- if (!tn || toupper(tn[0]) != 'Y') {
- len = 10;
- v = 'D';
- } else {
- len = 4;
- v = 'Y';
- } // endif len
+ if (!tn || toupper(tn[0]) != 'Y') {
+ len = 10;
+ v = 'D';
+ } else {
+ len = 4;
+ v = 'Y';
+ } // endif len
- break;
- case 92: // TIME
- type = TYPE_DATE;
- len = 8 + ((prec) ? (prec+1) : 0);
- v = 'T';
- break;
- case -5: // BIGINT
- type = TYPE_BIGINT;
- break;
- case 0: // NULL
- case -2: // BINARY
- case -4: // LONGVARBINARY
- default:
- type = TYPE_ERROR;
+ break;
+ case 92: // TIME
+ type = TYPE_DATE;
+ len = 8 + ((prec) ? (prec + 1) : 0);
+ v = 'T';
+ break;
+ case -5: // BIGINT
+ type = TYPE_BIGINT;
+ break;
+ case 0: // NULL
+ case -2: // BINARY
+ case -4: // LONGVARBINARY
+ case 70: // DATALINK
+ case 2000: // JAVA_OBJECT
+ case 2001: // DISTINCT
+ case 2002: // STRUCT
+ case 2003: // ARRAY
+ case 2004: // BLOB
+ case 2005: // CLOB
+ case 2006: // REF
+ case 2009: // SQLXML
+ case 2011: // NCLOB
+ default:
+ type = TYPE_ERROR;
len = 0;
} // endswitch type
@@ -1200,7 +1215,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
if (rank == 0)
if (!name || (jn = env->NewStringUTF(name)) == nullptr) {
sprintf(g->Message, "Fail to allocate jstring %s", SVP(name));
- throw TYPE_AM_JDBC;
+ throw (int)TYPE_AM_JDBC;
} // endif name
// Returns 666 is case of error
@@ -1208,7 +1223,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
if (Check((ctyp == 666) ? -1 : 1)) {
sprintf(g->Message, "Getting ctyp: %s", Msg);
- throw TYPE_AM_JDBC;
+ throw (int)TYPE_AM_JDBC;
} // endif Check
if (val->GetNullable())
@@ -1225,9 +1240,12 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
switch (ctyp) {
case 12: // VARCHAR
+ case -9: // NVARCHAR
case -1: // LONGVARCHAR
case 1: // CHAR
- case 3: // DECIMAL
+ case -15: // NCHAR
+ case 3: // DECIMAL
+ case -8: // ROWID
if (jb && ctyp != 3)
cn = (jstring)jb;
else if (!gmID(g, chrfldid, "StringField", "(ILjava/lang/String;)Ljava/lang/String;"))
@@ -1245,6 +1263,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
case 4: // INTEGER
case 5: // SMALLINT
case -6: // TINYINT
+ case 16: // BOOLEAN
case -7: // BIT
if (!gmID(g, intfldid, "IntField", "(ILjava/lang/String;)I"))
val->SetValue((int)env->CallIntMethod(job, intfldid, rank, jn));
@@ -1315,7 +1334,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
env->DeleteLocalRef(jn);
sprintf(g->Message, "SetColumnValue: %s rank=%d ctyp=%d", Msg, rank, (int)ctyp);
- throw TYPE_AM_JDBC;
+ throw (int)TYPE_AM_JDBC;
} // endif Check
if (rank == 0)
diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp
index f8b1caa13e2..da94d4e227c 100644
--- a/storage/connect/json.cpp
+++ b/storage/connect/json.cpp
@@ -1,5 +1,5 @@
/*************** json CPP Declares Source Code File (.H) ***************/
-/* Name: json.cpp Version 1.3 */
+/* Name: json.cpp Version 1.4 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2017 */
/* */
@@ -53,6 +53,38 @@ void trans_func(unsigned int u, _EXCEPTION_POINTERS* pExp)
char *GetExceptionDesc(PGLOBAL g, unsigned int e);
#endif // SE_CATCH
+char *GetJsonNull(void);
+
+/***********************************************************************/
+/* IsNum: check whether this string is all digits. */
+/***********************************************************************/
+bool IsNum(PSZ s)
+{
+ for (char *p = s; *p; p++)
+ if (*p == ']')
+ break;
+ else if (!isdigit(*p) || *p == '-')
+ return false;
+
+ return true;
+} // end of IsNum
+
+/***********************************************************************/
+/* NextChr: return the first found '[' or Sep pointer. */
+/***********************************************************************/
+char *NextChr(PSZ s, char sep)
+{
+ char *p1 = strchr(s, '[');
+ char *p2 = strchr(s, sep);
+
+ if (!p2)
+ return p1;
+ else if (p1)
+ return MY_MIN(p1, p2);
+
+ return p2;
+} // end of NextChr
+
/***********************************************************************/
/* Parse a json string. */
@@ -934,6 +966,25 @@ return false;
/* -------------------------- Class JOBJECT -------------------------- */
/***********************************************************************/
+/* Return the number of pairs in this object. */
+/***********************************************************************/
+int JOBJECT::GetSize(bool b)
+{
+ if (b) {
+ // Return only non null pairs
+ int n = 0;
+
+ for (PJPR jpp = First; jpp; jpp = jpp->Next)
+ if (jpp->Val && !jpp->Val->IsNull())
+ n++;
+
+ return n;
+ } else
+ return Size;
+
+} // end of GetSize
+
+/***********************************************************************/
/* Add a new pair to an Object. */
/***********************************************************************/
PJPR JOBJECT::AddPair(PGLOBAL g, PCSZ key)
@@ -992,14 +1043,31 @@ PSZ JOBJECT::GetText(PGLOBAL g, PSZ text)
if (!First && n)
return NULL;
- else for (PJPR jp = First; jp; jp = jp->Next)
+ else if (n == 1 && Size == 1 && !strcmp(First->GetKey(), "$date")) {
+ int i;
+
+ First->Val->GetText(g, text);
+ i = (text[1] == '-' ? 2 : 1);
+
+ if (IsNum(text + i)) {
+ // Date is in milliseconds
+ int j = (int)strlen(text);
+
+ if (j >= 4 + i)
+ text[j - 3] = 0; // Change it to seconds
+ else
+ strcpy(text, " 0");
+
+ } // endif text
+
+ } else for (PJPR jp = First; jp; jp = jp->Next)
jp->Val->GetText(g, text);
if (n)
PlugSubAlloc(g, NULL, strlen(text) + 1);
return text + n;
-} // end of GetValue;
+} // end of GetText;
/***********************************************************************/
/* Merge two objects. */
@@ -1040,7 +1108,7 @@ void JOBJECT::SetValue(PGLOBAL g, PJVAL jvp, PCSZ key)
} // end of SetValue
/***********************************************************************/
-/* Delete a value corresponding to the given key. */
+/* Delete a value corresponding to the given key. */
/***********************************************************************/
void JOBJECT::DeleteKey(PCSZ key)
{
@@ -1071,6 +1139,25 @@ bool JOBJECT::IsNull(void)
/* -------------------------- Class JARRAY --------------------------- */
/***********************************************************************/
+/* Return the number of values in this object. */
+/***********************************************************************/
+int JARRAY::GetSize(bool b)
+{
+ if (b) {
+ // Return only non null values
+ int n = 0;
+
+ for (PJVAL jvp = First; jvp; jvp = jvp->Next)
+ if (!jvp->IsNull())
+ n++;
+
+ return n;
+ } else
+ return Size;
+
+} // end of GetSize
+
+/***********************************************************************/
/* Make the array of values from the values list. */
/***********************************************************************/
void JARRAY::InitArray(PGLOBAL g)
@@ -1179,17 +1266,41 @@ bool JARRAY::SetValue(PGLOBAL g, PJVAL jvp, int n)
} // end of SetValue
/***********************************************************************/
+/* Return the text corresponding to all values. */
+/***********************************************************************/
+PSZ JARRAY::GetText(PGLOBAL g, PSZ text)
+{
+ int n;
+ PJVAL jp;
+
+ if (!text) {
+ text = (char*)PlugSubAlloc(g, NULL, 0);
+ text[0] = 0;
+ n = 1;
+ } else
+ n = 0;
+
+ for (jp = First; jp; jp = jp->Next)
+ jp->GetText(g, text);
+
+ if (n)
+ PlugSubAlloc(g, NULL, strlen(text) + 1);
+
+ return text + n;
+} // end of GetText;
+
+/***********************************************************************/
/* Delete a Value from the Arrays Value list. */
/***********************************************************************/
bool JARRAY::DeleteValue(int n)
{
- PJVAL jvp = GetValue(n);
+ PJVAL jvp = GetValue(n);
- if (jvp) {
- jvp->Del = true;
- return false;
- } else
- return true;
+ if (jvp) {
+ jvp->Del = true;
+ return false;
+ } else
+ return true;
} // end of DeleteValue
@@ -1239,7 +1350,7 @@ JTYP JVALUE::GetValType(void)
else if (Value)
return (JTYP)Value->GetType();
else
- return (JTYP)TYPE_VOID;
+ return TYPE_NULL;
} // end of GetValType
@@ -1303,7 +1414,7 @@ PSZ JVALUE::GetString(void)
/***********************************************************************/
PSZ JVALUE::GetText(PGLOBAL g, PSZ text)
{
- if (Jsp && Jsp->GetType() == TYPE_JOB)
+ if (Jsp)
return Jsp->GetText(g, text);
char buf[32];
@@ -1311,8 +1422,8 @@ PSZ JVALUE::GetText(PGLOBAL g, PSZ text)
if (s)
strcat(strcat(text, " "), s);
- else
- strcat(text, " ???");
+ else if (GetJsonNull())
+ strcat(strcat(text, " "), GetJsonNull());
return text;
} // end of GetText
diff --git a/storage/connect/json.h b/storage/connect/json.h
index 49675ce8559..daed055435b 100644
--- a/storage/connect/json.h
+++ b/storage/connect/json.h
@@ -1,7 +1,7 @@
/**************** json H Declares Source Code File (.H) ****************/
/* Name: json.h Version 1.2 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */
+/* (C) Copyright to the author Olivier BERTRAND 2014 - 2017 */
/* */
/* This file contains the JSON classes declares. */
/***********************************************************************/
@@ -13,11 +13,13 @@
#define X
#endif
-enum JTYP {TYPE_STRG = 1,
- TYPE_DBL = 2,
- TYPE_BOOL = 4,
- TYPE_BINT = 5,
- TYPE_INTG = 7,
+enum JTYP {TYPE_NULL = TYPE_VOID,
+ TYPE_STRG = TYPE_STRING,
+ TYPE_DBL = TYPE_DOUBLE,
+ TYPE_BOOL = TYPE_TINY,
+ TYPE_BINT = TYPE_BIGINT,
+ TYPE_DTM = TYPE_DATE,
+ TYPE_INTG = TYPE_INT,
TYPE_JSON = 12,
TYPE_JAR,
TYPE_JOB,
@@ -145,6 +147,7 @@ class JSON : public BLOCK {
JSON(void) {Size = 0;}
int size(void) {return Size;}
+ virtual int GetSize(bool b) {return Size;}
virtual void Clear(void) {Size = 0;}
virtual JTYP GetType(void) {return TYPE_JSON;}
virtual JTYP GetValType(void) {X return TYPE_JSON;}
@@ -192,10 +195,11 @@ class JOBJECT : public JSON {
using JSON::GetValue;
using JSON::SetValue;
- virtual void Clear(void) {First = Last = NULL; Size = 0;}
+ virtual void Clear(void) {First = Last = NULL; Size = 0;}
virtual JTYP GetType(void) {return TYPE_JOB;}
virtual PJPR GetFirst(void) {return First;}
- virtual PJPR AddPair(PGLOBAL g, PCSZ key);
+ virtual int GetSize(bool b);
+ virtual PJPR AddPair(PGLOBAL g, PCSZ key);
virtual PJOB GetObject(void) {return this;}
virtual PJVAL GetValue(const char* key);
virtual PJAR GetKeyList(PGLOBAL g);
@@ -221,11 +225,13 @@ class JARRAY : public JSON {
using JSON::GetValue;
using JSON::SetValue;
virtual void Clear(void) {First = Last = NULL; Size = 0;}
- virtual JTYP GetType(void) {return TYPE_JAR;}
+ virtual JTYP GetType(void) {return TYPE_JAR;}
virtual PJAR GetArray(void) {return this;}
- PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL);
+ virtual int GetSize(bool b);
+ PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL);
virtual void InitArray(PGLOBAL g);
virtual PJVAL GetValue(int i);
+ virtual PSZ GetText(PGLOBAL g, PSZ text);
virtual bool Merge(PGLOBAL g, PJSON jsp);
virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i);
virtual bool DeleteValue(int n);
@@ -245,20 +251,20 @@ class JARRAY : public JSON {
class JVALUE : public JSON {
friend class JARRAY;
friend class JSNX;
+ friend class JSONCOL;
friend PJVAL ParseValue(PGLOBAL, int&, STRG&, bool*);
friend bool SerializeValue(JOUT *, PJVAL);
public:
- JVALUE(void) : JSON()
- {Jsp = NULL; Value = NULL; Next = NULL; Del = false;}
+ JVALUE(void) : JSON() {Clear();}
JVALUE(PJSON jsp) : JSON()
- {Jsp = jsp; Value = NULL; Next = NULL; Del = false;}
- JVALUE(PGLOBAL g, PVAL valp);
+ {Jsp = jsp; Value = NULL; Next = NULL; Del = false; Size = 1;}
+ JVALUE(PGLOBAL g, PVAL valp);
JVALUE(PGLOBAL g, PCSZ strp);
using JSON::GetValue;
using JSON::SetValue;
virtual void Clear(void)
- {Jsp = NULL; Value = NULL; Next = NULL; Del = false; Size = 0;}
+ {Jsp = NULL; Value = NULL; Next = NULL; Del = false; Size = 1;}
virtual JTYP GetType(void) {return TYPE_JVAL;}
virtual JTYP GetValType(void);
virtual PJOB GetObject(void);
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index 4e00703d9ef..23c2b9785bc 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -1,5 +1,5 @@
/****************** jsonudf C++ Program Source Code File (.CPP) ******************/
-/* PROGRAM NAME: jsonudf Version 1.5 */
+/* PROGRAM NAME: jsonudf Version 1.6 */
/* (C) Copyright to the author Olivier BERTRAND 2015-2017 */
/* This program are the JSON User Defined Functions . */
/*********************************************************************************/
@@ -27,7 +27,8 @@
#endif
#define M 7
-uint GetJsonGrpSize(void);
+char *GetJsonNull(void);
+uint GetJsonGrpSize(void);
static int IsJson(UDF_ARGS *args, uint i);
static PSZ MakePSZ(PGLOBAL g, UDF_ARGS *args, int i);
static char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
@@ -327,11 +328,13 @@ void JSNX::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n)
SetJsonValue(g, vp, val->GetArray()->GetValue(0), n);
break;
case TYPE_JOB:
- // if (!vp->IsTypeNum() || !Strict) {
+// if (!vp->IsTypeNum() || !Strict) {
vp->SetValue_psz(val->GetObject()->GetText(g, NULL));
break;
- // } // endif Type
+// } // endif Type
+ case TYPE_NULL:
+ vp->SetNull(true);
default:
vp->Reset();
} // endswitch Type
@@ -459,7 +462,7 @@ PVAL JSNX::ExpandArray(PGLOBAL g, PJAR arp, int n)
/*********************************************************************************/
PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
{
-//int i, ars, nv = 0, nextsame = Tjp->NextSame;
+ //int i, ars, nv = 0, nextsame = Tjp->NextSame;
int i, ars, nv = 0, nextsame = 0;
my_bool err;
OPVAL op = Nodes[n].Op;
@@ -468,15 +471,16 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
JVALUE jval;
vp->Reset();
-//ars = MY_MIN(Tjp->Limit, arp->size());
ars = arp->size();
for (i = 0; i < ars; i++) {
jvrp = arp->GetValue(i);
-// do {
- if (n < Nod - 1 && jvrp->GetJson()) {
-// Tjp->NextSame = nextsame;
+ if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) {
+ if (jvrp->IsNull()) {
+ jvrp->Value = AllocateValue(g, GetJsonNull(), TYPE_STRING);
+ jvp = jvrp;
+ } else if (n < Nod - 1 && jvrp->GetJson()) {
jval.SetValue(GetColumnValue(g, jvrp->GetJson(), n + 1));
jvp = &jval;
} else
@@ -490,25 +494,25 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
if (!MulVal->IsZero()) {
switch (op) {
- case OP_CNC:
- if (Nodes[n].CncVal) {
- val[0] = Nodes[n].CncVal;
- err = vp->Compute(g, val, 1, op);
- } // endif CncVal
+ case OP_CNC:
+ if (Nodes[n].CncVal) {
+ val[0] = Nodes[n].CncVal;
+ err = vp->Compute(g, val, 1, op);
+ } // endif CncVal
- val[0] = MulVal;
- err = vp->Compute(g, val, 1, op);
- break;
- // case OP_NUM:
- case OP_SEP:
- val[0] = Nodes[n].Valp;
- val[1] = MulVal;
- err = vp->Compute(g, val, 2, OP_ADD);
- break;
- default:
- val[0] = Nodes[n].Valp;
- val[1] = MulVal;
- err = vp->Compute(g, val, 2, op);
+ val[0] = MulVal;
+ err = vp->Compute(g, val, 1, op);
+ break;
+ // case OP_NUM:
+ case OP_SEP:
+ val[0] = Nodes[n].Valp;
+ val[1] = MulVal;
+ err = vp->Compute(g, val, 2, OP_ADD);
+ break;
+ default:
+ val[0] = Nodes[n].Valp;
+ val[1] = MulVal;
+ err = vp->Compute(g, val, 2, op);
} // endswitch Op
if (err)
@@ -516,7 +520,7 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
} // endif Zero
-// } while (Tjp->NextSame > nextsame);
+ } // endif jvrp
} // endfor i
@@ -1081,6 +1085,7 @@ inline void JsonMemSave(PGLOBAL g)
/*********************************************************************************/
inline void JsonFreeMem(PGLOBAL g)
{
+ g->Activityp = NULL;
PlugExit(g);
} /* end of JsonFreeMem */
diff --git a/storage/connect/msgid.h b/storage/connect/msgid.h
index 0e9c036dc49..cee78aa1783 100644
--- a/storage/connect/msgid.h
+++ b/storage/connect/msgid.h
@@ -1,3 +1,4 @@
+/* Copyright (C) MariaDB Corporation Ab */
#define MSG_ACCESS_VIOLATN 200
#define MSG_ADD_BAD_TYPE 201
#define MSG_ALLOC_ERROR 202
diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc
index 750cf3c0639..c854ba72bff 100644
--- a/storage/connect/mycat.cc
+++ b/storage/connect/mycat.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2017
+/* Copyright (C) MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/storage/connect/mycat.h b/storage/connect/mycat.h
index b6bdd5e5e11..c0f70522b69 100644
--- a/storage/connect/mycat.h
+++ b/storage/connect/mycat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2015
+/* Copyright (C) MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@
/**************** MYCAT H Declares Source Code File (.H) ***************/
/* Name: MYCAT.H Version 2.3 */
-/* */
+/* Author: Olivier Bertrand */
/* This file contains the CONNECT plugin MYCAT class definitions. */
/***********************************************************************/
#ifndef __MYCAT__H
diff --git a/storage/connect/mysql-test/connect/r/json_udf.result b/storage/connect/mysql-test/connect/r/json_udf.result
index 1e83834cb8f..27f4f8b5319 100644
--- a/storage/connect/mysql-test/connect/r/json_udf.result
+++ b/storage/connect/mysql-test/connect/r/json_udf.result
@@ -608,7 +608,7 @@ JsonGet_String(Json_File('test/fx.json'), '[1]:*')
{"_id":6,"type":"car","item":"roadster","mileage":56000,"ratings":[6,9]}
SELECT JsonGet_String(Json_File('test/fx.json'), '[1]');
JsonGet_String(Json_File('test/fx.json'), '[1]')
-6 car roadster 56000 ???
+6 car roadster 56000 6 9
SELECT JsonGet_Int(Json_File('test/fx.json'), '[1]:mileage') AS Mileage;
Mileage
56000
diff --git a/storage/connect/os.h b/storage/connect/os.h
index 8056a272990..e2b165fb3f5 100644
--- a/storage/connect/os.h
+++ b/storage/connect/os.h
@@ -1,3 +1,4 @@
+/* Copyright (C) MariaDB Corporation Ab */
#ifndef _OS_H_INCLUDED
#define _OS_H_INCLUDED
diff --git a/storage/connect/osutil.c b/storage/connect/osutil.c
index 66743c7403b..da896fec50e 100644
--- a/storage/connect/osutil.c
+++ b/storage/connect/osutil.c
@@ -1,3 +1,4 @@
+/* Copyright (C) MariaDB Corporation Ab */
#include "my_global.h"
#include <stdlib.h>
#include <string.h>
diff --git a/storage/connect/osutil.h b/storage/connect/osutil.h
index ac63d4ee973..7e6b8823b9b 100644
--- a/storage/connect/osutil.h
+++ b/storage/connect/osutil.h
@@ -1,3 +1,4 @@
+/* Copyright (C) MariaDB Corporation Ab */
#ifndef __OSUTIL_H__
#define __OSUTIL_H__
diff --git a/storage/connect/plgdbsem.h b/storage/connect/plgdbsem.h
index 2198c44c200..5729b5bd6ff 100644
--- a/storage/connect/plgdbsem.h
+++ b/storage/connect/plgdbsem.h
@@ -36,8 +36,6 @@ enum BLKTYP {TYPE_TABLE = 50, /* Table Name/Srcdef/... Block */
TYPE_COLCRT = 71, /* Column creation block */
TYPE_CONST = 72, /* Constant */
-/*-------------------- type tokenized string --------------------------*/
- TYPE_DATE = 8, /* Timestamp */
/*-------------------- additional values used by LNA ------------------*/
TYPE_COLIST = 14, /* Column list */
TYPE_COL = 41, /* Column */
diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp
index b6f59bac8cf..03a326ce89a 100644
--- a/storage/connect/plgdbutl.cpp
+++ b/storage/connect/plgdbutl.cpp
@@ -82,14 +82,10 @@ extern "C" {
extern char version[];
} // extern "C"
-#if defined(__WIN__)
-extern CRITICAL_SECTION parsec; // Used calling the Flex parser
-#else // !__WIN__
extern pthread_mutex_t parmut;
-#endif // !__WIN__
// The debug trace used by the main thread
- FILE *pfile = NULL;
+FILE *pfile = NULL;
MBLOCK Nmblk = {NULL, false, 0, false, NULL}; // Used to init MBLOCK's
@@ -473,7 +469,7 @@ bool PlugEvalLike(PGLOBAL g, LPCSTR strg, LPCSTR pat, bool ci)
tp = g->Message;
else if (!(tp = new char[strlen(pat) + strlen(strg) + 2])) {
strcpy(g->Message, MSG(NEW_RETURN_NULL));
- throw OP_LIKE;
+ throw (int)OP_LIKE;
} /* endif tp */
sp = tp + strlen(pat) + 1;
@@ -484,7 +480,7 @@ bool PlugEvalLike(PGLOBAL g, LPCSTR strg, LPCSTR pat, bool ci)
tp = g->Message; /* Use this as temporary work space. */
else if (!(tp = new char[strlen(pat) + 1])) {
strcpy(g->Message, MSG(NEW_RETURN_NULL));
- throw OP_LIKE;
+ throw (int)OP_LIKE;
} /* endif tp */
strcpy(tp, pat); /* Make a copy to be worked into */
@@ -697,21 +693,9 @@ PDTP MakeDateFormat(PGLOBAL g, PCSZ dfmt, bool in, bool out, int flag)
/* Call the FLEX generated parser. In multi-threading mode the next */
/* instruction is included in an Enter/LeaveCriticalSection bracket. */
/*********************************************************************/
- //#if defined(THREAD)
-#if defined(__WIN__)
- EnterCriticalSection((LPCRITICAL_SECTION)&parsec);
-#else // !__WIN__
pthread_mutex_lock(&parmut);
-#endif // !__WIN__
-//#endif // THREAD
rc = fmdflex(pdp);
-//#if defined(THREAD)
-#if defined(__WIN__)
- LeaveCriticalSection((LPCRITICAL_SECTION)&parsec);
-#else // !__WIN__
pthread_mutex_unlock(&parmut);
-#endif // !__WIN__
-//#endif // THREAD
if (trace)
htrc("Done: in=%s out=%s rc=%d\n", SVP(pdp->InFmt), SVP(pdp->OutFmt), rc);
diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp
index f0822526b98..e4bfd825932 100644
--- a/storage/connect/plugutil.cpp
+++ b/storage/connect/plugutil.cpp
@@ -2,11 +2,11 @@
/* */
/* PROGRAM NAME: PLUGUTIL */
/* ------------- */
-/* Version 2.9 */
+/* Version 3.0 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 1993-2015 */
+/* (C) Copyright to the author Olivier BERTRAND 1993-2017 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -76,6 +76,7 @@
#include "osutil.h"
#include "global.h"
+#include "plgdbsem.h"
#if defined(NEWMSG)
#include "rcmsg.h"
#endif // NEWMSG
@@ -132,12 +133,12 @@ void htrc(char const *fmt, ...)
/* Return value is the pointer to the Global structure. */
/***********************************************************************/
PGLOBAL PlugInit(LPCSTR Language, uint worksize)
- {
- PGLOBAL g;
+{
+ PGLOBAL g;
- if (trace > 1)
- htrc("PlugInit: Language='%s'\n",
- ((!Language) ? "Null" : (char*)Language));
+ if (trace > 1)
+ htrc("PlugInit: Language='%s'\n",
+ ((!Language) ? "Null" : (char*)Language));
try {
g = new GLOBAL;
@@ -146,53 +147,54 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
return NULL;
} // end try/catch
- //if (!(g = (PGLOBAL)malloc(sizeof(GLOBAL)))) {
- // fprintf(stderr, MSG(GLOBAL_ERROR), (int)sizeof(GLOBAL));
- // return NULL;
- // } else {
- g->Sarea = NULL;
- g->Createas = 0;
- g->Alchecked = 0;
- g->Mrr = 0;
- g->Activityp = NULL;
- g->Xchk = NULL;
- g->N = 0;
- g->More = 0;
- strcpy(g->Message, "");
-
- /*******************************************************************/
- /* Allocate the main work segment. */
- /*******************************************************************/
- if (worksize && !(g->Sarea = PlugAllocMem(g, worksize))) {
- char errmsg[MAX_STR];
- sprintf(errmsg, MSG(WORK_AREA), g->Message);
- strcpy(g->Message, errmsg);
- g->Sarea_Size = 0;
- } else
- g->Sarea_Size = worksize;
-
- //} /* endif g */
-
- g->jump_level = -1; /* New setting to allow recursive call of Plug */
- return(g);
- } /* end of PlugInit */
+ g->Sarea = NULL;
+ g->Createas = 0;
+ g->Alchecked = 0;
+ g->Mrr = 0;
+ g->Activityp = NULL;
+ g->Xchk = NULL;
+ g->N = 0;
+ g->More = 0;
+ strcpy(g->Message, "");
+
+ /*******************************************************************/
+ /* Allocate the main work segment. */
+ /*******************************************************************/
+ if (worksize && !(g->Sarea = PlugAllocMem(g, worksize))) {
+ char errmsg[MAX_STR];
+ sprintf(errmsg, MSG(WORK_AREA), g->Message);
+ strcpy(g->Message, errmsg);
+ g->Sarea_Size = 0;
+ } else
+ g->Sarea_Size = worksize;
+
+ g->jump_level = -1; /* New setting to allow recursive call of Plug */
+ return(g);
+} /* end of PlugInit */
/***********************************************************************/
/* PlugExit: Terminate Plug operations. */
/***********************************************************************/
int PlugExit(PGLOBAL g)
- {
- int rc = 0;
+{
+ if (g) {
+ PDBUSER dup = PlgGetUser(g);
+
+ if (dup)
+ free(dup);
+
+ if (g->Sarea) {
+ if (trace)
+ htrc("Freeing Sarea size=%d\n", g->Sarea_Size);
- if (!g)
- return rc;
+ free(g->Sarea);
+ } // endif Sarea
- if (g->Sarea)
- free(g->Sarea);
+ delete g;
+ } // endif g
- delete g;
- return rc;
- } /* end of PlugExit */
+ return 0;
+} // end of PlugExit
/***********************************************************************/
/* Remove the file type from a file name. */
@@ -456,7 +458,7 @@ short GetLineLength(PGLOBAL g)
/* Program for memory allocation of work and language areas. */
/***********************************************************************/
void *PlugAllocMem(PGLOBAL g, uint size)
- {
+{
void *areap; /* Pointer to allocated area */
/*********************************************************************/
@@ -465,16 +467,16 @@ void *PlugAllocMem(PGLOBAL g, uint size)
if (!(areap = malloc(size)))
sprintf(g->Message, MSG(MALLOC_ERROR), "malloc");
- if (trace > 1) {
+ if (trace) {
if (areap)
htrc("Memory of %u allocated at %p\n", size, areap);
else
htrc("PlugAllocMem: %s\n", g->Message);
- } // endif trace
+ } // endif trace
return (areap);
- } /* end of PlugAllocMem */
+} // end of PlugAllocMem
/***********************************************************************/
/* Program for SubSet initialization of memory pools. */
diff --git a/storage/connect/tabcol.cpp b/storage/connect/tabcol.cpp
index 2740864a69b..5065d86ce6a 100644
--- a/storage/connect/tabcol.cpp
+++ b/storage/connect/tabcol.cpp
@@ -86,7 +86,7 @@ void XTAB::Printf(PGLOBAL g, FILE *f, uint n)
PlugPutOut(g, f, TYPE_TDB, tp->To_Tdb, n + 2);
} /* endfor tp */
- } /* end of Print */
+ } /* end of Printf */
/***********************************************************************/
/* Make string output of XTAB contents. */
@@ -105,7 +105,7 @@ void XTAB::Prints(PGLOBAL, char *ps, uint z)
n -= i;
} // endif tp
- } /* end of Print */
+ } /* end of Prints */
/***********************************************************************/
@@ -149,7 +149,7 @@ void COLUMN::Printf(PGLOBAL g, FILE *f, uint n)
PlugPutOut(g, f, TYPE_TABLE, To_Table, n + 2);
PlugPutOut(g, f, TYPE_XOBJECT, To_Col, n + 2);
- } /* end of Print */
+ } /* end of Printf */
/***********************************************************************/
/* Make string output of COLUMN contents. */
@@ -166,4 +166,4 @@ void COLUMN::Prints(PGLOBAL, char *ps, uint z)
strncpy(ps, buf, z);
ps[z - 1] = '\0';
- } /* end of Print */
+ } /* end of Prints */
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index 468966e79d9..37e53c83d36 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -1309,7 +1309,7 @@ PBF TDBDOS::InitBlockFilter(PGLOBAL g, PFIL filp)
} // endif !opm
// if opm, pass thru
- /* fall through */
+ // fall through
case OP_IN:
if (filp->GetArgType(0) == TYPE_COLBLK &&
filp->GetArgType(1) == TYPE_ARRAY) {
@@ -1645,8 +1645,8 @@ int TDBDOS::TestBlock(PGLOBAL g)
/***********************************************************************/
int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
{
- int k, n;
- bool fixed, doit, sep, b = (pxdf != NULL);
+ int k, n, rc = RC_OK;
+ bool fixed, doit, sep, b = (pxdf != NULL);
PCOL *keycols, colp;
PIXDEF xdp, sxp = NULL;
PKPDEF kdp;
@@ -1690,95 +1690,105 @@ int TDBDOS::MakeIndex(PGLOBAL g, PIXDEF pxdf, bool add)
} else if (!(pxdf = dfp->GetIndx()))
return RC_INFO; // No index to make
- // Allocate all columns that will be used by indexes.
- // This must be done before opening the table so specific
- // column initialization can be done (in particular by TDBVCT)
- for (n = 0, xdp = pxdf; xdp; xdp = xdp->GetNext())
- for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
- if (!(colp = ColDB(g, kdp->GetName(), 0))) {
- sprintf(g->Message, MSG(INDX_COL_NOTIN), kdp->GetName(), Name);
- goto err;
- } else if (colp->GetResultType() == TYPE_DECIM) {
- sprintf(g->Message, "Decimal columns are not indexable yet");
- goto err;
- } // endif Type
-
- colp->InitValue(g);
- n = MY_MAX(n, xdp->GetNparts());
- } // endfor kdp
-
- keycols = (PCOL*)PlugSubAlloc(g, NULL, n * sizeof(PCOL));
- sep = dfp->GetBoolCatInfo("SepIndex", false);
-
- /*********************************************************************/
- /* Construct and save the defined indexes. */
- /*********************************************************************/
- for (xdp = pxdf; xdp; xdp = xdp->GetNext())
- if (!OpenDB(g)) {
- if (xdp->IsAuto() && fixed)
- // Auto increment key and fixed file: use an XXROW index
- continue; // XXROW index doesn't need to be made
-
- // On Update, redo only indexes that are modified
- doit = !To_SetCols;
- n = 0;
-
- if (sxp)
- xdp->SetID(sxp->GetID() + 1);
-
- for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
- // Check whether this column was updated
- for (colp = To_SetCols; !doit && colp; colp = colp->GetNext())
- if (!stricmp(kdp->GetName(), colp->GetName()))
- doit = true;
-
- keycols[n++] = ColDB(g, kdp->GetName(), 0);
- } // endfor kdp
-
- // If no indexed columns were updated, don't remake the index
- // if indexes are in separate files.
- if (!doit && sep)
- continue;
-
- k = xdp->GetNparts();
-
- // Make the index and save it
- if (dfp->Huge)
- pxp = new(g) XHUGE;
- else
- pxp = new(g) XFILE;
-
- if (k == 1) // Simple index
- x = new(g) XINDXS(this, xdp, pxp, keycols);
- else // Multi-Column index
- x = new(g) XINDEX(this, xdp, pxp, keycols);
-
- if (!x->Make(g, sxp)) {
- // Retreive define values from the index
- xdp->SetMaxSame(x->GetMaxSame());
-// xdp->SetSize(x->GetSize());
-
- // store KXYCOL Mxs in KPARTDEF Mxsame
- xdp->SetMxsame(x);
+ try {
+ // Allocate all columns that will be used by indexes.
+ // This must be done before opening the table so specific
+ // column initialization can be done (in particular by TDBVCT)
+ for (n = 0, xdp = pxdf; xdp; xdp = xdp->GetNext())
+ for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
+ if (!(colp = ColDB(g, kdp->GetName(), 0))) {
+ sprintf(g->Message, MSG(INDX_COL_NOTIN), kdp->GetName(), Name);
+ goto err;
+ } else if (colp->GetResultType() == TYPE_DECIM) {
+ sprintf(g->Message, "Decimal columns are not indexable yet");
+ goto err;
+ } // endif Type
+
+ colp->InitValue(g);
+ n = MY_MAX(n, xdp->GetNparts());
+ } // endfor kdp
+
+ keycols = (PCOL*)PlugSubAlloc(g, NULL, n * sizeof(PCOL));
+ sep = dfp->GetBoolCatInfo("SepIndex", false);
+
+ /*********************************************************************/
+ /* Construct and save the defined indexes. */
+ /*********************************************************************/
+ for (xdp = pxdf; xdp; xdp = xdp->GetNext())
+ if (!OpenDB(g)) {
+ if (xdp->IsAuto() && fixed)
+ // Auto increment key and fixed file: use an XXROW index
+ continue; // XXROW index doesn't need to be made
+
+ // On Update, redo only indexes that are modified
+ doit = !To_SetCols;
+ n = 0;
+
+ if (sxp)
+ xdp->SetID(sxp->GetID() + 1);
+
+ for (kdp = xdp->GetToKeyParts(); kdp; kdp = kdp->GetNext()) {
+ // Check whether this column was updated
+ for (colp = To_SetCols; !doit && colp; colp = colp->GetNext())
+ if (!stricmp(kdp->GetName(), colp->GetName()))
+ doit = true;
+
+ keycols[n++] = ColDB(g, kdp->GetName(), 0);
+ } // endfor kdp
+
+ // If no indexed columns were updated, don't remake the index
+ // if indexes are in separate files.
+ if (!doit && sep)
+ continue;
+
+ k = xdp->GetNparts();
+
+ // Make the index and save it
+ if (dfp->Huge)
+ pxp = new(g) XHUGE;
+ else
+ pxp = new(g) XFILE;
+
+ if (k == 1) // Simple index
+ x = new(g) XINDXS(this, xdp, pxp, keycols);
+ else // Multi-Column index
+ x = new(g) XINDEX(this, xdp, pxp, keycols);
+
+ if (!x->Make(g, sxp)) {
+ // Retreive define values from the index
+ xdp->SetMaxSame(x->GetMaxSame());
+ // xdp->SetSize(x->GetSize());
+
+ // store KXYCOL Mxs in KPARTDEF Mxsame
+ xdp->SetMxsame(x);
#if defined(TRACE)
- printf("Make done...\n");
+ printf("Make done...\n");
#endif // TRACE
-// if (x->GetSize() > 0)
- sxp = xdp;
+ // if (x->GetSize() > 0)
+ sxp = xdp;
- xdp->SetInvalid(false);
- } else
- goto err;
+ xdp->SetInvalid(false);
+ } else
+ goto err;
- } else
- return RC_INFO; // Error or Physical table does not exist
+ } else
+ return RC_INFO; // Error or Physical table does not exist
+
+ } catch (int n) {
+ if (trace)
+ htrc("Exception %d: %s\n", n, g->Message);
+ rc = RC_FX;
+ } catch (const char *msg) {
+ strcpy(g->Message, msg);
+ rc = RC_FX;
+ } // end catch
if (Use == USE_OPEN)
CloseDB(g);
- return RC_OK;
+ return rc;
err:
if (sxp)
@@ -2725,7 +2735,7 @@ void DOSCOL::WriteColumn(PGLOBAL g)
if (Value->GetBinValue(p, Long, Status)) {
sprintf(g->Message, MSG(BIN_F_TOO_LONG),
Name, Value->GetSize(), Long);
- longjmp(g->jumper[g->jump_level], 31);
+ throw 31;
} // endif
} // end of WriteColumn
@@ -2874,7 +2884,7 @@ bool DOSCOL::AddDistinctValue(PGLOBAL g)
void DOSCOL::Printf(PGLOBAL g, FILE *f, uint n)
{
COLBLK::Printf(g, f, n);
- } // end of Print
+ } // end of Printf
/* ------------------------------------------------------------------- */
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index 063115c7a60..a74be7eb699 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -41,12 +41,12 @@
/***********************************************************************/
#define MAXCOL 200 /* Default max column nb in result */
#define TYPE_UNKNOWN 12 /* Must be greater than other types */
-#define USE_G 1 /* Use recoverable memory if 1 */
/***********************************************************************/
/* External function. */
/***********************************************************************/
USETEMP UseTemp(void);
+char *GetJsonNull(void);
typedef struct _jncol {
struct _jncol *Next;
@@ -163,7 +163,6 @@ PQRYRES JSONColumns(PGLOBAL g, char *db, PTOS topt, bool info)
tjnp->SetMode(MODE_READ);
-#if USE_G
// Allocate the parse work memory
PGLOBAL G = (PGLOBAL)PlugSubAlloc(g, NULL, sizeof(GLOBAL));
memset(G, 0, sizeof(GLOBAL));
@@ -172,9 +171,6 @@ PQRYRES JSONColumns(PGLOBAL g, char *db, PTOS topt, bool info)
PlugSubSet(G, G->Sarea, G->Sarea_Size);
G->jump_level = 0;
tjnp->SetG(G);
-#else
- tjnp->SetG(g);
-#endif
if (tjnp->OpenDB(g))
return NULL;
@@ -478,7 +474,6 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
// Txfp must be set for TDBDOS
tdbp = new(g) TDBJSN(this, txfp);
-#if USE_G
// Allocate the parse work memory
PGLOBAL G = (PGLOBAL)PlugSubAlloc(g, NULL, sizeof(GLOBAL));
memset(G, 0, sizeof(GLOBAL));
@@ -487,9 +482,6 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
PlugSubSet(G, G->Sarea, G->Sarea_Size);
G->jump_level = 0;
((TDBJSN*)tdbp)->G = G;
-#else
- ((TDBJSN*)tdbp)->G = g;
-#endif
} else {
if (Zipped) {
#if defined(ZIP_SUPPORT)
@@ -762,10 +754,8 @@ int TDBJSN::ReadDB(PGLOBAL g)
// Deferred reading failed
return rc;
-#if USE_G
// Recover the memory used for parsing
PlugSubSet(G, G->Sarea, G->Sarea_Size);
-#endif
if ((Row = ParseJson(G, To_Line, strlen(To_Line), &Pretty, &Comma))) {
Row = FindRow(g);
@@ -774,9 +764,7 @@ int TDBJSN::ReadDB(PGLOBAL g)
M = 1;
rc = RC_OK;
} else if (Pretty != 1 || strcmp(To_Line, "]")) {
-#if USE_G
strcpy(g->Message, G->Message);
-#endif
rc = RC_FX;
} else
rc = RC_EF;
@@ -882,9 +870,7 @@ int TDBJSN::WriteDB(PGLOBAL g)
{
int rc = TDBDOS::WriteDB(g);
-#if USE_G
PlugSubSet(G, G->Sarea, G->Sarea_Size);
-#endif
Row->Clear();
return rc;
} // end of WriteDB
@@ -1228,7 +1214,7 @@ void JSONCOL::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n)
case TYPE_INTG:
case TYPE_BINT:
case TYPE_DBL:
- case TYPE_DATE:
+ case TYPE_DTM:
vp->SetValue_pval(val->GetValue());
break;
case TYPE_BOOL:
@@ -1390,9 +1376,12 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
for (i = 0; i < ars; i++) {
jvrp = arp->GetValue(i);
- do {
- if (n < Nod - 1 && jvrp->GetJson()) {
- Tjp->NextSame = nextsame;
+ if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) do {
+ if (jvrp->IsNull()) {
+ jvrp->Value = AllocateValue(g, GetJsonNull(), TYPE_STRING);
+ jvp = jvrp;
+ } else if (n < Nod - 1 && jvrp->GetJson()) {
+ Tjp->NextSame = nextsame;
jval.SetValue(GetColumnValue(g, jvrp->GetJson(), n + 1));
jvp = &jval;
} else
@@ -1404,8 +1393,9 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
} else
SetJsonValue(g, MulVal, jvp, n);
- if (!MulVal->IsZero()) {
- switch (op) {
+// if (!MulVal->IsZero()) {
+ if (!MulVal->IsNull()) {
+ switch (op) {
case OP_CNC:
if (Nodes[n].CncVal) {
val[0] = Nodes[n].CncVal;
diff --git a/storage/connect/table.cpp b/storage/connect/table.cpp
index d39837a7b5a..c3a02ff42b9 100644
--- a/storage/connect/table.cpp
+++ b/storage/connect/table.cpp
@@ -324,7 +324,7 @@ void TDB::Printf(PGLOBAL g, FILE *f, uint n)
void TDB::Prints(PGLOBAL, char *ps, uint)
{
sprintf(ps, "R%d.%s", Tdb_No, Name);
- } // end of Print
+ } // end of Prints
/* -------------------------- class TDBASE --------------------------- */
diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp
index 34711d584f1..8ffa234ba5c 100644
--- a/storage/connect/tabodbc.cpp
+++ b/storage/connect/tabodbc.cpp
@@ -273,7 +273,7 @@ PCSZ TDBODBC::GetFile(PGLOBAL g)
/***********************************************************************/
/* Set DBQ and get the new file name into the connect string. */
/***********************************************************************/
-void TDBODBC::SetFile(PGLOBAL g, PSZ fn)
+void TDBODBC::SetFile(PGLOBAL g, PCSZ fn)
{
if (MulConn) {
int n = strlen(MulConn) + strlen(fn) - 1;
@@ -289,7 +289,7 @@ void TDBODBC::SetFile(PGLOBAL g, PSZ fn)
sprintf(Connect, MulConn, fn);
} // endif MultConn
- DBQ = fn;
+ DBQ = PlugDup(g, fn);
} // end of SetFile
/***********************************************************************/
diff --git a/storage/connect/tabodbc.h b/storage/connect/tabodbc.h
index 0ca88b60858..0699da54e7f 100644
--- a/storage/connect/tabodbc.h
+++ b/storage/connect/tabodbc.h
@@ -71,7 +71,7 @@ class TDBODBC : public TDBEXT {
virtual PTDB Clone(PTABS t);
virtual bool SetRecpos(PGLOBAL g, int recpos);
virtual PCSZ GetFile(PGLOBAL g);
- virtual void SetFile(PGLOBAL g, PSZ fn);
+ virtual void SetFile(PGLOBAL g, PCSZ fn);
virtual void ResetSize(void);
virtual PCSZ GetServer(void) {return "ODBC";}
virtual int Indexable(void) {return 2;}
diff --git a/storage/connect/tabvir.cpp b/storage/connect/tabvir.cpp
index 84b3dd1787b..c78a8f531f6 100644
--- a/storage/connect/tabvir.cpp
+++ b/storage/connect/tabvir.cpp
@@ -289,7 +289,7 @@ void VIRCOL::ReadColumn(PGLOBAL g)
{
// This should never be called
sprintf(g->Message, "ReadColumn: Column %s is not virtual", Name);
- throw TYPE_COLBLK;
+ throw (int)TYPE_COLBLK;
} // end of ReadColumn
/* ---------------------------TDBVICL class -------------------------- */
diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp
index 80d4395058e..c09386451ff 100644
--- a/storage/connect/tabxml.cpp
+++ b/storage/connect/tabxml.cpp
@@ -1319,7 +1319,7 @@ void TDBXML::CloseDB(PGLOBAL g)
Docp->CloseDoc(g, To_Xb);
// This causes a crash in Diagnostics_area::set_error_status
-// throw TYPE_AM_XML;
+// throw (int)TYPE_AM_XML;
} // endif DumpDoc
} // endif Changed
@@ -1642,7 +1642,7 @@ void XMLCOL::ReadColumn(PGLOBAL g)
if (ValNode->GetType() != XML_ELEMENT_NODE &&
ValNode->GetType() != XML_ATTRIBUTE_NODE) {
sprintf(g->Message, MSG(BAD_VALNODE), ValNode->GetType(), Name);
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} // endif type
// Get the Xname value from the XML file
@@ -1653,7 +1653,7 @@ void XMLCOL::ReadColumn(PGLOBAL g)
PushWarning(g, Tdbp);
break;
default:
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} // endswitch
Value->SetValue_psz(Valbuf);
@@ -1704,7 +1704,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
/* For columns having an Xpath, the Clist must be updated. */
/*********************************************************************/
if (Tdbp->CheckRow(g, Nod || Tdbp->Colname))
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
/*********************************************************************/
/* Null values are represented by no node. */
@@ -1776,7 +1776,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
if (ColNode == NULL) {
strcpy(g->Message, MSG(COL_ALLOC_ERR));
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} // endif ColNode
} // endif ColNode
@@ -1795,7 +1795,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
if (ValNode == NULL && AttNode == NULL) {
strcpy(g->Message, MSG(VAL_ALLOC_ERR));
- longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
+ throw (int)TYPE_AM_XML;
} // endif ValNode
/*********************************************************************/
@@ -1805,7 +1805,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
if (strlen(p) > (unsigned)Long) {
sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long);
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} else
strcpy(Valbuf, p);
@@ -1855,7 +1855,7 @@ void XMULCOL::ReadColumn(PGLOBAL g)
if (ValNode->GetType() != XML_ELEMENT_NODE &&
ValNode->GetType() != XML_ATTRIBUTE_NODE) {
sprintf(g->Message, MSG(BAD_VALNODE), ValNode->GetType(), Name);
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} // endif type
// Get the Xname value from the XML file
@@ -1866,7 +1866,7 @@ void XMULCOL::ReadColumn(PGLOBAL g)
PushWarning(g, Tdbp);
break;
default:
- longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
+ throw (int)TYPE_AM_XML;
} // endswitch
if (!b) {
@@ -1941,7 +1941,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
/* For columns having an Xpath, the Clist must be updated. */
/*********************************************************************/
if (Tdbp->CheckRow(g, Nod))
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
/*********************************************************************/
/* Find the column and value nodes to update or insert. */
@@ -1990,7 +1990,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
if (len > 1 && !Tdbp->Xpand) {
sprintf(g->Message, MSG(BAD_VAL_UPDATE), Name);
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} else
ValNode = Nlx->GetItem(g, Tdbp->Nsub, Vxnp);
@@ -2032,7 +2032,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
if (ColNode == NULL) {
strcpy(g->Message, MSG(COL_ALLOC_ERR));
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} // endif ColNode
} // endif ColNode
@@ -2051,8 +2051,8 @@ void XMULCOL::WriteColumn(PGLOBAL g)
if (ValNode == NULL && AttNode == NULL) {
strcpy(g->Message, MSG(VAL_ALLOC_ERR));
- longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
- } // endif ValNode
+ throw (int)TYPE_AM_XML;
+ } // endif ValNode
/*********************************************************************/
/* Get the string representation of Value according to column type. */
@@ -2061,7 +2061,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
if (strlen(p) > (unsigned)Long) {
sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long);
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} else
strcpy(Valbuf, p);
@@ -2093,7 +2093,7 @@ void XPOSCOL::ReadColumn(PGLOBAL g)
if (Tdbp->Clist == NULL) {
strcpy(g->Message, MSG(MIS_TAG_LIST));
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} // endif Clist
if ((ValNode = Tdbp->Clist->GetItem(g, Rank, Vxnp))) {
@@ -2105,7 +2105,7 @@ void XPOSCOL::ReadColumn(PGLOBAL g)
PushWarning(g, Tdbp);
break;
default:
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} // endswitch
Value->SetValue_psz(Valbuf);
@@ -2156,14 +2156,14 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
/* For all columns the Clist must be updated. */
/*********************************************************************/
if (Tdbp->CheckRow(g, true))
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
/*********************************************************************/
/* Find the column and value nodes to update or insert. */
/*********************************************************************/
if (Tdbp->Clist == NULL) {
strcpy(g->Message, MSG(MIS_TAG_LIST));
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} // endif Clist
n = Tdbp->Clist->GetLength();
@@ -2188,7 +2188,7 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
if (strlen(p) > (unsigned)Long) {
sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long);
- throw TYPE_AM_XML;
+ throw (int)TYPE_AM_XML;
} else
strcpy(Valbuf, p);
diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc
index ca3557666a4..9fe2c75d530 100644
--- a/storage/connect/user_connect.cc
+++ b/storage/connect/user_connect.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2015
+/* Copyright (C) MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@
that is a connection with its personnal memory allocation.
@note
-
+ Author Olivier Bertrand
*/
/****************************************************************************/
@@ -47,6 +47,8 @@
#include "user_connect.h"
#include "mycat.h"
+extern pthread_mutex_t usrmut;
+
/****************************************************************************/
/* Initialize the user_connect static member. */
/****************************************************************************/
@@ -111,7 +113,10 @@ bool user_connect::user_init()
int rc= PlugExit(g);
g= NULL;
- free(dup);
+
+ if (dup)
+ free(dup);
+
return true;
} // endif g->
@@ -122,15 +127,19 @@ bool user_connect::user_init()
strcpy(ap->Ap_Name, "CONNECT");
g->Activityp= ap;
g->Activityp->Aptr= dup;
- next= to_users;
+
+ pthread_mutex_lock(&usrmut);
+ next= to_users;
to_users= this;
if (next)
next->previous= this;
- last_query_id= thdp->query_id;
count= 1;
- return false;
+ pthread_mutex_unlock(&usrmut);
+
+ last_query_id = thdp->query_id;
+ return false;
} // end of user_init
@@ -144,18 +153,22 @@ void user_connect::SetHandler(ha_connect *hc)
/****************************************************************************/
/* Check whether we begin a new query and if so cleanup the previous one. */
/****************************************************************************/
-bool user_connect::CheckCleanup(void)
+bool user_connect::CheckCleanup(bool force)
{
- if (thdp->query_id > last_query_id) {
+ if (thdp->query_id > last_query_id || force) {
uint worksize= GetWorkSize();
PlugCleanup(g, true);
if (g->Sarea_Size != worksize) {
- if (g->Sarea)
- free(g->Sarea);
+ if (g->Sarea) {
+ if (trace)
+ htrc("CheckCleanup: Free Sarea %d\n", g->Sarea_Size);
+
+ free(g->Sarea);
+ } // endif Size
- // Check whether the work area size was changed
+ // Check whether the work area could be allocated
if (!(g->Sarea = PlugAllocMem(g, worksize))) {
g->Sarea = PlugAllocMem(g, g->Sarea_Size);
SetWorkSize(g->Sarea_Size); // Was too big
@@ -171,7 +184,7 @@ bool user_connect::CheckCleanup(void)
g->Mrr = 0;
last_query_id= thdp->query_id;
- if (trace)
+ if (trace && !force)
printf("=====> Begin new query %llu\n", last_query_id);
return true;
diff --git a/storage/connect/user_connect.h b/storage/connect/user_connect.h
index a883eb85934..983d9adc478 100644
--- a/storage/connect/user_connect.h
+++ b/storage/connect/user_connect.h
@@ -1,4 +1,4 @@
-/* Copyright (C) Olivier Bertrand 2004 - 2011
+/* Copyright (C) MariaDB Corporation Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
Declaration of the user_connect class.
@note
+ Author Olivier Bertrand
@see
/sql/handler.h and /storage/connect/user_connect.cc
@@ -53,7 +54,7 @@ public:
// Implementation
bool user_init();
void SetHandler(ha_connect *hc);
- bool CheckCleanup(void);
+ bool CheckCleanup(bool force = false);
bool CheckQueryID(void) {return thdp->query_id > last_query_id;}
bool CheckQuery(query_id_t vid) {return last_query_id > vid;}
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index b6c63bdadd3..8316e7a5ff0 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -118,7 +118,8 @@ ulonglong CharToNumber(const char *p, int n, ulonglong maxval,
maxval++;
if (minus) *minus = true;
} // endif Unsigned
- /* fall through */
+
+ // Fall through
case '+':
p++;
break;
@@ -571,9 +572,9 @@ void VALUE::Printf(PGLOBAL g, FILE *f, uint n)
if (Null)
fprintf(f, "%s<null>\n", m);
else
- fprintf(f, "%s%s%s", GetCharString(buf), "\n", m);
+ fprintf(f, "%s%s\n", m, GetCharString(buf));
-} /* end of Print */
+} /* end of Printf */
/***********************************************************************/
/* Make string output of an object value. */
@@ -588,7 +589,7 @@ void VALUE::Prints(PGLOBAL g, char *ps, uint z)
p = GetCharString(buf);
strncpy(ps, p, z);
-} // end of Print
+} // end of Prints
/* -------------------------- Class TYPVAL ---------------------------- */
@@ -1349,7 +1350,7 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
char buf[64];
- if (!(Null = valp->IsNull() && Nullable))
+ if (!(Null = (valp->IsNull() && Nullable)))
strncpy(Strp, valp->GetCharString(buf), Len);
else
Reset();
@@ -1451,7 +1452,7 @@ void TYPVAL<PSZ>::SetValue(uint n)
if (k > Len) {
sprintf(g->Message, MSG(VALSTR_TOO_LONG), buf, Len);
- longjmp(g->jumper[g->jump_level], 138);
+ throw 138;
} else
SetValue_psz(buf);
@@ -1505,7 +1506,7 @@ void TYPVAL<PSZ>::SetValue(ulonglong n)
if (k > Len) {
sprintf(g->Message, MSG(VALSTR_TOO_LONG), buf, Len);
- longjmp(g->jumper[g->jump_level], 138);
+ throw 138;
} else
SetValue_psz(buf);
@@ -1655,32 +1656,36 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
int i;
for (i = 0; i < np; i++)
- p[i] = vp[i]->GetCharString(val[i]);
+ p[i] = vp[i]->IsNull() ? NULL : vp[i]->GetCharString(val[i]);
- switch (op) {
- case OP_CNC:
- assert(np == 1 || np == 2);
+ if (p[i-1]) {
+ switch (op) {
+ case OP_CNC:
+ assert(np == 1 || np == 2);
- if (np == 2)
- SetValue_psz(p[0]);
+ if (np == 2)
+ SetValue_psz(p[0]);
- if ((i = Len - (signed)strlen(Strp)) > 0)
- strncat(Strp, p[np - 1], i);
+ if ((i = Len - (signed)strlen(Strp)) > 0)
+ strncat(Strp, p[np - 1], i);
- break;
- case OP_MIN:
- assert(np == 2);
- SetValue_psz((strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
- break;
- case OP_MAX:
- assert(np == 2);
- SetValue_psz((strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
- break;
- default:
-// sprintf(g->Message, MSG(BAD_EXP_OPER), op);
- strcpy(g->Message, "Function not supported");
- return true;
- } // endswitch op
+ break;
+ case OP_MIN:
+ assert(np == 2);
+ SetValue_psz((strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
+ break;
+ case OP_MAX:
+ assert(np == 2);
+ SetValue_psz((strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
+ break;
+ default:
+ // sprintf(g->Message, MSG(BAD_EXP_OPER), op);
+ strcpy(g->Message, "Function not supported");
+ return true;
+ } // endswitch op
+
+ Null = false;
+ } // endif p[i]
return false;
} // end of Compute
@@ -1719,8 +1724,12 @@ void TYPVAL<PSZ>::Prints(PGLOBAL g, char *ps, uint z)
else
strcat(strncat(strncpy(ps, "\"", z), Strp, z-2), "\"");
-} // end of Print
+} // end of Prints
+
+/* -------------------------- Class DECIMAL -------------------------- */
+/***********************************************************************/
+/* DECIMAL public constructor from a constant string. */
/* -------------------------- Class DECIMAL -------------------------- */
/***********************************************************************/
@@ -2562,7 +2571,7 @@ bool DTVAL::SetValue_pval(PVAL valp, bool chktype)
} else if (valp->GetType() == TYPE_BIGINT &&
!(valp->GetBigintValue() % 1000)) {
// Assuming that this timestamp is in milliseconds
- Tval = valp->GetBigintValue() / 1000;
+ Tval = (int)(valp->GetBigintValue() / 1000);
} else
Tval = valp->GetIntValue();
diff --git a/storage/connect/value.h b/storage/connect/value.h
index 2754c761815..f771d33dc52 100644
--- a/storage/connect/value.h
+++ b/storage/connect/value.h
@@ -90,8 +90,8 @@ class DllExport VALUE : public BLOCK {
virtual double GetFloatValue(void) = 0;
virtual void *GetTo_Val(void) = 0;
virtual void SetPrec(int prec) {Prec = prec;}
- bool IsNull(void) {return Null;}
- void SetNull(bool b) {Null = b;}
+ bool IsNull(void) {return (Nullable && Null);}
+ void SetNull(bool b) {Null = (Nullable ? b : false);}
bool GetNullable(void) {return Nullable;}
void SetNullable(bool b) {Nullable = b;}
int GetType(void) {return Type;}
diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp
index 3e4db8080ae..30dce3b7fef 100755
--- a/storage/connect/xindex.cpp
+++ b/storage/connect/xindex.cpp
@@ -188,7 +188,7 @@ void XXBASE::Printf(PGLOBAL, FILE *f, uint n)
memset(m, ' ', n); // Make margin string
m[n] = '\0';
fprintf(f, "%sXINDEX: Tbxp=%p Num=%d\n", m, Tbxp, Num_K);
- } // end of Print
+ } // end of Printf
/***********************************************************************/
/* Make string output of XINDEX contents. */
@@ -197,7 +197,7 @@ void XXBASE::Prints(PGLOBAL, char *ps, uint z)
{
*ps = '\0';
strncat(ps, "Xindex", z);
- } // end of Print
+ } // end of Prints
/* -------------------------- XINDEX Class --------------------------- */
@@ -3008,7 +3008,8 @@ KXYCOL::KXYCOL(PKXBASE kp) : To_Keys(Keys.Memp),
/***********************************************************************/
bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
{
- int len = colp->GetLength(), prec = colp->GetScale();
+ int len = colp->GetLength(), prec = colp->GetScale();
+ bool un = colp->IsUnsigned();
// Currently no indexing on NULL columns
if (colp->IsNullable() && kln) {
@@ -3028,7 +3029,7 @@ bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
// Allocate the Value object used when moving items
Type = colp->GetResultType();
- if (!(Valp = AllocateValue(g, Type, len, prec, colp->IsUnsigned())))
+ if (!(Valp = AllocateValue(g, Type, len, prec, un)))
return true;
Klen = Valp->GetClen();
@@ -3044,7 +3045,7 @@ bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
// Currently we set it to true to be compatible with QRY blocks,
// and the one before last is to enable length/type checking, set to
// true if not a prefix key.
- Kblp = AllocValBlock(g, To_Keys, Type, n, len, prec, !Prefix, true);
+ Kblp = AllocValBlock(g, To_Keys, Type, n, len, prec, !Prefix, true, un);
Asc = sm; // Sort mode: Asc=true Desc=false
Ndf = n;
@@ -3064,7 +3065,8 @@ bool KXYCOL::Init(PGLOBAL g, PCOL colp, int n, bool sm, int kln)
/***********************************************************************/
BYTE* KXYCOL::MapInit(PGLOBAL g, PCOL colp, int *n, BYTE *m)
{
- int len = colp->GetLength(), prec = colp->GetScale();
+ int len = colp->GetLength(), prec = colp->GetScale();
+ bool un = colp->IsUnsigned();
if (n[3] && colp->GetLength() > n[3]
&& colp->GetResultType() == TYPE_STRING) {
@@ -3079,7 +3081,7 @@ BYTE* KXYCOL::MapInit(PGLOBAL g, PCOL colp, int *n, BYTE *m)
this, colp, Type, n[0], len, m);
// Allocate the Value object used when moving items
- Valp = AllocateValue(g, Type, len, prec, colp->IsUnsigned());
+ Valp = AllocateValue(g, Type, len, prec, un);
Klen = Valp->GetClen();
if (n[2]) {
@@ -3088,7 +3090,7 @@ BYTE* KXYCOL::MapInit(PGLOBAL g, PCOL colp, int *n, BYTE *m)
Bkeys.Sub = true;
// Allocate the Valblk containing initial block key values
- Blkp = AllocValBlock(g, To_Bkeys, Type, n[2], len, prec, true, true);
+ Blkp = AllocValBlock(g, To_Bkeys, Type, n[2], len, prec, true, true, un);
} // endif nb
Keys.Size = n[0] * Klen;
@@ -3099,7 +3101,7 @@ BYTE* KXYCOL::MapInit(PGLOBAL g, PCOL colp, int *n, BYTE *m)
// by blanks (if true) or keep the zero ending char (if false).
// Currently we set it to true to be compatible with QRY blocks,
// and last one to enable type checking (no conversion).
- Kblp = AllocValBlock(g, To_Keys, Type, n[0], len, prec, !Prefix, true);
+ Kblp = AllocValBlock(g, To_Keys, Type, n[0], len, prec, !Prefix, true, un);
if (n[1]) {
Koff.Size = n[1] * sizeof(int);
diff --git a/storage/connect/xobject.cpp b/storage/connect/xobject.cpp
index 205edc12d0c..02d3e974dcc 100644
--- a/storage/connect/xobject.cpp
+++ b/storage/connect/xobject.cpp
@@ -84,7 +84,7 @@ double XOBJECT::GetFloatValue(void)
CONSTANT::CONSTANT(PGLOBAL g, void *value, short type)
{
if (!(Value = AllocateValue(g, value, (int)type)))
- throw TYPE_CONST;
+ throw (int)TYPE_CONST;
Constant = true;
} // end of CONSTANT constructor
@@ -95,7 +95,7 @@ CONSTANT::CONSTANT(PGLOBAL g, void *value, short type)
CONSTANT::CONSTANT(PGLOBAL g, int n)
{
if (!(Value = AllocateValue(g, &n, TYPE_INT)))
- throw TYPE_CONST;
+ throw (int)TYPE_CONST;
Constant = true;
} // end of CONSTANT constructor
@@ -117,7 +117,7 @@ void CONSTANT::Convert(PGLOBAL g, int newtype)
{
if (Value->GetType() != newtype)
if (!(Value = AllocateValue(g, Value, newtype)))
- throw TYPE_CONST;
+ throw (int)TYPE_CONST;
} // end of Convert
@@ -176,7 +176,7 @@ bool CONSTANT::Rephrase(PGLOBAL g, PSZ work)
void CONSTANT::Printf(PGLOBAL g, FILE *f, uint n)
{
Value->Printf(g, f, n);
- } /* end of Print */
+ } /* end of Printf */
/***********************************************************************/
/* Make string output of a constant object. */
@@ -184,7 +184,7 @@ void CONSTANT::Printf(PGLOBAL g, FILE *f, uint n)
void CONSTANT::Prints(PGLOBAL g, char *ps, uint z)
{
Value->Prints(g, ps, z);
- } /* end of Print */
+ } /* end of Prints */
/* -------------------------- Class STRING --------------------------- */
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index ddf7ec57ad8..85e41554efc 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -1423,6 +1423,7 @@ bool ha_federated::create_where_from_key(String *to,
}
break;
}
+ /* fall through */
case HA_READ_KEY_OR_NEXT:
DBUG_PRINT("info", ("federated HA_READ_KEY_OR_NEXT %d", i));
if (emit_key_part_name(&tmp, key_part) ||
@@ -1442,6 +1443,7 @@ bool ha_federated::create_where_from_key(String *to,
goto err;
break;
}
+ /* fall through */
case HA_READ_KEY_OR_PREV:
DBUG_PRINT("info", ("federated HA_READ_KEY_OR_PREV %d", i));
if (emit_key_part_name(&tmp, key_part) ||
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index aae26758c78..0a24fe9c910 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -1342,6 +1342,7 @@ bool ha_federatedx::create_where_from_key(String *to,
}
break;
}
+ /* fall through */
case HA_READ_KEY_OR_NEXT:
DBUG_PRINT("info", ("federatedx HA_READ_KEY_OR_NEXT %d", i));
if (emit_key_part_name(&tmp, key_part) ||
@@ -1361,6 +1362,7 @@ bool ha_federatedx::create_where_from_key(String *to,
goto err;
break;
}
+ /* fall through */
case HA_READ_KEY_OR_PREV:
DBUG_PRINT("info", ("federatedx HA_READ_KEY_OR_PREV %d", i));
if (emit_key_part_name(&tmp, key_part) ||
diff --git a/storage/heap/hp_extra.c b/storage/heap/hp_extra.c
index c83efd5af61..9a19f818d3b 100644
--- a/storage/heap/hp_extra.c
+++ b/storage/heap/hp_extra.c
@@ -34,6 +34,7 @@ int heap_extra(register HP_INFO *info, enum ha_extra_function function)
switch (function) {
case HA_EXTRA_RESET_STATE:
heap_reset(info);
+ /* fall through */
case HA_EXTRA_NO_READCHECK:
info->opt_flag&= ~READ_CHECK_USED; /* No readcheck */
break;
diff --git a/storage/innobase/api/api0api.cc b/storage/innobase/api/api0api.cc
index bc83e98374f..64dafa0f224 100644
--- a/storage/innobase/api/api0api.cc
+++ b/storage/innobase/api/api0api.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2008, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2008, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1988,11 +1988,14 @@ ib_cursor_read_row(
page_format = static_cast<ib_bool_t>(
dict_table_is_comp(tuple->index->table));
+
rec = btr_pcur_get_rec(pcur);
- if (prebuilt->innodb_api_rec &&
- prebuilt->innodb_api_rec != rec) {
- rec = prebuilt->innodb_api_rec;
+ if (!rec_get_deleted_flag(rec, page_format)) {
+ if (prebuilt->innodb_api &&
+ prebuilt->innodb_api_rec != NULL) {
+ rec =prebuilt->innodb_api_rec;
+ }
}
if (!rec_get_deleted_flag(rec, page_format)) {
@@ -2029,6 +2032,10 @@ ib_cursor_position(
buf = static_cast<unsigned char*>(mem_alloc(UNIV_PAGE_SIZE));
+ if (prebuilt->innodb_api) {
+ prebuilt->cursor_heap = cursor->heap;
+ }
+
/* We want to position at one of the ends, row_search_for_mysql()
uses the search_tuple fields to work out what to do. */
dtuple_set_n_fields(prebuilt->search_tuple, 0);
@@ -2083,6 +2090,9 @@ ib_cursor_next(
row_prebuilt_t* prebuilt = cursor->prebuilt;
byte buf[UNIV_PAGE_SIZE_MAX];
+ if (prebuilt->innodb_api) {
+ prebuilt->cursor_heap = cursor->heap;
+ }
/* We want to move to the next record */
dtuple_set_n_fields(prebuilt->search_tuple, 0);
@@ -2135,6 +2145,9 @@ ib_cursor_moveto(
buf = static_cast<unsigned char*>(mem_alloc(UNIV_PAGE_SIZE));
+ if (prebuilt->innodb_api) {
+ prebuilt->cursor_heap = cursor->heap;
+ }
err = static_cast<ib_err_t>(row_search_for_mysql(
buf, ib_srch_mode, prebuilt, cursor->match_mode, 0));
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index f6cd294884b..a2f79a400e2 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -100,6 +100,7 @@ dict_create_sys_tables_tuple(
| ((table->flags & DICT_TF_COMPACT) << 31));
dfield_set_data(dfield, ptr, 4);
+
/* 5: TYPE (table flags) -----------------------------*/
dfield = dtuple_get_nth_field(
entry, DICT_COL__SYS_TABLES__TYPE);
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 3e9dd072391..1a3923047b0 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1389,9 +1389,6 @@ dict_table_add_to_cache(
dict_table_autoinc_restore(table);
ut_ad(dict_lru_validate());
-
- dict_sys->size += mem_heap_get_size(table->heap)
- + strlen(table->name) + 1;
}
/**********************************************************************//**
@@ -1806,9 +1803,6 @@ dict_table_rename_in_cache(
HASH_INSERT(dict_table_t, name_hash, dict_sys->table_hash, fold,
table);
- dict_sys->size += strlen(new_name) - strlen(old_name);
- ut_a(dict_sys->size > 0);
-
/* Update the table_name field in indexes */
for (index = dict_table_get_first_index(table);
index != NULL;
@@ -2095,7 +2089,6 @@ dict_table_remove_from_cache_low(
{
dict_foreign_t* foreign;
dict_index_t* index;
- ulint size;
ut_ad(table);
ut_ad(dict_lru_validate());
@@ -2175,12 +2168,6 @@ dict_table_remove_from_cache_low(
trx_free_for_background(trx);
}
- size = mem_heap_get_size(table->heap) + strlen(table->name) + 1;
-
- ut_ad(dict_sys->size >= size);
-
- dict_sys->size -= size;
-
dict_mem_table_free(table);
}
@@ -2726,8 +2713,6 @@ undo_size_ok:
dict_index_is_ibuf(index)
? SYNC_IBUF_INDEX_TREE : SYNC_INDEX_TREE);
- dict_sys->size += mem_heap_get_size(new_index->heap);
-
dict_mem_index_free(index);
return(DB_SUCCESS);
@@ -2744,7 +2729,6 @@ dict_index_remove_from_cache_low(
ibool lru_evict) /*!< in: TRUE if index being evicted
to make room in the table LRU list */
{
- ulint size;
ulint retries = 0;
btr_search_t* info;
@@ -2812,12 +2796,6 @@ dict_index_remove_from_cache_low(
/* Remove the index from the list of indexes of the table */
UT_LIST_REMOVE(indexes, table->indexes, index);
- size = mem_heap_get_size(index->heap);
-
- ut_ad(dict_sys->size >= size);
-
- dict_sys->size -= size;
-
dict_mem_index_free(index);
}
@@ -7327,3 +7305,38 @@ dict_tf_to_row_format_string(
return(0);
}
#endif /* !UNIV_HOTBACKUP */
+
+/** Calculate the used memory occupied by the data dictionary
+table and index objects.
+@return number of bytes occupied. */
+UNIV_INTERN
+ulint
+dict_sys_get_size()
+{
+ ulint size = 0;
+
+ ut_ad(dict_sys);
+
+ mutex_enter(&dict_sys->mutex);
+
+ for(ulint i = 0; i < hash_get_n_cells(dict_sys->table_hash); i++) {
+ dict_table_t* table;
+
+ for (table = static_cast<dict_table_t*>(HASH_GET_FIRST(dict_sys->table_hash,i));
+ table != NULL;
+ table = static_cast<dict_table_t*>(HASH_GET_NEXT(name_hash, table))) {
+ dict_index_t* index;
+ size += mem_heap_get_size(table->heap) + strlen(table->name) +1;
+
+ for(index = dict_table_get_first_index(table);
+ index != NULL;
+ index = dict_table_get_next_index(index)) {
+ size += mem_heap_get_size(index->heap);
+ }
+ }
+ }
+
+ mutex_exit(&dict_sys->mutex);
+
+ return (size);
+}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 83c85161d29..6064c3980eb 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -10020,6 +10020,27 @@ ha_innobase::ft_init_ext(
}
/*****************************************************************//**
+Copy a cached MySQL row.
+If requested, also avoids overwriting non-read columns.
+@param[out] buf Row in MySQL format.
+@param[in] cached_row Which row to copy.
+@param[in] rec_len Record length. */
+void
+ha_innobase::copy_cached_row(
+ uchar* buf,
+ const uchar* cached_row,
+ uint rec_len)
+{
+ if (prebuilt->keep_other_fields_on_keyread) {
+ row_sel_copy_cached_fields_for_mysql(buf, cached_row,
+ prebuilt);
+ } else {
+ memcpy(buf, cached_row, rec_len);
+ }
+}
+
+
+/*****************************************************************//**
Set up search tuple for a query through FTS_DOC_ID_INDEX on
supplied Doc ID. This is used by MySQL to retrieve the documents
once the search result (Doc IDs) is available */
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index e21dc93e166..300f49c93f9 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
@@ -167,6 +167,10 @@ class ha_innobase: public handler
int index_first(uchar * buf);
int index_last(uchar * buf);
+ /* Copy a cached MySQL row. If requested, also avoids
+ overwriting non-read columns. */
+ void copy_cached_row(uchar *to_rec, const uchar *from_rec,
+ uint rec_length);
int rnd_init(bool scan);
int rnd_end();
int rnd_next(uchar *buf);
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index f4ffba7ba34..6e88c91557a 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -1654,9 +1654,6 @@ struct dict_sys_t{
on name */
hash_table_t* table_id_hash; /*!< hash table of the tables, based
on id */
- ulint size; /*!< varying space in bytes occupied
- by the data dictionary table and
- index objects */
dict_table_t* sys_tables; /*!< SYS_TABLES table */
dict_table_t* sys_columns; /*!< SYS_COLUMNS table */
dict_table_t* sys_indexes; /*!< SYS_INDEXES table */
@@ -1910,6 +1907,13 @@ dict_table_get_index_on_first_col(
ulint col_index); /*!< in: position of column
in table */
+/** Calculate the used memory occupied by the data dictionary
+table and index objects.
+@return number of bytes occupied. */
+UNIV_INTERN
+ulint
+dict_sys_get_size();
+
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index 71e3b9bb19e..b7c89c426f0 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.
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
@@ -735,6 +735,8 @@ struct row_prebuilt_t {
mem_heap_t* heap; /*!< memory heap from which
these auxiliary structures are
allocated when needed */
+ mem_heap_t* cursor_heap; /*!< memory heap from which
+ innodb_api_buf is allocated per session*/
ins_node_t* ins_node; /*!< Innobase SQL insert node
used to perform inserts
to the table */
@@ -885,6 +887,9 @@ struct row_prebuilt_t {
unsigned innodb_api:1; /*!< whether this is a InnoDB API
query */
const rec_t* innodb_api_rec; /*!< InnoDB API search result */
+ void* innodb_api_buf; /*!< Buffer holding copy of the physical
+ Innodb API search record */
+ ulint innodb_api_rec_size; /*!< Size of the Innodb API record */
byte* srch_key_val1; /*!< buffer used in converting
search key values from MySQL format
to InnoDB format.*/
diff --git a/storage/innobase/include/row0sel.h b/storage/innobase/include/row0sel.h
index fd5bc755a22..afeb216c2a2 100644
--- a/storage/innobase/include/row0sel.h
+++ b/storage/innobase/include/row0sel.h
@@ -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
@@ -205,6 +205,18 @@ struct sel_buf_t{
when data != NULL */
};
+/** Copy used fields from cached row.
+Copy cache record field by field, don't touch fields that
+are not covered by current key.
+@param[out] buf Where to copy the MySQL row.
+@param[in] cached_rec What to copy (in MySQL row format).
+@param[in] prebuilt prebuilt struct. */
+void
+row_sel_copy_cached_fields_for_mysql(
+ byte* buf,
+ const byte* cached_rec,
+ row_prebuilt_t* prebuilt);
+
/** Query plan */
struct plan_t{
dict_table_t* table; /*!< table struct in the dictionary
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 755b10ba65a..f00cb179f56 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -45,7 +45,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 6
-#define INNODB_VERSION_BUGFIX 36
+#define INNODB_VERSION_BUGFIX 37
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
diff --git a/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff
index 154116b748c..e312cf8f65c 100644
--- a/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff
+++ b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff
@@ -352,8 +352,8 @@
-116 0
-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
-fid AsText(Centroid(g))
--117 POINT(55.58852775304245 17.426536064113982)
--118 POINT(55.58852775304245 17.426536064113982)
+-117 POINT(57.98031067576927 17.854754130800433)
+-118 POINT(57.98031067576927 17.854754130800433)
-119 POINT(2 2)
-SELECT fid, Area(g) FROM gis_multi_polygon;
-fid Area(g)
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 45a8010d56d..65569eabf57 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2005, 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
@@ -1613,6 +1613,8 @@ row_merge_read_clustered_index(
row_ext_t* ext;
page_cur_t* cur = btr_pcur_get_page_cur(&pcur);
+ mem_heap_empty(row_heap);
+
/* Do not continue if table pages are still encrypted */
if (!old_table->is_readable() ||
!new_table->is_readable()) {
@@ -2047,8 +2049,6 @@ write_buffers:
goto func_exit;
}
- mem_heap_empty(row_heap);
-
/* Increment innodb_onlineddl_pct_progress status variable */
read_rows++;
if(read_rows % 1000 == 0) {
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 1b57e0d56fd..f691009d6e3 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.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) 2008, Google Inc.
Copyright (c) 2015, 2017, MariaDB Corporation.
@@ -2558,34 +2558,32 @@ row_sel_store_row_id_to_prebuilt(
row_sel_field_store_in_mysql_format_func(dest,templ,src,len)
#endif /* UNIV_DEBUG */
-/**************************************************************//**
-Stores a non-SQL-NULL field in the MySQL format. The counterpart of this
-function is row_mysql_store_col_in_innobase_format() in row0mysql.cc. */
+/** Stores a non-SQL-NULL field in the MySQL format. The counterpart of this
+function is row_mysql_store_col_in_innobase_format() in row0mysql.cc.
+@param[in,out] dest buffer where to store; NOTE
+ that BLOBs are not in themselves stored
+ here: the caller must allocate and copy
+ the BLOB into buffer before, and pass
+ the pointer to the BLOB in 'data'
+@param[in] templ MySQL column template. Its following fields
+ are referenced: type, is_unsigned, mysql_col_len,
+ mbminlen, mbmaxlen
+@param[in] index InnoDB index
+@param[in] field_no templ->rec_field_no or templ->clust_rec_field_no
+ or templ->icp_rec_field_no
+@param[in] data data to store
+@param[in] len length of the data */
static MY_ATTRIBUTE((nonnull))
void
row_sel_field_store_in_mysql_format_func(
-/*=====================================*/
- byte* dest, /*!< in/out: buffer where to store; NOTE
- that BLOBs are not in themselves
- stored here: the caller must allocate
- and copy the BLOB into buffer before,
- and pass the pointer to the BLOB in
- 'data' */
+ byte* dest,
const mysql_row_templ_t* templ,
- /*!< in: MySQL column template.
- Its following fields are referenced:
- type, is_unsigned, mysql_col_len,
- mbminlen, mbmaxlen */
#ifdef UNIV_DEBUG
const dict_index_t* index,
- /*!< in: InnoDB index */
ulint field_no,
- /*!< in: templ->rec_field_no or
- templ->clust_rec_field_no or
- templ->icp_rec_field_no */
#endif /* UNIV_DEBUG */
- const byte* data, /*!< in: data to store */
- ulint len) /*!< in: length of the data */
+ const byte* data,
+ ulint len)
{
byte* ptr;
#ifdef UNIV_DEBUG
@@ -3339,6 +3337,36 @@ row_sel_copy_cached_field_for_mysql(
ut_memcpy(buf, cache, len);
}
+/** Copy used fields from cached row.
+Copy cache record field by field, don't touch fields that
+are not covered by current key.
+@param[out] buf Where to copy the MySQL row.
+@param[in] cached_rec What to copy (in MySQL row format).
+@param[in] prebuilt prebuilt struct. */
+void
+row_sel_copy_cached_fields_for_mysql(
+ byte* buf,
+ const byte* cached_rec,
+ row_prebuilt_t* prebuilt)
+{
+ const mysql_row_templ_t*templ;
+ ulint i;
+ for (i = 0; i < prebuilt->n_template; i++) {
+ templ = prebuilt->mysql_template + i;
+
+ row_sel_copy_cached_field_for_mysql(
+ buf, cached_rec, templ);
+ /* Copy NULL bit of the current field from cached_rec
+ to buf */
+ if (templ->mysql_null_bit_mask) {
+ buf[templ->mysql_null_byte_offset]
+ ^= (buf[templ->mysql_null_byte_offset]
+ ^ cached_rec[templ->mysql_null_byte_offset])
+ & (byte) templ->mysql_null_bit_mask;
+ }
+ }
+}
+
/********************************************************************//**
Pops a cached row for MySQL from the fetch cache. */
UNIV_INLINE
@@ -5068,8 +5096,19 @@ idx_cond_failed:
btr_pcur_store_position(pcur, &mtr);
- if (prebuilt->innodb_api) {
- prebuilt->innodb_api_rec = result_rec;
+ if (prebuilt->innodb_api
+ && (btr_pcur_get_rec(pcur) != result_rec)) {
+ ulint rec_size = rec_offs_size(offsets);
+ if (!prebuilt->innodb_api_rec_size ||
+ (prebuilt->innodb_api_rec_size < rec_size)) {
+ prebuilt->innodb_api_buf =
+ static_cast<byte*>
+ (mem_heap_alloc(prebuilt->cursor_heap,rec_size));
+ prebuilt->innodb_api_rec_size = rec_size;
+ }
+ prebuilt->innodb_api_rec =
+ rec_copy(
+ prebuilt->innodb_api_buf, result_rec, offsets);
}
}
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 61a435e3c0f..7ddd934a9a1 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -1350,7 +1350,7 @@ srv_printf_innodb_monitor(
ut_total_allocated_memory,
mem_pool_get_reserved(mem_comm_pool));
fprintf(file, "Dictionary memory allocated " ULINTPF "\n",
- dict_sys->size);
+ dict_sys_get_size());
buf_print_io(file);
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 08a501a744c..987f3d0ef8a 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -4260,6 +4260,8 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
}
*/
DBUG_PRINT("info", ("is quick repair: %d", (int) rep_quick));
+ if (!rep_quick)
+ my_b_clear(&new_data_cache);
/* Initialize pthread structures before goto err. */
mysql_mutex_init(key_SORT_INFO_mutex, &sort_info.mutex, MY_MUTEX_INIT_FAST);
@@ -4625,7 +4627,7 @@ err:
already or they were not yet started (if the error happend before
creating the threads).
*/
- if (!rep_quick)
+ if (!rep_quick && my_b_inited(&new_data_cache))
end_io_cache(&new_data_cache);
if (!got_error)
{
diff --git a/storage/maria/ma_key_recover.c b/storage/maria/ma_key_recover.c
index 8b6342b76b5..610810756f2 100644
--- a/storage/maria/ma_key_recover.c
+++ b/storage/maria/ma_key_recover.c
@@ -1169,6 +1169,7 @@ uint _ma_apply_redo_index(MARIA_HA *info,
goto err;
}
page_length= page.size;
+ break;
}
case KEY_OP_NONE:
default:
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index d0e0210db64..b1d2378870f 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -887,9 +887,7 @@ prototype_redo_exec_hook(REDO_CREATE_TABLE)
if (create_database_if_not_exists(name))
goto end;
fn_format(filename, name, "", MARIA_NAME_IEXT,
- (MY_UNPACK_FILENAME |
- (flags & HA_DONT_TOUCH_DATA) ? MY_RETURN_REAL_PATH : 0) |
- MY_APPEND_EXT);
+ MY_UNPACK_FILENAME | MY_RETURN_REAL_PATH | MY_APPEND_EXT);
linkname_ptr= NULL;
create_flag= MY_DELETE_OLD;
tprint(tracef, "Table '%s' creating as '%s'\n", name, filename);
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index 3d6e6297d3b..41496ec1352 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -2675,6 +2675,8 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info,
*/
DBUG_PRINT("info", ("is quick repair: %d", rep_quick));
bzero((char*)&sort_info,sizeof(sort_info));
+ if (!rep_quick)
+ my_b_clear(&new_data_cache);
/* Initialize pthread structures before goto err. */
mysql_mutex_init(mi_key_mutex_MI_SORT_INFO_mutex,
&sort_info.mutex, MY_MUTEX_INIT_FAST);
@@ -3054,7 +3056,7 @@ err:
already or they were not yet started (if the error happend before
creating the threads).
*/
- if (!rep_quick)
+ if (!rep_quick && my_b_inited(&new_data_cache))
(void) end_io_cache(&new_data_cache);
if (!got_error)
{
diff --git a/storage/myisam/mysql-test/storage_engine/parts/disabled.def b/storage/myisam/mysql-test/storage_engine/parts/disabled.def
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/storage/myisam/mysql-test/storage_engine/parts/disabled.def
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff
index 024c1646892..6f337ffb638 100644
--- a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff
@@ -352,8 +352,8 @@
-116 0
-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
-fid AsText(Centroid(g))
--117 POINT(55.58852775304245 17.426536064113982)
--118 POINT(55.58852775304245 17.426536064113982)
+-117 POINT(57.98031067576927 17.854754130800433)
+-118 POINT(57.98031067576927 17.854754130800433)
-119 POINT(2 2)
-SELECT fid, Area(g) FROM gis_multi_polygon;
-fid Area(g)
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff
index 1caa6c3d5a8..04c56979244 100644
--- a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff
@@ -352,8 +352,8 @@
-116 0
-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
-fid AsText(Centroid(g))
--117 POINT(55.58852775304245 17.426536064113982)
--118 POINT(55.58852775304245 17.426536064113982)
+-117 POINT(57.98031067576927 17.854754130800433)
+-118 POINT(57.98031067576927 17.854754130800433)
-119 POINT(2 2)
-SELECT fid, Area(g) FROM gis_multi_polygon;
-fid Area(g)
@@ -1062,8 +1062,8 @@
-116 0
-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
-fid AsText(Centroid(g))
--117 POINT(55.58852775304245 17.426536064113982)
--118 POINT(55.58852775304245 17.426536064113982)
+-117 POINT(57.98031067576927 17.854754130800433)
+-118 POINT(57.98031067576927 17.854754130800433)
-119 POINT(2 2)
-SELECT fid, Area(g) FROM gis_multi_polygon;
-fid Area(g)
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index 0e2cdb79bff..ee757977800 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -1,4 +1,4 @@
-SET(TOKUDB_VERSION 5.6.36-82.0)
+SET(TOKUDB_VERSION 5.6.36-82.1)
# PerconaFT only supports x86-64 and cmake-2.8.9+
IF(CMAKE_VERSION VERSION_LESS "2.8.9")
MESSAGE(STATUS "CMake 2.8.9 or higher is required by TokuDB")
diff --git a/storage/tokudb/PerconaFT/CMakeLists.txt b/storage/tokudb/PerconaFT/CMakeLists.txt
index 0e283c13c61..d42525f1089 100644
--- a/storage/tokudb/PerconaFT/CMakeLists.txt
+++ b/storage/tokudb/PerconaFT/CMakeLists.txt
@@ -9,6 +9,16 @@ project(TokuDB)
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
+# detect when we are being built as a subproject
+if (DEFINED MYSQL_PROJECT_NAME_DOCSTRING)
+ add_definitions( -DMYSQL_TOKUDB_ENGINE=1)
+ if ((CMAKE_BUILD_TYPE MATCHES "Debug") AND
+ (CMAKE_CXX_FLAGS_DEBUG MATCHES " -DENABLED_DEBUG_SYNC"))
+ include_directories(${CMAKE_SOURCE_DIR}/include)
+ include_directories(${CMAKE_SOURCE_DIR}/sql)
+ endif ()
+endif ()
+
## Versions of gcc >= 4.9.0 require special version of 'ar' and 'ranlib' for
## link-time optimizations to work properly.
##
diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
index a2c3103f98c..9769b7db13d 100644
--- a/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
+++ b/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
@@ -123,6 +123,9 @@ ExternalProject_Add(build_snappy
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
+ -DCMAKE_AR=${CMAKE_AR}
+ -DCMAKE_NM=${CMAKE_NM}
+ -DCMAKE_RANLIB=${CMAKE_RANLIB}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
${USE_PROJECT_CMAKE_MODULE_PATH}
diff --git a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc
index 6d753805fa9..31aab932fd6 100644
--- a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc
+++ b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.cc
@@ -464,7 +464,10 @@ int toku_cachetable_openf (CACHEFILE *cfptr, CACHETABLE ct, const char *fname_in
char *
toku_cachefile_fname_in_env (CACHEFILE cf) {
- return cf->fname_in_env;
+ if (cf) {
+ return cf->fname_in_env;
+ }
+ return nullptr;
}
void toku_cachefile_set_fname_in_env(CACHEFILE cf, char *new_fname_in_env) {
@@ -2890,6 +2893,10 @@ toku_cachefile_get_cachetable(CACHEFILE cf) {
return cf->cachetable;
}
+CACHEFILE toku_pair_get_cachefile(PAIR pair) {
+ return pair->cachefile;
+}
+
//Only called by ft_end_checkpoint
//Must have access to cf->fd (must be protected)
void toku_cachefile_fsync(CACHEFILE cf) {
diff --git a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.h b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.h
index 3b3cb0a2d46..b9851f33e20 100644
--- a/storage/tokudb/PerconaFT/ft/cachetable/cachetable.h
+++ b/storage/tokudb/PerconaFT/ft/cachetable/cachetable.h
@@ -297,6 +297,9 @@ void *toku_cachefile_get_userdata(CACHEFILE);
CACHETABLE toku_cachefile_get_cachetable(CACHEFILE cf);
// Effect: Get the cachetable.
+CACHEFILE toku_pair_get_cachefile(PAIR);
+// Effect: Get the cachefile of the pair
+
void toku_cachetable_swap_pair_values(PAIR old_pair, PAIR new_pair);
// Effect: Swaps the value_data of old_pair and new_pair.
// Requires: both old_pair and new_pair to be pinned with write locks.
diff --git a/storage/tokudb/PerconaFT/ft/ft-ops.cc b/storage/tokudb/PerconaFT/ft/ft-ops.cc
index 63c6335dafd..07e244947e4 100644
--- a/storage/tokudb/PerconaFT/ft/ft-ops.cc
+++ b/storage/tokudb/PerconaFT/ft/ft-ops.cc
@@ -651,8 +651,12 @@ void toku_ftnode_clone_callback(void *value_data,
// set new pair attr if necessary
if (node->height == 0) {
*new_attr = make_ftnode_pair_attr(node);
- node->logical_rows_delta = 0;
- cloned_node->logical_rows_delta = 0;
+ for (int i = 0; i < node->n_children; i++) {
+ if (BP_STATE(node, i) == PT_AVAIL) {
+ BLB_LRD(node, i) = 0;
+ BLB_LRD(cloned_node, i) = 0;
+ }
+ }
} else {
new_attr->is_valid = false;
}
@@ -700,9 +704,26 @@ void toku_ftnode_flush_callback(CACHEFILE UU(cachefile),
if (ftnode->height == 0) {
FT_STATUS_INC(FT_FULL_EVICTIONS_LEAF, 1);
FT_STATUS_INC(FT_FULL_EVICTIONS_LEAF_BYTES, node_size);
- if (!ftnode->dirty) {
- toku_ft_adjust_logical_row_count(
- ft, -ftnode->logical_rows_delta);
+
+ // A leaf node (height == 0) is being evicted (!keep_me) and is
+ // not a checkpoint clone (!is_clone). This leaf node may have
+ // had messages applied to satisfy a query, but was never
+ // actually dirtied (!ftnode->dirty && !write_me). **Note that
+ // if (write_me) would persist the node and clear the dirty
+ // flag **. This message application may have updated the trees
+ // logical row count. Since these message applications are not
+ // persisted, we need undo the logical row count adjustments as
+ // they may occur again in the future if/when the node is
+ // re-read from disk for another query or change.
+ if (!ftnode->dirty && !write_me) {
+ int64_t lrc_delta = 0;
+ for (int i = 0; i < ftnode->n_children; i++) {
+ if (BP_STATE(ftnode, i) == PT_AVAIL) {
+ lrc_delta -= BLB_LRD(ftnode, i);
+ BLB_LRD(ftnode, i) = 0;
+ }
+ }
+ toku_ft_adjust_logical_row_count(ft, lrc_delta);
}
} else {
FT_STATUS_INC(FT_FULL_EVICTIONS_NONLEAF, 1);
@@ -711,6 +732,11 @@ void toku_ftnode_flush_callback(CACHEFILE UU(cachefile),
toku_free(*disk_data);
} else {
if (ftnode->height == 0) {
+ // No need to adjust logical row counts when flushing a clone
+ // as they should have been zeroed out anyway when cloned.
+ // Clones are 'copies' of work already done so doing it again
+ // (adjusting row counts) would be redundant and leads to
+ // inaccurate counts.
for (int i = 0; i < ftnode->n_children; i++) {
if (BP_STATE(ftnode, i) == PT_AVAIL) {
BASEMENTNODE bn = BLB(ftnode, i);
@@ -718,10 +744,6 @@ void toku_ftnode_flush_callback(CACHEFILE UU(cachefile),
bn->stat64_delta);
}
}
- if (!ftnode->dirty) {
- toku_ft_adjust_logical_row_count(
- ft, -ftnode->logical_rows_delta);
- }
}
}
toku_ftnode_free(&ftnode);
@@ -748,24 +770,48 @@ toku_ft_status_update_pivot_fetch_reason(ftnode_fetch_extra *bfe)
}
}
-int toku_ftnode_fetch_callback (CACHEFILE UU(cachefile), PAIR p, int fd, BLOCKNUM blocknum, uint32_t fullhash,
- void **ftnode_pv, void** disk_data, PAIR_ATTR *sizep, int *dirtyp, void *extraargs) {
+int toku_ftnode_fetch_callback(CACHEFILE UU(cachefile),
+ PAIR p,
+ int fd,
+ BLOCKNUM blocknum,
+ uint32_t fullhash,
+ void **ftnode_pv,
+ void **disk_data,
+ PAIR_ATTR *sizep,
+ int *dirtyp,
+ void *extraargs) {
assert(extraargs);
- assert(*ftnode_pv == NULL);
- FTNODE_DISK_DATA* ndd = (FTNODE_DISK_DATA*)disk_data;
+ assert(*ftnode_pv == nullptr);
+ FTNODE_DISK_DATA *ndd = (FTNODE_DISK_DATA *)disk_data;
ftnode_fetch_extra *bfe = (ftnode_fetch_extra *)extraargs;
- FTNODE *node=(FTNODE*)ftnode_pv;
+ FTNODE *node = (FTNODE *)ftnode_pv;
// deserialize the node, must pass the bfe in because we cannot
// evaluate what piece of the the node is necessary until we get it at
// least partially into memory
- int r = toku_deserialize_ftnode_from(fd, blocknum, fullhash, node, ndd, bfe);
+ int r =
+ toku_deserialize_ftnode_from(fd, blocknum, fullhash, node, ndd, bfe);
if (r != 0) {
if (r == TOKUDB_BAD_CHECKSUM) {
- fprintf(stderr,
- "Checksum failure while reading node in file %s.\n",
- toku_cachefile_fname_in_env(cachefile));
+ fprintf(
+ stderr,
+ "%s:%d:toku_ftnode_fetch_callback - "
+ "file[%s], blocknum[%ld], toku_deserialize_ftnode_from "
+ "failed with a checksum error.\n",
+ __FILE__,
+ __LINE__,
+ toku_cachefile_fname_in_env(cachefile),
+ blocknum.b);
} else {
- fprintf(stderr, "Error deserializing node, errno = %d", r);
+ fprintf(
+ stderr,
+ "%s:%d:toku_ftnode_fetch_callback - "
+ "file[%s], blocknum[%ld], toku_deserialize_ftnode_from "
+ "failed with %d.\n",
+ __FILE__,
+ __LINE__,
+ toku_cachefile_fname_in_env(cachefile),
+ blocknum.b,
+ r);
}
// make absolutely sure we crash before doing anything else.
abort();
@@ -774,7 +820,8 @@ int toku_ftnode_fetch_callback (CACHEFILE UU(cachefile), PAIR p, int fd, BLOCKNU
if (r == 0) {
*sizep = make_ftnode_pair_attr(*node);
(*node)->ct_pair = p;
- *dirtyp = (*node)->dirty; // deserialize could mark the node as dirty (presumably for upgrade)
+ *dirtyp = (*node)->dirty; // deserialize could mark the node as dirty
+ // (presumably for upgrade)
}
return r;
}
@@ -947,6 +994,16 @@ int toku_ftnode_pe_callback(void *ftnode_pv,
basements_to_destroy[num_basements_to_destroy++] = bn;
toku_ft_decrease_stats(&ft->in_memory_stats,
bn->stat64_delta);
+ // A basement node is being partially evicted.
+ // This masement node may have had messages applied to it to
+ // satisfy a query, but was never actually dirtied.
+ // This message application may have updated the trees
+ // logical row count. Since these message applications are
+ // not being persisted, we need undo the logical row count
+ // adjustments as they may occur again in the future if/when
+ // the node is re-read from disk for another query or change.
+ toku_ft_adjust_logical_row_count(ft,
+ -bn->logical_rows_delta);
set_BNULL(node, i);
BP_STATE(node, i) = PT_ON_DISK;
num_partial_evictions++;
diff --git a/storage/tokudb/PerconaFT/ft/ft.cc b/storage/tokudb/PerconaFT/ft/ft.cc
index 7c94b4c59d3..700e532d5cf 100644
--- a/storage/tokudb/PerconaFT/ft/ft.cc
+++ b/storage/tokudb/PerconaFT/ft/ft.cc
@@ -435,7 +435,8 @@ int toku_read_ft_and_store_in_cachefile (FT_HANDLE ft_handle, CACHEFILE cf, LSN
}
int fd = toku_cachefile_get_fd(cf);
- int r = toku_deserialize_ft_from(fd, max_acceptable_lsn, &ft);
+ const char *fn = toku_cachefile_fname_in_env(cf);
+ int r = toku_deserialize_ft_from(fd, fn, max_acceptable_lsn, &ft);
if (r == TOKUDB_BAD_CHECKSUM) {
fprintf(stderr, "Checksum failure while reading header in file %s.\n", toku_cachefile_fname_in_env(cf));
assert(false); // make absolutely sure we crash before doing anything else
diff --git a/storage/tokudb/PerconaFT/ft/node.cc b/storage/tokudb/PerconaFT/ft/node.cc
index 07309ff7f94..ce918940bd7 100644
--- a/storage/tokudb/PerconaFT/ft/node.cc
+++ b/storage/tokudb/PerconaFT/ft/node.cc
@@ -93,6 +93,7 @@ void toku_destroy_ftnode_internals(FTNODE node) {
if (node->height > 0) {
destroy_nonleaf_childinfo(BNC(node,i));
} else {
+ paranoid_invariant(BLB_LRD(node, i) == 0);
destroy_basement_node(BLB(node, i));
}
} else if (BP_STATE(node,i) == PT_COMPRESSED) {
@@ -386,8 +387,7 @@ static void bnc_apply_messages_to_basement_node(
const pivot_bounds &
bounds, // contains pivot key bounds of this basement node
txn_gc_info *gc_info,
- bool *msgs_applied,
- int64_t* logical_rows_delta) {
+ bool *msgs_applied) {
int r;
NONLEAF_CHILDINFO bnc = BNC(ancestor, childnum);
@@ -395,6 +395,7 @@ static void bnc_apply_messages_to_basement_node(
// apply messages from this buffer
STAT64INFO_S stats_delta = {0, 0};
uint64_t workdone_this_ancestor = 0;
+ int64_t logical_rows_delta = 0;
uint32_t stale_lbi, stale_ube;
if (!bn->stale_ancestor_messages_applied) {
@@ -470,7 +471,7 @@ static void bnc_apply_messages_to_basement_node(
gc_info,
&workdone_this_ancestor,
&stats_delta,
- logical_rows_delta);
+ &logical_rows_delta);
}
} else if (stale_lbi == stale_ube) {
// No stale messages to apply, we just apply fresh messages, and mark
@@ -482,7 +483,7 @@ static void bnc_apply_messages_to_basement_node(
.gc_info = gc_info,
.workdone = &workdone_this_ancestor,
.stats_to_update = &stats_delta,
- .logical_rows_delta = logical_rows_delta};
+ .logical_rows_delta = &logical_rows_delta};
if (fresh_ube - fresh_lbi > 0)
*msgs_applied = true;
r = bnc->fresh_message_tree
@@ -503,7 +504,7 @@ static void bnc_apply_messages_to_basement_node(
.gc_info = gc_info,
.workdone = &workdone_this_ancestor,
.stats_to_update = &stats_delta,
- .logical_rows_delta = logical_rows_delta};
+ .logical_rows_delta = &logical_rows_delta};
r = bnc->stale_message_tree
.iterate_on_range<struct iterate_do_bn_apply_msg_extra,
@@ -521,6 +522,8 @@ static void bnc_apply_messages_to_basement_node(
if (stats_delta.numbytes || stats_delta.numrows) {
toku_ft_update_stats(&t->ft->in_memory_stats, stats_delta);
}
+ toku_ft_adjust_logical_row_count(t->ft, logical_rows_delta);
+ bn->logical_rows_delta += logical_rows_delta;
}
static void
@@ -534,7 +537,6 @@ apply_ancestors_messages_to_bn(
bool* msgs_applied
)
{
- int64_t logical_rows_delta = 0;
BASEMENTNODE curr_bn = BLB(node, childnum);
const pivot_bounds curr_bounds = bounds.next_bounds(node, childnum);
for (ANCESTORS curr_ancestors = ancestors; curr_ancestors; curr_ancestors = curr_ancestors->next) {
@@ -547,16 +549,13 @@ apply_ancestors_messages_to_bn(
curr_ancestors->childnum,
curr_bounds,
gc_info,
- msgs_applied,
- &logical_rows_delta
+ msgs_applied
);
// We don't want to check this ancestor node again if the
// next time we query it, the msn hasn't changed.
curr_bn->max_msn_applied = curr_ancestors->node->max_msn_applied_to_node_on_disk;
}
}
- toku_ft_adjust_logical_row_count(t->ft, logical_rows_delta);
- node->logical_rows_delta += logical_rows_delta;
// At this point, we know all the stale messages above this
// basement node have been applied, and any new messages will be
// fresh, so we don't need to look at stale messages for this
diff --git a/storage/tokudb/PerconaFT/ft/node.h b/storage/tokudb/PerconaFT/ft/node.h
index db189e36d59..05c8a44ebed 100644
--- a/storage/tokudb/PerconaFT/ft/node.h
+++ b/storage/tokudb/PerconaFT/ft/node.h
@@ -175,11 +175,6 @@ struct ftnode {
int height;
int dirty;
uint32_t fullhash;
- // current count of rows add or removed as a result of message application
- // to this node as a basement, irrelevant for internal nodes, gets reset
- // when node is undirtied. Used to back out tree scoped LRC id node is
- // evicted but not persisted
- int64_t logical_rows_delta;
// for internal nodes, if n_children==fanout+1 then the tree needs to be
// rebalanced. for leaf nodes, represents number of basement nodes
@@ -211,6 +206,10 @@ struct ftnode_leaf_basement_node {
unsigned int seqinsert; // number of sequential inserts to this leaf
MSN max_msn_applied; // max message sequence number applied
bool stale_ancestor_messages_applied;
+ // current count of rows added or removed as a result of message application
+ // to this basement node, gets reset when node is undirtied.
+ // Used to back out tree scoped LRC id node is evicted but not persisted
+ int64_t logical_rows_delta;
STAT64INFO_S stat64_delta; // change in stat64 counters since basement was last written to disk
};
typedef struct ftnode_leaf_basement_node *BASEMENTNODE;
@@ -385,6 +384,16 @@ enum reactivity toku_ftnode_get_reactivity(FT ft, FTNODE node);
enum reactivity toku_ftnode_get_nonleaf_reactivity(FTNODE node, unsigned int fanout);
enum reactivity toku_ftnode_get_leaf_reactivity(FTNODE node, uint32_t nodesize);
+inline const char* toku_ftnode_get_cachefile_fname_in_env(FTNODE node) {
+ if (node->ct_pair) {
+ CACHEFILE cf = toku_pair_get_cachefile(node->ct_pair);
+ if (cf) {
+ return toku_cachefile_fname_in_env(cf);
+ }
+ }
+ return nullptr;
+}
+
/**
* Finds the next child for HOT to flush to, given that everything up to
* and including k has been flattened.
@@ -577,3 +586,4 @@ static inline void set_BSB(FTNODE node, int i, struct sub_block *sb) {
#define BLB_DATA(node,i) (&(BLB(node,i)->data_buffer))
#define BLB_NBYTESINDATA(node,i) (BLB_DATA(node,i)->get_disk_size())
#define BLB_SEQINSERT(node,i) (BLB(node,i)->seqinsert)
+#define BLB_LRD(node, i) (BLB(node,i)->logical_rows_delta)
diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc b/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc
index 8fcb5293412..fcab9fc675e 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc
+++ b/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.cc
@@ -644,7 +644,29 @@ exit:
// Read ft from file into struct. Read both headers and use one.
// We want the latest acceptable header whose checkpoint_lsn is no later
// than max_acceptable_lsn.
-int toku_deserialize_ft_from(int fd, LSN max_acceptable_lsn, FT *ft) {
+#define dump_state_of_toku_deserialize_ft_from() \
+ fprintf(stderr, \
+ "%s:%d toku_deserialize_ft_from: " \
+ "filename[%s] " \
+ "r[%d] max_acceptable_lsn[%lu]" \
+ "r0[%d] checkpoint_lsn_0[%lu] checkpoint_count_0[%lu] " \
+ "r1[%d] checkpoint_lsn_1[%lu] checkpoint_count_1[%lu]\n", \
+ __FILE__, \
+ __LINE__, \
+ fn, \
+ r, \
+ max_acceptable_lsn.lsn, \
+ r0, \
+ checkpoint_lsn_0.lsn, \
+ checkpoint_count_0, \
+ r1, \
+ checkpoint_lsn_1.lsn, \
+ checkpoint_count_1);
+
+int toku_deserialize_ft_from(int fd,
+ const char *fn,
+ LSN max_acceptable_lsn,
+ FT *ft) {
struct rbuf rb_0;
struct rbuf rb_1;
uint64_t checkpoint_count_0 = 0;
@@ -655,7 +677,7 @@ int toku_deserialize_ft_from(int fd, LSN max_acceptable_lsn, FT *ft) {
bool h0_acceptable = false;
bool h1_acceptable = false;
struct rbuf *rb = NULL;
- int r0, r1, r;
+ int r0, r1, r = 0;
toku_off_t header_0_off = 0;
r0 = deserialize_ft_from_fd_into_rbuf(fd,
@@ -702,6 +724,10 @@ int toku_deserialize_ft_from(int fd, LSN max_acceptable_lsn, FT *ft) {
// first header, unless it's readable
}
+ if (r != TOKUDB_DICTIONARY_NO_HEADER) {
+ dump_state_of_toku_deserialize_ft_from();
+ }
+
// it should not be possible for both headers to be later than the
// max_acceptable_lsn
invariant(
@@ -713,11 +739,19 @@ int toku_deserialize_ft_from(int fd, LSN max_acceptable_lsn, FT *ft) {
if (h0_acceptable && h1_acceptable) {
if (checkpoint_count_0 > checkpoint_count_1) {
+ if (!(checkpoint_count_0 == checkpoint_count_1 + 1) ||
+ !(version_0 >= version_1)) {
+ dump_state_of_toku_deserialize_ft_from();
+ }
invariant(checkpoint_count_0 == checkpoint_count_1 + 1);
invariant(version_0 >= version_1);
rb = &rb_0;
version = version_0;
} else {
+ if (!(checkpoint_count_1 == checkpoint_count_0 + 1) ||
+ !(version_1 >= version_0)) {
+ dump_state_of_toku_deserialize_ft_from();
+ }
invariant(checkpoint_count_1 == checkpoint_count_0 + 1);
invariant(version_1 >= version_0);
rb = &rb_1;
@@ -729,6 +763,7 @@ int toku_deserialize_ft_from(int fd, LSN max_acceptable_lsn, FT *ft) {
fprintf(
stderr,
"Header 2 checksum failed, but header 1 ok. Proceeding.\n");
+ dump_state_of_toku_deserialize_ft_from();
}
rb = &rb_0;
version = version_0;
@@ -738,11 +773,15 @@ int toku_deserialize_ft_from(int fd, LSN max_acceptable_lsn, FT *ft) {
fprintf(
stderr,
"Header 1 checksum failed, but header 2 ok. Proceeding.\n");
+ dump_state_of_toku_deserialize_ft_from();
}
rb = &rb_1;
version = version_1;
}
+ if (!rb) {
+ dump_state_of_toku_deserialize_ft_from();
+ }
paranoid_invariant(rb);
r = deserialize_ft_versioned(fd, rb, ft, version);
diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.h b/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.h
index fe31ff7c5fd..144e188566c 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.h
+++ b/storage/tokudb/PerconaFT/ft/serialize/ft-serialize.h
@@ -42,12 +42,23 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "ft/serialize/block_table.h"
size_t toku_serialize_ft_size(struct ft_header *h);
-void toku_serialize_ft_to(int fd, struct ft_header *h, block_table *bt, CACHEFILE cf);
-void toku_serialize_ft_to_wbuf(struct wbuf *wbuf, struct ft_header *h, DISKOFF translation_location_on_disk, DISKOFF translation_size_on_disk);
-void toku_serialize_descriptor_contents_to_fd(int fd, DESCRIPTOR desc, DISKOFF offset);
-void toku_serialize_descriptor_contents_to_wbuf(struct wbuf *wb, DESCRIPTOR desc);
-
-int toku_deserialize_ft_from(int fd, LSN max_acceptable_lsn, FT *ft);
+void toku_serialize_ft_to(int fd,
+ struct ft_header *h,
+ block_table *bt,
+ CACHEFILE cf);
+void toku_serialize_ft_to_wbuf(struct wbuf *wbuf,
+ struct ft_header *h,
+ DISKOFF translation_location_on_disk,
+ DISKOFF translation_size_on_disk);
+void toku_serialize_descriptor_contents_to_fd(int fd,
+ DESCRIPTOR desc,
+ DISKOFF offset);
+void toku_serialize_descriptor_contents_to_wbuf(struct wbuf *wb,
+ DESCRIPTOR desc);
+int toku_deserialize_ft_from(int fd,
+ const char *fn,
+ LSN max_acceptable_lsn,
+ FT *ft);
// TODO rename
int deserialize_ft_from_fd_into_rbuf(int fd,
diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
index 56876b474d4..55899905baf 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
+++ b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.cc
@@ -830,6 +830,13 @@ int toku_serialize_ftnode_to(int fd,
node->dirty = 0; // See #1957. Must set the node to be clean after
// serializing it so that it doesn't get written again on
// the next checkpoint or eviction.
+ if (node->height == 0) {
+ for (int i = 0; i < node->n_children; i++) {
+ if (BP_STATE(node, i) == PT_AVAIL) {
+ BLB_LRD(node, i) = 0;
+ }
+ }
+ }
return 0;
}
@@ -996,6 +1003,7 @@ BASEMENTNODE toku_clone_bn(BASEMENTNODE orig_bn) {
bn->seqinsert = orig_bn->seqinsert;
bn->stale_ancestor_messages_applied = orig_bn->stale_ancestor_messages_applied;
bn->stat64_delta = orig_bn->stat64_delta;
+ bn->logical_rows_delta = orig_bn->logical_rows_delta;
bn->data_buffer.clone(&orig_bn->data_buffer);
return bn;
}
@@ -1006,6 +1014,7 @@ BASEMENTNODE toku_create_empty_bn_no_buffer(void) {
bn->seqinsert = 0;
bn->stale_ancestor_messages_applied = false;
bn->stat64_delta = ZEROSTATS;
+ bn->logical_rows_delta = 0;
bn->data_buffer.init_zero();
return bn;
}
@@ -1149,15 +1158,25 @@ just_decompress_sub_block(struct sub_block *sb)
}
// verify the checksum
-int
-verify_ftnode_sub_block (struct sub_block *sb)
-{
+int verify_ftnode_sub_block(struct sub_block *sb,
+ const char *fname,
+ BLOCKNUM blocknum) {
int r = 0;
// first verify the checksum
uint32_t data_size = sb->uncompressed_size - 4; // checksum is 4 bytes at end
uint32_t stored_xsum = toku_dtoh32(*((uint32_t *)((char *)sb->uncompressed_ptr + data_size)));
uint32_t actual_xsum = toku_x1764_memory(sb->uncompressed_ptr, data_size);
if (stored_xsum != actual_xsum) {
+ fprintf(
+ stderr,
+ "%s:%d:verify_ftnode_sub_block - "
+ "file[%s], blocknum[%ld], stored_xsum[%u] != actual_xsum[%u]\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ stored_xsum,
+ actual_xsum);
dump_bad_block((Bytef *) sb->uncompressed_ptr, sb->uncompressed_size);
r = TOKUDB_BAD_CHECKSUM;
}
@@ -1165,19 +1184,27 @@ verify_ftnode_sub_block (struct sub_block *sb)
}
// This function deserializes the data stored by serialize_ftnode_info
-static int
-deserialize_ftnode_info(
- struct sub_block *sb,
- FTNODE node
- )
-{
+static int deserialize_ftnode_info(struct sub_block *sb, FTNODE node) {
+
// sb_node_info->uncompressed_ptr stores the serialized node information
// this function puts that information into node
// first verify the checksum
int r = 0;
- r = verify_ftnode_sub_block(sb);
+ const char *fname = toku_ftnode_get_cachefile_fname_in_env(node);
+ r = verify_ftnode_sub_block(sb, fname, node->blocknum);
if (r != 0) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_info - "
+ "file[%s], blocknum[%ld], verify_ftnode_sub_block failed with %d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ node->blocknum.b,
+ r);
+ dump_bad_block(static_cast<unsigned char *>(sb->uncompressed_ptr),
+ sb->uncompressed_size);
goto exit;
}
@@ -1223,6 +1250,16 @@ deserialize_ftnode_info(
// make sure that all the data was read
if (data_size != rb.ndone) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_info - "
+ "file[%s], blocknum[%ld], data_size[%d] != rb.ndone[%d]\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ node->blocknum.b,
+ data_size,
+ rb.ndone);
dump_bad_block(rb.buf, rb.size);
abort();
}
@@ -1339,17 +1376,25 @@ static void setup_ftnode_partitions(FTNODE node, ftnode_fetch_extra *bfe, bool d
/* deserialize the partition from the sub-block's uncompressed buffer
* and destroy the uncompressed buffer
*/
-static int
-deserialize_ftnode_partition(
+static int deserialize_ftnode_partition(
struct sub_block *sb,
FTNODE node,
- int childnum, // which partition to deserialize
- const toku::comparator &cmp
- )
-{
+ int childnum, // which partition to deserialize
+ const toku::comparator &cmp) {
+
int r = 0;
- r = verify_ftnode_sub_block(sb);
+ const char *fname = toku_ftnode_get_cachefile_fname_in_env(node);
+ r = verify_ftnode_sub_block(sb, fname, node->blocknum);
if (r != 0) {
+ fprintf(stderr,
+ "%s:%d:deserialize_ftnode_partition - "
+ "file[%s], blocknum[%ld], "
+ "verify_ftnode_sub_block failed with %d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ node->blocknum.b,
+ r);
goto exit;
}
uint32_t data_size;
@@ -1362,7 +1407,20 @@ deserialize_ftnode_partition(
ch = rbuf_char(&rb);
if (node->height > 0) {
- assert(ch == FTNODE_PARTITION_MSG_BUFFER);
+ if (ch != FTNODE_PARTITION_MSG_BUFFER) {
+ fprintf(stderr,
+ "%s:%d:deserialize_ftnode_partition - "
+ "file[%s], blocknum[%ld], ch[%d] != "
+ "FTNODE_PARTITION_MSG_BUFFER[%d]\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ node->blocknum.b,
+ ch,
+ FTNODE_PARTITION_MSG_BUFFER);
+ dump_bad_block(rb.buf, rb.size);
+ assert(ch == FTNODE_PARTITION_MSG_BUFFER);
+ }
NONLEAF_CHILDINFO bnc = BNC(node, childnum);
if (node->layout_version_read_from_disk <= FT_LAYOUT_VERSION_26) {
// Layout version <= 26 did not serialize sorted message trees to disk.
@@ -1371,43 +1429,99 @@ deserialize_ftnode_partition(
deserialize_child_buffer(bnc, &rb);
}
BP_WORKDONE(node, childnum) = 0;
- }
- else {
- assert(ch == FTNODE_PARTITION_DMT_LEAVES);
+ } else {
+ if (ch != FTNODE_PARTITION_DMT_LEAVES) {
+ fprintf(stderr,
+ "%s:%d:deserialize_ftnode_partition - "
+ "file[%s], blocknum[%ld], ch[%d] != "
+ "FTNODE_PARTITION_DMT_LEAVES[%d]\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ node->blocknum.b,
+ ch,
+ FTNODE_PARTITION_DMT_LEAVES);
+ dump_bad_block(rb.buf, rb.size);
+ assert(ch == FTNODE_PARTITION_DMT_LEAVES);
+ }
+
BLB_SEQINSERT(node, childnum) = 0;
uint32_t num_entries = rbuf_int(&rb);
// we are now at the first byte of first leafentry
data_size -= rb.ndone; // remaining bytes of leafentry data
BASEMENTNODE bn = BLB(node, childnum);
- bn->data_buffer.deserialize_from_rbuf(num_entries, &rb, data_size, node->layout_version_read_from_disk);
+ bn->data_buffer.deserialize_from_rbuf(
+ num_entries, &rb, data_size, node->layout_version_read_from_disk);
+ }
+ if (rb.ndone != rb.size) {
+ fprintf(stderr,
+ "%s:%d:deserialize_ftnode_partition - "
+ "file[%s], blocknum[%ld], rb.ndone[%d] != rb.size[%d]\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ node->blocknum.b,
+ rb.ndone,
+ rb.size);
+ dump_bad_block(rb.buf, rb.size);
+ assert(rb.ndone == rb.size);
}
- assert(rb.ndone == rb.size);
+
exit:
return r;
}
-static int
-decompress_and_deserialize_worker(struct rbuf curr_rbuf, struct sub_block curr_sb, FTNODE node, int child,
- const toku::comparator &cmp, tokutime_t *decompress_time)
-{
+static int decompress_and_deserialize_worker(struct rbuf curr_rbuf,
+ struct sub_block curr_sb,
+ FTNODE node,
+ int child,
+ const toku::comparator &cmp,
+ tokutime_t *decompress_time) {
int r = 0;
tokutime_t t0 = toku_time_now();
r = read_and_decompress_sub_block(&curr_rbuf, &curr_sb);
- tokutime_t t1 = toku_time_now();
- if (r == 0) {
- // at this point, sb->uncompressed_ptr stores the serialized node partition
- r = deserialize_ftnode_partition(&curr_sb, node, child, cmp);
+ if (r != 0) {
+ const char *fname = toku_ftnode_get_cachefile_fname_in_env(node);
+ fprintf(stderr,
+ "%s:%d:decompress_and_deserialize_worker - "
+ "file[%s], blocknum[%ld], read_and_decompress_sub_block failed "
+ "with %d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ node->blocknum.b,
+ r);
+ dump_bad_block(curr_rbuf.buf, curr_rbuf.size);
+ goto exit;
+ }
+ *decompress_time = toku_time_now() - t0;
+ // at this point, sb->uncompressed_ptr stores the serialized node partition
+ r = deserialize_ftnode_partition(&curr_sb, node, child, cmp);
+ if (r != 0) {
+ const char *fname = toku_ftnode_get_cachefile_fname_in_env(node);
+ fprintf(stderr,
+ "%s:%d:decompress_and_deserialize_worker - "
+ "file[%s], blocknum[%ld], deserialize_ftnode_partition failed "
+ "with %d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ node->blocknum.b,
+ r);
+ dump_bad_block(curr_rbuf.buf, curr_rbuf.size);
+ goto exit;
}
- *decompress_time = t1 - t0;
+exit:
toku_free(curr_sb.uncompressed_ptr);
return r;
}
-static int
-check_and_copy_compressed_sub_block_worker(struct rbuf curr_rbuf, struct sub_block curr_sb, FTNODE node, int child)
-{
+static int check_and_copy_compressed_sub_block_worker(struct rbuf curr_rbuf,
+ struct sub_block curr_sb,
+ FTNODE node,
+ int child) {
int r = 0;
r = read_compressed_sub_block(&curr_rbuf, &curr_sb);
if (r != 0) {
@@ -1419,7 +1533,8 @@ check_and_copy_compressed_sub_block_worker(struct rbuf curr_rbuf, struct sub_blo
bp_sb->compressed_size = curr_sb.compressed_size;
bp_sb->uncompressed_size = curr_sb.uncompressed_size;
bp_sb->compressed_ptr = toku_xmalloc(bp_sb->compressed_size);
- memcpy(bp_sb->compressed_ptr, curr_sb.compressed_ptr, bp_sb->compressed_size);
+ memcpy(
+ bp_sb->compressed_ptr, curr_sb.compressed_ptr, bp_sb->compressed_size);
exit:
return r;
}
@@ -1430,35 +1545,50 @@ static FTNODE alloc_ftnode_for_deserialize(uint32_t fullhash, BLOCKNUM blocknum)
node->fullhash = fullhash;
node->blocknum = blocknum;
node->dirty = 0;
- node->logical_rows_delta = 0;
- node->bp = nullptr;
node->oldest_referenced_xid_known = TXNID_NONE;
+ node->bp = nullptr;
+ node->ct_pair = nullptr;
return node;
}
-static int
-deserialize_ftnode_header_from_rbuf_if_small_enough (FTNODE *ftnode,
- FTNODE_DISK_DATA* ndd,
- BLOCKNUM blocknum,
- uint32_t fullhash,
- ftnode_fetch_extra *bfe,
- struct rbuf *rb,
- int fd)
+static int deserialize_ftnode_header_from_rbuf_if_small_enough(
+ FTNODE *ftnode,
+ FTNODE_DISK_DATA *ndd,
+ BLOCKNUM blocknum,
+ uint32_t fullhash,
+ ftnode_fetch_extra *bfe,
+ struct rbuf *rb,
+ int fd)
// If we have enough information in the rbuf to construct a header, then do so.
// Also fetch in the basement node if needed.
-// Return 0 if it worked. If something goes wrong (including that we are looking at some old data format that doesn't have partitions) then return nonzero.
+// Return 0 if it worked. If something goes wrong (including that we are
+// looking at some old data format that doesn't have partitions) then return
+// nonzero.
{
int r = 0;
tokutime_t t0, t1;
tokutime_t decompress_time = 0;
tokutime_t deserialize_time = 0;
+ // we must get the name from bfe and not through
+ // toku_ftnode_get_cachefile_fname_in_env as the node is not set up yet
+ const char* fname = toku_cachefile_fname_in_env(bfe->ft->cf);
t0 = toku_time_now();
FTNODE node = alloc_ftnode_for_deserialize(fullhash, blocknum);
if (rb->size < 24) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
+ "file[%s], blocknum[%ld], rb->size[%u] < 24\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ rb->size);
+ dump_bad_block(rb->buf, rb->size);
// TODO: What error do we return here?
// Does it even matter?
r = toku_db_badformat();
@@ -1467,14 +1597,45 @@ deserialize_ftnode_header_from_rbuf_if_small_enough (FTNODE *ftnode,
const void *magic;
rbuf_literal_bytes(rb, &magic, 8);
- if (memcmp(magic, "tokuleaf", 8)!=0 &&
- memcmp(magic, "tokunode", 8)!=0) {
+ if (memcmp(magic, "tokuleaf", 8) != 0 &&
+ memcmp(magic, "tokunode", 8) != 0) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
+ "file[%s], blocknum[%ld], unrecognized magic number "
+ "%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ static_cast<const uint8_t*>(magic)[0],
+ static_cast<const uint8_t*>(magic)[1],
+ static_cast<const uint8_t*>(magic)[2],
+ static_cast<const uint8_t*>(magic)[3],
+ static_cast<const uint8_t*>(magic)[4],
+ static_cast<const uint8_t*>(magic)[5],
+ static_cast<const uint8_t*>(magic)[6],
+ static_cast<const uint8_t*>(magic)[7]);
+ dump_bad_block(rb->buf, rb->size);
r = toku_db_badformat();
goto cleanup;
}
node->layout_version_read_from_disk = rbuf_int(rb);
- if (node->layout_version_read_from_disk < FT_FIRST_LAYOUT_VERSION_WITH_BASEMENT_NODES) {
+ if (node->layout_version_read_from_disk <
+ FT_FIRST_LAYOUT_VERSION_WITH_BASEMENT_NODES) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
+ "file[%s], blocknum[%ld], node->layout_version_read_from_disk[%d] "
+ "< FT_FIRST_LAYOUT_VERSION_WITH_BASEMENT_NODES[%d]\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ node->layout_version_read_from_disk,
+ FT_FIRST_LAYOUT_VERSION_WITH_BASEMENT_NODES);
+ dump_bad_block(rb->buf, rb->size);
// This code path doesn't have to worry about upgrade.
r = toku_db_badformat();
goto cleanup;
@@ -1496,10 +1657,24 @@ deserialize_ftnode_header_from_rbuf_if_small_enough (FTNODE *ftnode,
// is too big, we may have a problem, so check that we won't overflow
// while reading the partition locations.
unsigned int nhsize;
- nhsize = serialize_node_header_size(node); // we can do this because n_children is filled in.
+ // we can do this because n_children is filled in.
+ nhsize = serialize_node_header_size(node);
unsigned int needed_size;
- needed_size = nhsize + 12; // we need 12 more so that we can read the compressed block size information that follows for the nodeinfo.
+ // we need 12 more so that we can read the compressed block size information
+ // that follows for the nodeinfo.
+ needed_size = nhsize + 12;
if (needed_size > rb->size) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
+ "file[%s], blocknum[%ld], needed_size[%d] > rb->size[%d]\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ needed_size,
+ rb->size);
+ dump_bad_block(rb->buf, rb->size);
r = toku_db_badformat();
goto cleanup;
}
@@ -1517,6 +1692,16 @@ deserialize_ftnode_header_from_rbuf_if_small_enough (FTNODE *ftnode,
uint32_t stored_checksum;
stored_checksum = rbuf_int(rb);
if (stored_checksum != checksum) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
+ "file[%s], blocknum[%ld], stored_checksum[%d] != checksum[%d]\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ stored_checksum,
+ checksum);
dump_bad_block(rb->buf, rb->size);
r = TOKUDB_BAD_CHECKSUM;
goto cleanup;
@@ -1525,9 +1710,23 @@ deserialize_ftnode_header_from_rbuf_if_small_enough (FTNODE *ftnode,
// Now we want to read the pivot information.
struct sub_block sb_node_info;
sub_block_init(&sb_node_info);
- sb_node_info.compressed_size = rbuf_int(rb); // we'll be able to read these because we checked the size earlier.
+ // we'll be able to read these because we checked the size earlier.
+ sb_node_info.compressed_size = rbuf_int(rb);
sb_node_info.uncompressed_size = rbuf_int(rb);
- if (rb->size-rb->ndone < sb_node_info.compressed_size + 8) {
+ if (rb->size - rb->ndone < sb_node_info.compressed_size + 8) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
+ "file[%s], blocknum[%ld], rb->size[%d] - rb->ndone[%d] < "
+ "sb_node_info.compressed_size[%d] + 8\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ rb->size,
+ rb->ndone,
+ sb_node_info.compressed_size);
+ dump_bad_block(rb->buf, rb->size);
r = toku_db_badformat();
goto cleanup;
}
@@ -1539,8 +1738,20 @@ deserialize_ftnode_header_from_rbuf_if_small_enough (FTNODE *ftnode,
sb_node_info.xsum = rbuf_int(rb);
// let's check the checksum
uint32_t actual_xsum;
- actual_xsum = toku_x1764_memory((char *)sb_node_info.compressed_ptr-8, 8+sb_node_info.compressed_size);
+ actual_xsum = toku_x1764_memory((char *)sb_node_info.compressed_ptr - 8,
+ 8 + sb_node_info.compressed_size);
if (sb_node_info.xsum != actual_xsum) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
+ "file[%s], blocknum[%ld], sb_node_info.xsum[%d] != actual_xsum[%d]\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ sb_node_info.xsum,
+ actual_xsum);
+ dump_bad_block(rb->buf, rb->size);
r = TOKUDB_BAD_CHECKSUM;
goto cleanup;
}
@@ -1550,18 +1761,30 @@ deserialize_ftnode_header_from_rbuf_if_small_enough (FTNODE *ftnode,
toku::scoped_malloc sb_node_info_buf(sb_node_info.uncompressed_size);
sb_node_info.uncompressed_ptr = sb_node_info_buf.get();
tokutime_t decompress_t0 = toku_time_now();
- toku_decompress(
- (Bytef *) sb_node_info.uncompressed_ptr,
- sb_node_info.uncompressed_size,
- (Bytef *) sb_node_info.compressed_ptr,
- sb_node_info.compressed_size
- );
+ toku_decompress((Bytef *)sb_node_info.uncompressed_ptr,
+ sb_node_info.uncompressed_size,
+ (Bytef *)sb_node_info.compressed_ptr,
+ sb_node_info.compressed_size);
tokutime_t decompress_t1 = toku_time_now();
decompress_time = decompress_t1 - decompress_t0;
// at this point sb->uncompressed_ptr stores the serialized node info.
r = deserialize_ftnode_info(&sb_node_info, node);
if (r != 0) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
+ "file[%s], blocknum[%ld], deserialize_ftnode_info failed with "
+ "%d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ r);
+ dump_bad_block(
+ static_cast<unsigned char *>(sb_node_info.uncompressed_ptr),
+ sb_node_info.uncompressed_size);
+ dump_bad_block(rb->buf, rb->size);
goto cleanup;
}
}
@@ -1586,6 +1809,17 @@ deserialize_ftnode_header_from_rbuf_if_small_enough (FTNODE *ftnode,
PAIR_ATTR attr;
r = toku_ftnode_pf_callback(node, *ndd, bfe, fd, &attr);
if (r != 0) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_header_from_rbuf_if_small_enough - "
+ "file[%s], blocknum[%ld], toku_ftnode_pf_callback failed with "
+ "%d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ r);
+ dump_bad_block(rb->buf, rb->size);
goto cleanup;
}
}
@@ -1622,12 +1856,10 @@ cleanup:
// that did not generate MSN's for messages. These new MSN's are
// generated from the root downwards, counting backwards from MIN_MSN
// and persisted in the ft header.
-static int
-deserialize_and_upgrade_internal_node(FTNODE node,
- struct rbuf *rb,
- ftnode_fetch_extra *bfe,
- STAT64INFO info)
-{
+static int deserialize_and_upgrade_internal_node(FTNODE node,
+ struct rbuf *rb,
+ ftnode_fetch_extra *bfe,
+ STAT64INFO info) {
int version = node->layout_version_read_from_disk;
if (version == FT_LAST_LAYOUT_VERSION_WITH_FINGERPRINT) {
@@ -1892,25 +2124,25 @@ deserialize_and_upgrade_leaf_node(FTNODE node,
return r;
}
-static int
-read_and_decompress_block_from_fd_into_rbuf(int fd, BLOCKNUM blocknum,
- DISKOFF offset, DISKOFF size,
- FT ft,
- struct rbuf *rb,
- /* out */ int *layout_version_p);
+static int read_and_decompress_block_from_fd_into_rbuf(
+ int fd,
+ BLOCKNUM blocknum,
+ DISKOFF offset,
+ DISKOFF size,
+ FT ft,
+ struct rbuf *rb,
+ /* out */ int *layout_version_p);
// This function upgrades a version 14 or 13 ftnode to the current
// version. NOTE: This code assumes the first field of the rbuf has
// already been read from the buffer (namely the layout_version of the
// ftnode.)
-static int
-deserialize_and_upgrade_ftnode(FTNODE node,
- FTNODE_DISK_DATA* ndd,
- BLOCKNUM blocknum,
- ftnode_fetch_extra *bfe,
- STAT64INFO info,
- int fd)
-{
+static int deserialize_and_upgrade_ftnode(FTNODE node,
+ FTNODE_DISK_DATA *ndd,
+ BLOCKNUM blocknum,
+ ftnode_fetch_extra *bfe,
+ STAT64INFO info,
+ int fd) {
int r = 0;
int version;
@@ -1929,6 +2161,16 @@ deserialize_and_upgrade_ftnode(FTNODE node,
&rb,
&version);
if (r != 0) {
+ const char* fname = toku_cachefile_fname_in_env(bfe->ft->cf);
+ fprintf(stderr,
+ "%s:%d:deserialize_and_upgrade_ftnode - "
+ "file[%s], blocknum[%ld], "
+ "read_and_decompress_block_from_fd_into_rbuf failed with %d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ r);
goto exit;
}
@@ -1944,6 +2186,21 @@ deserialize_and_upgrade_ftnode(FTNODE node,
// Copy over old version info.
node->layout_version_read_from_disk = rbuf_int(&rb); // 2. layout version
version = node->layout_version_read_from_disk;
+ if (version > FT_LAYOUT_VERSION_14) {
+ const char* fname = toku_cachefile_fname_in_env(bfe->ft->cf);
+ fprintf(stderr,
+ "%s:%d:deserialize_and_upgrade_ftnode - "
+ "file[%s], blocknum[%ld], version[%d] > "
+ "FT_LAYOUT_VERSION_14[%d]\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ version,
+ FT_LAYOUT_VERSION_14);
+ dump_bad_block(rb.buf, rb.size);
+ goto exit;
+ }
assert(version <= FT_LAYOUT_VERSION_14);
// Upgrade the current version number to the current version.
node->layout_version = FT_LAYOUT_VERSION;
@@ -1991,25 +2248,23 @@ exit:
return r;
}
-static int
-deserialize_ftnode_from_rbuf(
- FTNODE *ftnode,
- FTNODE_DISK_DATA* ndd,
- BLOCKNUM blocknum,
- uint32_t fullhash,
- ftnode_fetch_extra *bfe,
- STAT64INFO info,
- struct rbuf *rb,
- int fd
- )
-// Effect: deserializes a ftnode that is in rb (with pointer of rb just past the magic) into a FTNODE.
-{
+// Effect: deserializes a ftnode that is in rb (with pointer of rb just past the
+// magic) into a FTNODE.
+static int deserialize_ftnode_from_rbuf(FTNODE *ftnode,
+ FTNODE_DISK_DATA *ndd,
+ BLOCKNUM blocknum,
+ uint32_t fullhash,
+ ftnode_fetch_extra *bfe,
+ STAT64INFO info,
+ struct rbuf *rb,
+ int fd) {
int r = 0;
struct sub_block sb_node_info;
tokutime_t t0, t1;
tokutime_t decompress_time = 0;
tokutime_t deserialize_time = 0;
+ const char* fname = toku_cachefile_fname_in_env(bfe->ft->cf);
t0 = toku_time_now();
@@ -2019,8 +2274,26 @@ deserialize_ftnode_from_rbuf(
// first thing we do is read the header information
const void *magic;
rbuf_literal_bytes(rb, &magic, 8);
- if (memcmp(magic, "tokuleaf", 8)!=0 &&
- memcmp(magic, "tokunode", 8)!=0) {
+ if (memcmp(magic, "tokuleaf", 8) != 0 &&
+ memcmp(magic, "tokunode", 8) != 0) {
+ fprintf(stderr,
+ "%s:%d:deserialize_ftnode_from_rbuf - "
+ "file[%s], blocknum[%ld], unrecognized magic number "
+ "%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ static_cast<const uint8_t *>(magic)[0],
+ static_cast<const uint8_t *>(magic)[1],
+ static_cast<const uint8_t *>(magic)[2],
+ static_cast<const uint8_t *>(magic)[3],
+ static_cast<const uint8_t *>(magic)[4],
+ static_cast<const uint8_t *>(magic)[5],
+ static_cast<const uint8_t *>(magic)[6],
+ static_cast<const uint8_t *>(magic)[7]);
+ dump_bad_block(rb->buf, rb->size);
+
r = toku_db_badformat();
goto cleanup;
}
@@ -2034,6 +2307,16 @@ deserialize_ftnode_from_rbuf(
// Perform the upgrade.
r = deserialize_and_upgrade_ftnode(node, ndd, blocknum, bfe, info, fd);
if (r != 0) {
+ fprintf(stderr,
+ "%s:%d:deserialize_ftnode_from_rbuf - "
+ "file[%s], blocknum[%ld], deserialize_and_upgrade_ftnode "
+ "failed with %d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ r);
+ dump_bad_block(rb->buf, rb->size);
goto cleanup;
}
@@ -2069,6 +2352,16 @@ deserialize_ftnode_from_rbuf(
uint32_t stored_checksum;
stored_checksum = rbuf_int(rb);
if (stored_checksum != checksum) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_from_rbuf - "
+ "file[%s], blocknum[%ld], stored_checksum[%d] != checksum[%d]\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ stored_checksum,
+ checksum);
dump_bad_block(rb->buf, rb->size);
invariant(stored_checksum == checksum);
}
@@ -2080,34 +2373,61 @@ deserialize_ftnode_from_rbuf(
r = read_and_decompress_sub_block(rb, &sb_node_info);
tokutime_t sb_decompress_t1 = toku_time_now();
decompress_time += sb_decompress_t1 - sb_decompress_t0;
- }
- if (r != 0) {
- goto cleanup;
+ if (r != 0) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_from_rbuf - "
+ "file[%s], blocknum[%ld], read_and_decompress_sub_block failed "
+ "with %d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ r);
+ dump_bad_block(
+ static_cast<unsigned char *>(sb_node_info.uncompressed_ptr),
+ sb_node_info.uncompressed_size);
+ dump_bad_block(rb->buf, rb->size);
+ goto cleanup;
+ }
}
// at this point, sb->uncompressed_ptr stores the serialized node info
r = deserialize_ftnode_info(&sb_node_info, node);
if (r != 0) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_from_rbuf - "
+ "file[%s], blocknum[%ld], deserialize_ftnode_info failed with "
+ "%d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ r);
+ dump_bad_block(rb->buf, rb->size);
goto cleanup;
}
toku_free(sb_node_info.uncompressed_ptr);
- // now that the node info has been deserialized, we can proceed to deserialize
- // the individual sub blocks
+ // now that the node info has been deserialized, we can proceed to
+ // deserialize the individual sub blocks
// setup the memory of the partitions
- // for partitions being decompressed, create either message buffer or basement node
+ // for partitions being decompressed, create either message buffer or
+ // basement node
// for partitions staying compressed, create sub_block
setup_ftnode_partitions(node, bfe, true);
- // This loop is parallelizeable, since we don't have a dependency on the work done so far.
+ // This loop is parallelizeable, since we don't have a dependency on the
+ // work done so far.
for (int i = 0; i < node->n_children; i++) {
- uint32_t curr_offset = BP_START(*ndd,i);
- uint32_t curr_size = BP_SIZE(*ndd,i);
- // the compressed, serialized partitions start at where rb is currently pointing,
- // which would be rb->buf + rb->ndone
+ uint32_t curr_offset = BP_START(*ndd, i);
+ uint32_t curr_size = BP_SIZE(*ndd, i);
+ // the compressed, serialized partitions start at where rb is currently
+ // pointing, which would be rb->buf + rb->ndone
// we need to intialize curr_rbuf to point to this place
- struct rbuf curr_rbuf = {.buf = NULL, .size = 0, .ndone = 0};
+ struct rbuf curr_rbuf = {.buf = nullptr, .size = 0, .ndone = 0};
rbuf_init(&curr_rbuf, rb->buf + curr_offset, curr_size);
//
@@ -2120,26 +2440,45 @@ deserialize_ftnode_from_rbuf(
// of the compressed partitions (also possibly none or possibly all)
// The partitions that we want to decompress and make available
// to the node, we do, the rest we simply copy in compressed
- // form into the node, and set the state of the partition to PT_COMPRESSED
+ // form into the node, and set the state of the partition to
+ // PT_COMPRESSED
//
struct sub_block curr_sb;
sub_block_init(&curr_sb);
- // curr_rbuf is passed by value to decompress_and_deserialize_worker, so there's no ugly race condition.
+ // curr_rbuf is passed by value to decompress_and_deserialize_worker,
+ // so there's no ugly race condition.
// This would be more obvious if curr_rbuf were an array.
// deserialize_ftnode_info figures out what the state
// should be and sets up the memory so that we are ready to use it
- switch (BP_STATE(node,i)) {
- case PT_AVAIL: {
+ switch (BP_STATE(node, i)) {
+ case PT_AVAIL: {
// case where we read and decompress the partition
tokutime_t partition_decompress_time;
- r = decompress_and_deserialize_worker(curr_rbuf, curr_sb, node, i,
- bfe->ft->cmp, &partition_decompress_time);
+ r = decompress_and_deserialize_worker(
+ curr_rbuf,
+ curr_sb,
+ node,
+ i,
+ bfe->ft->cmp,
+ &partition_decompress_time);
decompress_time += partition_decompress_time;
if (r != 0) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_from_rbuf - "
+ "file[%s], blocknum[%ld], childnum[%d], "
+ "decompress_and_deserialize_worker failed with %d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ i,
+ r);
+ dump_bad_block(rb->buf, rb->size);
goto cleanup;
}
break;
@@ -2148,6 +2487,19 @@ deserialize_ftnode_from_rbuf(
// case where we leave the partition in the compressed state
r = check_and_copy_compressed_sub_block_worker(curr_rbuf, curr_sb, node, i);
if (r != 0) {
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_from_rbuf - "
+ "file[%s], blocknum[%ld], childnum[%d], "
+ "check_and_copy_compressed_sub_block_worker failed with "
+ "%d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ i,
+ r);
+ dump_bad_block(rb->buf, rb->size);
goto cleanup;
}
break;
@@ -2259,8 +2611,10 @@ toku_deserialize_bp_from_disk(FTNODE node, FTNODE_DISK_DATA ndd, int childnum, i
}
// Take a ftnode partition that is in the compressed state, and make it avail
-int
-toku_deserialize_bp_from_compressed(FTNODE node, int childnum, ftnode_fetch_extra *bfe) {
+int toku_deserialize_bp_from_compressed(FTNODE node,
+ int childnum,
+ ftnode_fetch_extra *bfe) {
+
int r = 0;
assert(BP_STATE(node, childnum) == PT_COMPRESSED);
SUB_BLOCK curr_sb = BSB(node, childnum);
@@ -2275,16 +2629,30 @@ toku_deserialize_bp_from_compressed(FTNODE node, int childnum, ftnode_fetch_extr
// decompress the sub_block
tokutime_t t0 = toku_time_now();
- toku_decompress(
- (Bytef *) curr_sb->uncompressed_ptr,
- curr_sb->uncompressed_size,
- (Bytef *) curr_sb->compressed_ptr,
- curr_sb->compressed_size
- );
+ toku_decompress((Bytef *)curr_sb->uncompressed_ptr,
+ curr_sb->uncompressed_size,
+ (Bytef *)curr_sb->compressed_ptr,
+ curr_sb->compressed_size);
tokutime_t t1 = toku_time_now();
r = deserialize_ftnode_partition(curr_sb, node, childnum, bfe->ft->cmp);
+ if (r != 0) {
+ const char* fname = toku_cachefile_fname_in_env(bfe->ft->cf);
+ fprintf(stderr,
+ "%s:%d:toku_deserialize_bp_from_compressed - "
+ "file[%s], blocknum[%ld], "
+ "deserialize_ftnode_partition failed with %d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ node->blocknum.b,
+ r);
+ dump_bad_block(static_cast<unsigned char *>(curr_sb->compressed_ptr),
+ curr_sb->compressed_size);
+ dump_bad_block(static_cast<unsigned char *>(curr_sb->uncompressed_ptr),
+ curr_sb->uncompressed_size);
+ }
tokutime_t t2 = toku_time_now();
@@ -2299,26 +2667,36 @@ toku_deserialize_bp_from_compressed(FTNODE node, int childnum, ftnode_fetch_extr
return r;
}
-static int
-deserialize_ftnode_from_fd(int fd,
- BLOCKNUM blocknum,
- uint32_t fullhash,
- FTNODE *ftnode,
- FTNODE_DISK_DATA *ndd,
- ftnode_fetch_extra *bfe,
- STAT64INFO info)
-{
+static int deserialize_ftnode_from_fd(int fd,
+ BLOCKNUM blocknum,
+ uint32_t fullhash,
+ FTNODE *ftnode,
+ FTNODE_DISK_DATA *ndd,
+ ftnode_fetch_extra *bfe,
+ STAT64INFO info) {
struct rbuf rb = RBUF_INITIALIZER;
tokutime_t t0 = toku_time_now();
- read_block_from_fd_into_rbuf(fd, blocknum, bfe->ft, &rb);
+ read_block_from_fd_into_rbuf(fd, blocknum, bfe->ft, &rb);
tokutime_t t1 = toku_time_now();
// Decompress and deserialize the ftnode. Time statistics
// are taken inside this function.
- int r = deserialize_ftnode_from_rbuf(ftnode, ndd, blocknum, fullhash, bfe, info, &rb, fd);
+ int r = deserialize_ftnode_from_rbuf(
+ ftnode, ndd, blocknum, fullhash, bfe, info, &rb, fd);
if (r != 0) {
- dump_bad_block(rb.buf,rb.size);
+ const char* fname = toku_cachefile_fname_in_env(bfe->ft->cf);
+ fprintf(
+ stderr,
+ "%s:%d:deserialize_ftnode_from_fd - "
+ "file[%s], blocknum[%ld], deserialize_ftnode_from_rbuf failed with "
+ "%d\n",
+ __FILE__,
+ __LINE__,
+ fname ? fname : "unknown",
+ blocknum.b,
+ r);
+ dump_bad_block(rb.buf, rb.size);
}
bfe->bytes_read = rb.size;
@@ -2327,32 +2705,33 @@ deserialize_ftnode_from_fd(int fd,
return r;
}
-// Read ftnode from file into struct. Perform version upgrade if necessary.
-int
-toku_deserialize_ftnode_from (int fd,
- BLOCKNUM blocknum,
- uint32_t fullhash,
- FTNODE *ftnode,
- FTNODE_DISK_DATA* ndd,
- ftnode_fetch_extra *bfe
- )
// Effect: Read a node in. If possible, read just the header.
-{
+// Perform version upgrade if necessary.
+int toku_deserialize_ftnode_from(int fd,
+ BLOCKNUM blocknum,
+ uint32_t fullhash,
+ FTNODE *ftnode,
+ FTNODE_DISK_DATA *ndd,
+ ftnode_fetch_extra *bfe) {
int r = 0;
struct rbuf rb = RBUF_INITIALIZER;
- // each function below takes the appropriate io/decompression/deserialize statistics
+ // each function below takes the appropriate io/decompression/deserialize
+ // statistics
if (!bfe->read_all_partitions) {
- read_ftnode_header_from_fd_into_rbuf_if_small_enough(fd, blocknum, bfe->ft, &rb, bfe);
- r = deserialize_ftnode_header_from_rbuf_if_small_enough(ftnode, ndd, blocknum, fullhash, bfe, &rb, fd);
+ read_ftnode_header_from_fd_into_rbuf_if_small_enough(
+ fd, blocknum, bfe->ft, &rb, bfe);
+ r = deserialize_ftnode_header_from_rbuf_if_small_enough(
+ ftnode, ndd, blocknum, fullhash, bfe, &rb, fd);
} else {
// force us to do it the old way
r = -1;
}
if (r != 0) {
// Something went wrong, go back to doing it the old way.
- r = deserialize_ftnode_from_fd(fd, blocknum, fullhash, ftnode, ndd, bfe, NULL);
+ r = deserialize_ftnode_from_fd(
+ fd, blocknum, fullhash, ftnode, ndd, bfe, nullptr);
}
toku_free(rb.buf);
@@ -2722,12 +3101,14 @@ static int decompress_from_raw_block_into_rbuf_versioned(uint32_t version, uint8
return r;
}
-static int
-read_and_decompress_block_from_fd_into_rbuf(int fd, BLOCKNUM blocknum,
- DISKOFF offset, DISKOFF size,
- FT ft,
- struct rbuf *rb,
- /* out */ int *layout_version_p) {
+static int read_and_decompress_block_from_fd_into_rbuf(
+ int fd,
+ BLOCKNUM blocknum,
+ DISKOFF offset,
+ DISKOFF size,
+ FT ft,
+ struct rbuf *rb,
+ /* out */ int *layout_version_p) {
int r = 0;
if (0) printf("Deserializing Block %" PRId64 "\n", blocknum.b);
diff --git a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.h b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.h
index 3ad616053e9..678139655f0 100644
--- a/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.h
+++ b/storage/tokudb/PerconaFT/ft/serialize/ft_node-serialize.h
@@ -46,21 +46,51 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include "ft/serialize/block_table.h"
unsigned int toku_serialize_ftnode_size(FTNODE node);
-int toku_serialize_ftnode_to_memory(FTNODE node, FTNODE_DISK_DATA *ndd,
- unsigned int basementnodesize,
- enum toku_compression_method compression_method,
- bool do_rebalancing, bool in_parallel,
- size_t *n_bytes_to_write, size_t *n_uncompressed_bytes,
- char **bytes_to_write);
-int toku_serialize_ftnode_to(int fd, BLOCKNUM, FTNODE node, FTNODE_DISK_DATA *ndd, bool do_rebalancing, FT ft, bool for_checkpoint);
-int toku_serialize_rollback_log_to(int fd, ROLLBACK_LOG_NODE log, SERIALIZED_ROLLBACK_LOG_NODE serialized_log, bool is_serialized,
- FT ft, bool for_checkpoint);
-void toku_serialize_rollback_log_to_memory_uncompressed(ROLLBACK_LOG_NODE log, SERIALIZED_ROLLBACK_LOG_NODE serialized);
-
-int toku_deserialize_rollback_log_from(int fd, BLOCKNUM blocknum, ROLLBACK_LOG_NODE *logp, FT ft);
-int toku_deserialize_bp_from_disk(FTNODE node, FTNODE_DISK_DATA ndd, int childnum, int fd, ftnode_fetch_extra *bfe);
-int toku_deserialize_bp_from_compressed(FTNODE node, int childnum, ftnode_fetch_extra *bfe);
-int toku_deserialize_ftnode_from(int fd, BLOCKNUM off, uint32_t fullhash, FTNODE *node, FTNODE_DISK_DATA *ndd, ftnode_fetch_extra *bfe);
+int toku_serialize_ftnode_to_memory(
+ FTNODE node,
+ FTNODE_DISK_DATA *ndd,
+ unsigned int basementnodesize,
+ enum toku_compression_method compression_method,
+ bool do_rebalancing,
+ bool in_parallel,
+ size_t *n_bytes_to_write,
+ size_t *n_uncompressed_bytes,
+ char **bytes_to_write);
+int toku_serialize_ftnode_to(int fd,
+ BLOCKNUM,
+ FTNODE node,
+ FTNODE_DISK_DATA *ndd,
+ bool do_rebalancing,
+ FT ft,
+ bool for_checkpoint);
+int toku_serialize_rollback_log_to(int fd,
+ ROLLBACK_LOG_NODE log,
+ SERIALIZED_ROLLBACK_LOG_NODE serialized_log,
+ bool is_serialized,
+ FT ft,
+ bool for_checkpoint);
+void toku_serialize_rollback_log_to_memory_uncompressed(
+ ROLLBACK_LOG_NODE log,
+ SERIALIZED_ROLLBACK_LOG_NODE serialized);
+
+int toku_deserialize_rollback_log_from(int fd,
+ BLOCKNUM blocknum,
+ ROLLBACK_LOG_NODE *logp,
+ FT ft);
+int toku_deserialize_bp_from_disk(FTNODE node,
+ FTNODE_DISK_DATA ndd,
+ int childnum,
+ int fd,
+ ftnode_fetch_extra *bfe);
+int toku_deserialize_bp_from_compressed(FTNODE node,
+ int childnum,
+ ftnode_fetch_extra *bfe);
+int toku_deserialize_ftnode_from(int fd,
+ BLOCKNUM off,
+ uint32_t fullhash,
+ FTNODE *node,
+ FTNODE_DISK_DATA *ndd,
+ ftnode_fetch_extra *bfe);
void toku_serialize_set_parallel(bool);
@@ -73,9 +103,14 @@ int decompress_from_raw_block_into_rbuf(uint8_t *raw_block, size_t raw_block_siz
// used by verify
int deserialize_ft_versioned(int fd, struct rbuf *rb, FT *ft, uint32_t version);
-void read_block_from_fd_into_rbuf(int fd, BLOCKNUM blocknum, FT ft, struct rbuf *rb);
+void read_block_from_fd_into_rbuf(int fd,
+ BLOCKNUM blocknum,
+ FT ft,
+ struct rbuf *rb);
int read_compressed_sub_block(struct rbuf *rb, struct sub_block *sb);
-int verify_ftnode_sub_block(struct sub_block *sb);
+int verify_ftnode_sub_block(struct sub_block *sb,
+ const char *fname,
+ BLOCKNUM blocknum);
void just_decompress_sub_block(struct sub_block *sb);
// used by ft-node-deserialize.cc
diff --git a/storage/tokudb/PerconaFT/ft/txn/roll.cc b/storage/tokudb/PerconaFT/ft/txn/roll.cc
index 4f374d62173..97afd2f5bdb 100644
--- a/storage/tokudb/PerconaFT/ft/txn/roll.cc
+++ b/storage/tokudb/PerconaFT/ft/txn/roll.cc
@@ -203,7 +203,7 @@ int toku_rollback_frename(BYTESTRING old_iname,
}
if (toku_stat(new_iname_full.get(), &stat) == -1) {
- if (ENOENT == errno)
+ if (ENOENT == errno || ENAMETOOLONG == errno)
new_exist = false;
else
return 1;
diff --git a/storage/tokudb/PerconaFT/ft/txn/txn.cc b/storage/tokudb/PerconaFT/ft/txn/txn.cc
index 9e48d0d05dd..a3ce6beb7b0 100644
--- a/storage/tokudb/PerconaFT/ft/txn/txn.cc
+++ b/storage/tokudb/PerconaFT/ft/txn/txn.cc
@@ -707,8 +707,8 @@ bool toku_txn_has_spilled_rollback(TOKUTXN txn) {
}
void toku_txn_get_client_id(TOKUTXN txn, uint64_t *client_id, void **client_extra) {
- *client_id = txn->client_id;
- *client_extra = txn->client_extra;
+ if (client_id) *client_id = txn->client_id;
+ if (client_extra) *client_extra = txn->client_extra;
}
void toku_txn_set_client_id(TOKUTXN txn, uint64_t client_id, void *client_extra) {
diff --git a/storage/tokudb/PerconaFT/locktree/lock_request.cc b/storage/tokudb/PerconaFT/locktree/lock_request.cc
index 943362e1b9d..0151b5bd466 100644
--- a/storage/tokudb/PerconaFT/locktree/lock_request.cc
+++ b/storage/tokudb/PerconaFT/locktree/lock_request.cc
@@ -175,7 +175,8 @@ int lock_request::start(void) {
m_state = state::PENDING;
m_start_time = toku_current_time_microsec() / 1000;
m_conflicting_txnid = conflicts.get(0);
- if (m_start_before_pending_test_callback) m_start_before_pending_test_callback();
+ if (m_start_before_pending_test_callback)
+ m_start_before_pending_test_callback();
toku_mutex_lock(&m_info->mutex);
insert_into_lock_requests();
if (deadlock_exists(conflicts)) {
@@ -183,7 +184,8 @@ int lock_request::start(void) {
r = DB_LOCK_DEADLOCK;
}
toku_mutex_unlock(&m_info->mutex);
- if (m_start_test_callback) m_start_test_callback(); // test callback
+ if (m_start_test_callback)
+ m_start_test_callback(); // test callback
}
if (r != DB_LOCK_NOTGRANTED) {
@@ -242,13 +244,13 @@ int lock_request::wait(uint64_t wait_time_ms, uint64_t killed_time_ms, int (*kil
invariant(r == 0 || r == ETIMEDOUT);
t_now = toku_current_time_microsec();
- if (m_state == state::PENDING && t_now >= t_end) {
+ if (m_state == state::PENDING && (t_now >= t_end)) {
m_info->counters.timeout_count += 1;
-
+
// if we're still pending and we timed out, then remove our
// request from the set of lock requests and fail.
remove_from_lock_requests();
-
+
// complete sets m_state to COMPLETE, breaking us out of the loop
complete(DB_LOCK_NOTGRANTED);
}
@@ -297,13 +299,15 @@ TXNID lock_request::get_conflicting_txnid(void) const {
int lock_request::retry(GrowableArray<TXNID> *conflicts_collector) {
invariant(m_state == state::PENDING);
int r;
-
txnid_set conflicts;
conflicts.create();
+
if (m_type == type::WRITE) {
- r = m_lt->acquire_write_lock(m_txnid, m_left_key, m_right_key, &conflicts, m_big_txn);
+ r = m_lt->acquire_write_lock(
+ m_txnid, m_left_key, m_right_key, &conflicts, m_big_txn);
} else {
- r = m_lt->acquire_read_lock(m_txnid, m_left_key, m_right_key, &conflicts, m_big_txn);
+ r = m_lt->acquire_read_lock(
+ m_txnid, m_left_key, m_right_key, &conflicts, m_big_txn);
}
// if the acquisition succeeded then remove ourselves from the
@@ -311,7 +315,8 @@ int lock_request::retry(GrowableArray<TXNID> *conflicts_collector) {
if (r == 0) {
remove_from_lock_requests();
complete(r);
- if (m_retry_test_callback) m_retry_test_callback(); // test callback
+ if (m_retry_test_callback)
+ m_retry_test_callback(); // test callback
toku_cond_broadcast(&m_wait_cond);
} else {
m_conflicting_txnid = conflicts.get(0);
@@ -322,54 +327,78 @@ int lock_request::retry(GrowableArray<TXNID> *conflicts_collector) {
return r;
}
-void lock_request::retry_all_lock_requests(locktree *lt, void (*lock_wait_callback)(void *, TXNID, TXNID), void (*after_retry_all_test_callback)(void)) {
+void lock_request::retry_all_lock_requests(
+ locktree *lt,
+ void (*lock_wait_callback)(void *, TXNID, TXNID),
+ void (*after_retry_all_test_callback)(void)) {
lt_lock_request_info *info = lt->get_lock_request_info();
- info->retry_want++;
-
// if there are no pending lock requests than there is nothing to do
// the unlocked data race on pending_is_empty is OK since lock requests
// are retried after added to the pending set.
if (info->pending_is_empty)
return;
- toku_mutex_lock(&info->mutex);
+ // get my retry generation (post increment of retry_want)
+ unsigned long long my_retry_want = (info->retry_want += 1);
+
+ toku_mutex_lock(&info->retry_mutex);
GrowableArray<TXNID> conflicts_collector;
conflicts_collector.init();
// here is the group retry algorithm.
- // get the latest retry_want count and use it as the generation number of this retry operation.
- // if this retry generation is > the last retry generation, then do the lock retries. otherwise,
- // no lock retries are needed.
- unsigned long long retry_gen = info->retry_want.load();
- if (retry_gen > info->retry_done) {
-
- // retry all of the pending lock requests.
- for (size_t i = 0; i < info->pending_lock_requests.size(); ) {
- lock_request *request;
- int r = info->pending_lock_requests.fetch(i, &request);
- invariant_zero(r);
-
- // retry this lock request. if it didn't succeed,
- // move on to the next lock request. otherwise
- // the request is gone from the list so we may
- // read the i'th entry for the next one.
- r = request->retry(&conflicts_collector);
- if (r != 0) {
- i++;
+ // get the latest retry_want count and use it as the generation number of
+ // this retry operation. if this retry generation is > the last retry
+ // generation, then do the lock retries. otherwise, no lock retries
+ // are needed.
+ if ((my_retry_want - 1) == info->retry_done) {
+ for (;;) {
+ if (!info->running_retry) {
+ info->running_retry = true;
+ info->retry_done = info->retry_want;
+ toku_mutex_unlock(&info->retry_mutex);
+ retry_all_lock_requests_info(info, &conflicts_collector);
+ if (after_retry_all_test_callback)
+ after_retry_all_test_callback();
+ toku_mutex_lock(&info->retry_mutex);
+ info->running_retry = false;
+ toku_cond_broadcast(&info->retry_cv);
+ break;
+ } else {
+ toku_cond_wait(&info->retry_cv, &info->retry_mutex);
}
}
- if (after_retry_all_test_callback) after_retry_all_test_callback();
- info->retry_done = retry_gen;
}
-
- toku_mutex_unlock(&info->mutex);
+ toku_mutex_unlock(&info->retry_mutex);
report_waits(&conflicts_collector, lock_wait_callback);
conflicts_collector.deinit();
}
+void lock_request::retry_all_lock_requests_info(lt_lock_request_info *info, GrowableArray<TXNID> *collector) {
+ toku_mutex_lock(&info->mutex);
+ // retry all of the pending lock requests.
+ for (size_t i = 0; i < info->pending_lock_requests.size();) {
+ lock_request *request;
+ int r = info->pending_lock_requests.fetch(i, &request);
+ invariant_zero(r);
+
+ // retry the lock request. if it didn't succeed,
+ // move on to the next lock request. otherwise
+ // the request is gone from the list so we may
+ // read the i'th entry for the next one.
+ r = request->retry(collector);
+ if (r != 0) {
+ i++;
+ }
+ }
+
+ // future threads should only retry lock requests if some still exist
+ info->should_retry_lock_requests = info->pending_lock_requests.size() > 0;
+ toku_mutex_unlock(&info->mutex);
+}
+
void lock_request::add_conflicts_to_waits(txnid_set *conflicts,
GrowableArray<TXNID> *wait_conflicts) {
size_t num_conflicts = conflicts->size();
@@ -429,7 +458,8 @@ lock_request *lock_request::find_lock_request(const TXNID &txnid) {
void lock_request::insert_into_lock_requests(void) {
uint32_t idx;
lock_request *request;
- int r = m_info->pending_lock_requests.find_zero<TXNID, find_by_txnid>(m_txnid, &request, &idx);
+ int r = m_info->pending_lock_requests.find_zero<TXNID, find_by_txnid>(
+ m_txnid, &request, &idx);
invariant(r == DB_NOTFOUND);
r = m_info->pending_lock_requests.insert_at(this, idx);
invariant_zero(r);
@@ -440,7 +470,8 @@ void lock_request::insert_into_lock_requests(void) {
void lock_request::remove_from_lock_requests(void) {
uint32_t idx;
lock_request *request;
- int r = m_info->pending_lock_requests.find_zero<TXNID, find_by_txnid>(m_txnid, &request, &idx);
+ int r = m_info->pending_lock_requests.find_zero<TXNID, find_by_txnid>(
+ m_txnid, &request, &idx);
invariant_zero(r);
invariant(request == this);
r = m_info->pending_lock_requests.delete_at(idx);
@@ -449,7 +480,8 @@ void lock_request::remove_from_lock_requests(void) {
m_info->pending_is_empty = true;
}
-int lock_request::find_by_txnid(lock_request * const &request, const TXNID &txnid) {
+int lock_request::find_by_txnid(lock_request *const &request,
+ const TXNID &txnid) {
TXNID request_txnid = request->m_txnid;
if (request_txnid < txnid) {
return -1;
diff --git a/storage/tokudb/PerconaFT/locktree/lock_request.h b/storage/tokudb/PerconaFT/locktree/lock_request.h
index 1fa94ef5b96..9e82b31541e 100644
--- a/storage/tokudb/PerconaFT/locktree/lock_request.h
+++ b/storage/tokudb/PerconaFT/locktree/lock_request.h
@@ -108,9 +108,14 @@ public:
TXNID get_conflicting_txnid(void) const;
// effect: Retries all of the lock requests for the given locktree.
- // Any lock requests successfully restarted is completed and woken up.
+ // Any lock requests successfully restarted is completed and woken
+ // up.
// The rest remain pending.
- static void retry_all_lock_requests(locktree *lt, void (*lock_wait_callback)(void *, TXNID, TXNID) = nullptr, void (*after_retry_test_callback)(void) = nullptr);
+ static void retry_all_lock_requests(
+ locktree *lt,
+ void (*lock_wait_callback)(void *, TXNID, TXNID) = nullptr,
+ void (*after_retry_test_callback)(void) = nullptr);
+ static void retry_all_lock_requests_info(lt_lock_request_info *info, GrowableArray<TXNID> *collector);
void set_start_test_callback(void (*f)(void));
void set_start_before_pending_test_callback(void (*f)(void));
@@ -121,7 +126,7 @@ public:
void kill_waiter(void);
static void kill_waiter(locktree *lt, void *extra);
-private:
+ private:
enum state {
UNINITIALIZED,
INITIALIZED,
@@ -193,7 +198,7 @@ private:
void copy_keys(void);
- static int find_by_txnid(lock_request * const &request, const TXNID &txnid);
+ static int find_by_txnid(lock_request *const &request, const TXNID &txnid);
// Report list of conflicts to lock wait callback.
static void report_waits(GrowableArray<TXNID> *wait_conflicts,
diff --git a/storage/tokudb/PerconaFT/locktree/locktree.cc b/storage/tokudb/PerconaFT/locktree/locktree.cc
index 11f8a4e5ff7..2fbf078bdd6 100644
--- a/storage/tokudb/PerconaFT/locktree/locktree.cc
+++ b/storage/tokudb/PerconaFT/locktree/locktree.cc
@@ -80,15 +80,24 @@ void locktree::create(locktree_manager *mgr, DICTIONARY_ID dict_id, const compar
m_sto_end_early_count = 0;
m_sto_end_early_time = 0;
- m_lock_request_info.pending_lock_requests.create();
- m_lock_request_info.pending_is_empty = true;
- ZERO_STRUCT(m_lock_request_info.mutex);
- toku_mutex_init(&m_lock_request_info.mutex, nullptr);
- m_lock_request_info.retry_want = m_lock_request_info.retry_done = 0;
- ZERO_STRUCT(m_lock_request_info.counters);
+ m_lock_request_info.init();
+}
+
+void lt_lock_request_info::init(void) {
+ pending_lock_requests.create();
+ pending_is_empty = true;
+ ZERO_STRUCT(mutex);
+ toku_mutex_init(&mutex, nullptr);
+ retry_want = retry_done = 0;
+ ZERO_STRUCT(counters);
+ ZERO_STRUCT(retry_mutex);
+ toku_mutex_init(&retry_mutex, nullptr);
+ toku_cond_init(&retry_cv, nullptr);
+ running_retry = false;
- TOKU_VALGRIND_HG_DISABLE_CHECKING(&m_lock_request_info.pending_is_empty, sizeof(m_lock_request_info.pending_is_empty));
- TOKU_DRD_IGNORE_VAR(m_lock_request_info.pending_is_empty);
+ TOKU_VALGRIND_HG_DISABLE_CHECKING(&pending_is_empty,
+ sizeof(pending_is_empty));
+ TOKU_DRD_IGNORE_VAR(pending_is_empty);
}
void locktree::destroy(void) {
@@ -98,11 +107,18 @@ void locktree::destroy(void) {
m_rangetree->destroy();
toku_free(m_rangetree);
m_sto_buffer.destroy();
- m_lock_request_info.pending_lock_requests.destroy();
+ m_lock_request_info.destroy();
+}
+
+void lt_lock_request_info::destroy(void) {
+ pending_lock_requests.destroy();
+ toku_mutex_destroy(&mutex);
+ toku_mutex_destroy(&retry_mutex);
+ toku_cond_destroy(&retry_cv);
}
void locktree::add_reference(void) {
- (void) toku_sync_add_and_fetch(&m_reference_count, 1);
+ (void)toku_sync_add_and_fetch(&m_reference_count, 1);
}
uint32_t locktree::release_reference(void) {
diff --git a/storage/tokudb/PerconaFT/locktree/locktree.h b/storage/tokudb/PerconaFT/locktree/locktree.h
index 64171c51b23..1ba7a51b124 100644
--- a/storage/tokudb/PerconaFT/locktree/locktree.h
+++ b/storage/tokudb/PerconaFT/locktree/locktree.h
@@ -41,11 +41,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include <atomic>
#include <db.h>
-#include <toku_time.h>
#include <toku_pthread.h>
+#include <toku_time.h>
-#include <ft/ft-ops.h> // just for DICTIONARY_ID..
#include <ft/comparator.h>
+#include <ft/ft-ops.h> // just for DICTIONARY_ID..
#include <util/omt.h>
@@ -84,20 +84,31 @@ namespace toku {
omt<lock_request *> pending_lock_requests;
std::atomic_bool pending_is_empty;
toku_mutex_t mutex;
+ bool should_retry_lock_requests;
lt_counters counters;
std::atomic_ullong retry_want;
unsigned long long retry_done;
+ toku_mutex_t retry_mutex;
+ toku_cond_t retry_cv;
+ bool running_retry;
+
+ void init(void);
+ void destroy(void);
};
- // The locktree manager manages a set of locktrees, one for each open dictionary.
- // Locktrees are retrieved from the manager. When they are no longer needed, they
- // are be released by the user.
+ // The locktree manager manages a set of locktrees, one for each open
+ // dictionary. Locktrees are retrieved from the manager. When they are no
+ // longer needed, they are be released by the user.
class locktree_manager {
- public:
+ public:
// param: create_cb, called just after a locktree is first created.
// destroy_cb, called just before a locktree is destroyed.
- // escalate_cb, called after a locktree is escalated (with extra param)
- void create(lt_create_cb create_cb, lt_destroy_cb destroy_cb, lt_escalate_cb escalate_cb, void *extra);
+ // escalate_cb, called after a locktree is escalated (with extra
+ // param)
+ void create(lt_create_cb create_cb,
+ lt_destroy_cb destroy_cb,
+ lt_escalate_cb escalate_cb,
+ void *extra);
void destroy(void);
diff --git a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_release_wait.cc b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_release_wait.cc
index eb19ceb70e5..717628f9df7 100644
--- a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_release_wait.cc
+++ b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_release_wait.cc
@@ -1,84 +1,87 @@
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
-// test the race between start, release, and wait. since start does not put its
-// lock request into the pending set, the blocking txn could release its lock before
-// the first txn waits. this will block the first txn because its lock request is
-// not known when the lock is released. the bug fix is to try again when lock retries
-// are locked out.
+// test the race between start, release, and wait. since start does not put
+// its lock request into the pending set, the blocking txn could release its
+// lock before the first txn waits. this will block the first txn because its
+// lock request is not known when the lock is released. the bug fix is to try
+// again when lock retries are locked out.
-#include "locktree.h"
#include "lock_request.h"
-#include "test.h"
-#include "locktree_unit_test.h"
-#include <thread>
#include <atomic>
+#include <thread>
+#include "locktree.h"
+#include "locktree_unit_test.h"
+#include "test.h"
namespace toku {
-const uint64_t my_lock_wait_time = 1000 * 1000; // ms
-const uint64_t my_killed_time = 1 * 1000; // ms
-
-static uint64_t t_wait;
-
-static int my_killed_callback(void) {
- uint64_t t_now = toku_current_time_microsec();
- assert(t_now >= t_wait);
- if (t_now - t_wait >= my_killed_time*1000)
- abort();
- return 0;
-}
-
-static void locktree_release_lock(locktree *lt, TXNID txn_id, const DBT *left, const DBT *right) {
- range_buffer buffer;
- buffer.create();
- buffer.append(left, right);
- lt->release_locks(txn_id, &buffer);
- buffer.destroy();
-}
-
-static void test_start_release_wait(void) {
- int r;
-
- locktree_manager mgr;
- mgr.create(nullptr, nullptr, nullptr, nullptr);
-
- DICTIONARY_ID dict_id = { 1 };
- locktree *lt = mgr.get_lt(dict_id, dbt_comparator, nullptr);
-
- const DBT *one = get_dbt(1);
-
- // a locks one
- lock_request a;
- a.create();
- a.set(lt, 1, one, one, lock_request::type::WRITE, false);
- r = a.start();
- assert(r == 0);
-
- // b tries to lock one, fails
- lock_request b;
- b.create();
- b.set(lt, 2, one, one, lock_request::type::WRITE, false);
- r = b.start();
- assert(r == DB_LOCK_NOTGRANTED);
-
- // a releases its lock
- locktree_release_lock(lt, 1, one, one);
-
- // b waits for one, gets locks immediately
- t_wait = toku_current_time_microsec();
- r = b.wait(my_lock_wait_time, my_killed_time, my_killed_callback);
- assert(r == 0);
-
- // b releases its lock so we can exit cleanly
- locktree_release_lock(lt, 2, one, one);
-
- a.destroy();
- b.destroy();
-
- mgr.release_lt(lt);
- mgr.destroy();
-}
+ const uint64_t my_lock_wait_time = 1000 * 1000; // ms
+ const uint64_t my_killed_time = 1 * 1000; // ms
+
+ static uint64_t t_wait;
+
+ static int my_killed_callback(void) {
+ uint64_t t_now = toku_current_time_microsec();
+ assert(t_now >= t_wait);
+ if (t_now - t_wait >= my_killed_time * 1000)
+ abort();
+ return 0;
+ }
+
+ static void locktree_release_lock(locktree *lt,
+ TXNID txn_id,
+ const DBT *left,
+ const DBT *right) {
+ range_buffer buffer;
+ buffer.create();
+ buffer.append(left, right);
+ lt->release_locks(txn_id, &buffer);
+ buffer.destroy();
+ }
+
+ static void test_start_release_wait(void) {
+ int r;
+
+ locktree_manager mgr;
+ mgr.create(nullptr, nullptr, nullptr, nullptr);
+
+ DICTIONARY_ID dict_id = {1};
+ locktree *lt = mgr.get_lt(dict_id, dbt_comparator, nullptr);
+
+ const DBT *one = get_dbt(1);
+
+ // a locks one
+ lock_request a;
+ a.create();
+ a.set(lt, 1, one, one, lock_request::type::WRITE, false);
+ r = a.start();
+ assert(r == 0);
+
+ // b tries to lock one, fails
+ lock_request b;
+ b.create();
+ b.set(lt, 2, one, one, lock_request::type::WRITE, false);
+ r = b.start();
+ assert(r == DB_LOCK_NOTGRANTED);
+
+ // a releases its lock
+ locktree_release_lock(lt, 1, one, one);
+
+ // b waits for one, gets locks immediately
+ t_wait = toku_current_time_microsec();
+ r = b.wait(my_lock_wait_time, my_killed_time, my_killed_callback);
+ assert(r == 0);
+
+ // b releases its lock so we can exit cleanly
+ locktree_release_lock(lt, 2, one, one);
+
+ a.destroy();
+ b.destroy();
+
+ mgr.release_lt(lt);
+ mgr.destroy();
+ }
} /* namespace toku */
@@ -86,4 +89,3 @@ int main(void) {
toku::test_start_release_wait();
return 0;
}
-
diff --git a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race.cc b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race.cc
index 88493ec9ce0..5c28701c49e 100644
--- a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race.cc
+++ b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race.cc
@@ -34,13 +34,14 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
======= */
-#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
+#ident \
+ "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
+#include "lock_request.h"
#include <iostream>
#include <thread>
-#include "test.h"
#include "locktree.h"
-#include "lock_request.h"
+#include "test.h"
// Test FT-633, the data race on the lock request between ::start and ::retry
// This test is non-deterministic. It uses sleeps at 2 critical places to
@@ -48,57 +49,54 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
namespace toku {
-static void locker_callback(void) {
- usleep(10000);
-}
-
-static void run_locker(locktree *lt, TXNID txnid, const DBT *key) {
- int i;
- for (i = 0; i < 1000; i++) {
-
- lock_request request;
- request.create();
-
- request.set(lt, txnid, key, key, lock_request::type::WRITE, false);
-
- // set the test callbacks
- request.set_start_test_callback(locker_callback);
- request.set_retry_test_callback(locker_callback);
-
- // try to acquire the lock
- int r = request.start();
- if (r == DB_LOCK_NOTGRANTED) {
- // wait for the lock to be granted
- r = request.wait(10 * 1000);
- }
-
- if (r == 0) {
- // release the lock
- range_buffer buffer;
- buffer.create();
- buffer.append(key, key);
- lt->release_locks(txnid, &buffer);
- buffer.destroy();
-
- // retry pending lock requests
- lock_request::retry_all_lock_requests(lt);
+ static void locker_callback(void) { usleep(10000); }
+
+ static void run_locker(locktree *lt, TXNID txnid, const DBT *key) {
+ int i;
+ for (i = 0; i < 1000; i++) {
+ lock_request request;
+ request.create();
+
+ request.set(lt, txnid, key, key, lock_request::type::WRITE, false);
+
+ // set the test callbacks
+ request.set_start_test_callback(locker_callback);
+ request.set_retry_test_callback(locker_callback);
+
+ // try to acquire the lock
+ int r = request.start();
+ if (r == DB_LOCK_NOTGRANTED) {
+ // wait for the lock to be granted
+ r = request.wait(10 * 1000);
+ }
+
+ if (r == 0) {
+ // release the lock
+ range_buffer buffer;
+ buffer.create();
+ buffer.append(key, key);
+ lt->release_locks(txnid, &buffer);
+ buffer.destroy();
+
+ // retry pending lock requests
+ lock_request::retry_all_lock_requests(lt);
+ }
+
+ request.destroy();
+ memset(&request, 0xab, sizeof request);
+
+ toku_pthread_yield();
+ if ((i % 10) == 0)
+ std::cerr << std::this_thread::get_id() << " " << i
+ << std::endl;
}
-
- request.destroy();
- memset(&request, 0xab, sizeof request);
-
- toku_pthread_yield();
- if ((i % 10) == 0)
- std::cout << std::this_thread::get_id() << " " << i << std::endl;
}
-}
} /* namespace toku */
int main(void) {
-
toku::locktree lt;
- DICTIONARY_ID dict_id = { 1 };
+ DICTIONARY_ID dict_id = {1};
lt.create(nullptr, dict_id, toku::dbt_comparator);
const DBT *one = toku::get_dbt(1);
diff --git a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race_3.cc b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race_3.cc
index 8f0d86c9f64..8458bae6b8c 100644
--- a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race_3.cc
+++ b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_race_3.cc
@@ -34,77 +34,82 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
======= */
-#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
+#ident \
+ "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
+#include "lock_request.h"
+#include <pthread.h>
#include <iostream>
#include <thread>
-#include <pthread.h>
-#include "test.h"
#include "locktree.h"
-#include "lock_request.h"
+#include "test.h"
-// Suppose that 3 threads are running a lock acquire, release, retry sequence. There is
-// a race in the retry algorithm with 2 threads running lock retry simultaneously. The
-// first thread to run retry sets a flag that will cause the second thread to skip the
-// lock retries. If the first thread progressed past the contended lock, then the second
-// threa will HANG until its lock timer pops, even when the contended lock is no longer held.
+// Suppose that 3 threads are running a lock acquire, release, retry sequence.
+// There is a race in the retry algorithm with 2 threads running lock retry
+// simultaneously. The first thread to run retry sets a flag that will cause
+// the second thread to skip the lock retries. If the first thread progressed
+// past the contended lock, then the second threa will HANG until its lock timer
+// pops, even when the contended lock is no longer held.
-// This test exposes this problem as a test hang. The group retry algorithm fixes the race
-// in the lock request retry algorihm and this test should no longer hang.
+// This test exposes this problem as a test hang. The group retry algorithm
+// fixes the race in the lock request retry algorihm and this test should no
+// longer hang.
namespace toku {
-// use 1000 when after_retry_all is implemented, otherwise use 100000
-static const int n_tests = 1000; // 100000;
-
-static void after_retry_all(void) {
- usleep(10000);
-}
-
-static void run_locker(locktree *lt, TXNID txnid, const DBT *key, pthread_barrier_t *b) {
- for (int i = 0; i < n_tests; i++) {
- int r;
- r = pthread_barrier_wait(b); assert(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD);
-
- lock_request request;
- request.create();
-
- request.set(lt, txnid, key, key, lock_request::type::WRITE, false);
-
- // try to acquire the lock
- r = request.start();
- if (r == DB_LOCK_NOTGRANTED) {
- // wait for the lock to be granted
- r = request.wait(1000 * 1000);
- }
-
- if (r == 0) {
- // release the lock
- range_buffer buffer;
- buffer.create();
- buffer.append(key, key);
- lt->release_locks(txnid, &buffer);
- buffer.destroy();
-
- // retry pending lock requests
- lock_request::retry_all_lock_requests(lt, nullptr, after_retry_all);
+ // use 1000 when after_retry_all is implemented, otherwise use 100000
+ static const int n_tests = 1000; // 100000;
+
+ static void after_retry_all(void) { usleep(10000); }
+
+ static void run_locker(locktree *lt,
+ TXNID txnid,
+ const DBT *key,
+ pthread_barrier_t *b) {
+ for (int i = 0; i < n_tests; i++) {
+ int r;
+ r = pthread_barrier_wait(b);
+ assert(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD);
+
+ lock_request request;
+ request.create();
+
+ request.set(lt, txnid, key, key, lock_request::type::WRITE, false);
+
+ // try to acquire the lock
+ r = request.start();
+ if (r == DB_LOCK_NOTGRANTED) {
+ // wait for the lock to be granted
+ r = request.wait(1000 * 1000);
+ }
+
+ if (r == 0) {
+ // release the lock
+ range_buffer buffer;
+ buffer.create();
+ buffer.append(key, key);
+ lt->release_locks(txnid, &buffer);
+ buffer.destroy();
+
+ // retry pending lock requests
+ lock_request::retry_all_lock_requests(lt, nullptr, after_retry_all);
+ }
+
+ request.destroy();
+ memset(&request, 0xab, sizeof request);
+
+ toku_pthread_yield();
+ if ((i % 10) == 0)
+ std::cerr << std::this_thread::get_id() << " " << i
+ << std::endl;
}
-
- request.destroy();
- memset(&request, 0xab, sizeof request);
-
- toku_pthread_yield();
- if ((i % 10) == 0)
- std::cout << std::this_thread::get_id() << " " << i << std::endl;
}
-}
} /* namespace toku */
int main(void) {
-
toku::locktree lt;
- DICTIONARY_ID dict_id = { 1 };
+ DICTIONARY_ID dict_id = {1};
lt.create(nullptr, dict_id, toku::dbt_comparator);
const DBT *one = toku::get_dbt(1);
@@ -112,16 +117,17 @@ int main(void) {
const int n_workers = 3;
std::thread worker[n_workers];
pthread_barrier_t b;
- int r = pthread_barrier_init(&b, nullptr, n_workers); assert(r == 0);
+ int r = pthread_barrier_init(&b, nullptr, n_workers);
+ assert(r == 0);
for (int i = 0; i < n_workers; i++) {
worker[i] = std::thread(toku::run_locker, &lt, i, one, &b);
}
for (int i = 0; i < n_workers; i++) {
worker[i].join();
}
- r = pthread_barrier_destroy(&b); assert(r == 0);
+ r = pthread_barrier_destroy(&b);
+ assert(r == 0);
lt.release_reference();
lt.destroy();
return 0;
}
-
diff --git a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_wait_race_2.cc b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_wait_race_2.cc
index a2ceff99edb..4b6dadd440f 100644
--- a/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_wait_race_2.cc
+++ b/storage/tokudb/PerconaFT/locktree/tests/lock_request_start_retry_wait_race_2.cc
@@ -34,78 +34,84 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
======= */
-#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
+#ident \
+ "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
+#include "lock_request.h"
+#include <pthread.h>
#include <iostream>
#include <thread>
-#include <pthread.h>
-#include "test.h"
#include "locktree.h"
-#include "lock_request.h"
+#include "test.h"
-// Suppose that 2 threads are running a lock acquire, release, retry sequence. There is a
-// race between the acquire and the release with 2 threads. If thread 1 acquires a lock,
-// and thread 2 tries to acquire the same lock and fails, thread 1 may release its lock and retry
-// pending lock requests BEFORE thread 2 adds itself to the pending lock requests. If this
-// happens, then thread 2 will HANG until its lock timer expires even when the lock it is
+// Suppose that 2 threads are running a lock acquire, release, retry sequence.
+// There is a race between the acquire and the release with 2 threads.
+// If thread 1 acquires a lock, and thread 2 tries to acquire the same lock and
+// fails, thread 1 may release its lock and retry pending lock requests BEFORE
+// thread 2 adds itself to the pending lock requests. If this happens, then
+// thread 2 will HANG until its lock timer expires even when the lock it is
// waiting for is FREE.
-// This test exposes this problem as a test hang. If the race is fixed, then the test runs to
-// completion.
+// This test exposes this problem as a test hang. If the race is fixed, then
+// the test runs to completion.
namespace toku {
-static void start_before_pending(void) {
- usleep(10000);
-}
-
-static void run_locker(locktree *lt, TXNID txnid, const DBT *key, pthread_barrier_t *b) {
- for (int i = 0; i < 100000; i++) {
- int r;
- r = pthread_barrier_wait(b); assert(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD);
-
- lock_request request;
- request.create();
- request.set(lt, txnid, key, key, lock_request::type::WRITE, false);
-
- // if the callback is included, then the race is easy to reproduce. Otherwise, several
- // test runs may be required before the race happens.
- if (1) request.set_start_before_pending_test_callback(start_before_pending);
-
- // try to acquire the lock
- r = request.start();
- if (r == DB_LOCK_NOTGRANTED) {
- // wait for the lock to be granted
- r = request.wait(1000 * 1000);
+ static void start_before_pending(void) { usleep(10000); }
+
+ static void run_locker(locktree *lt,
+ TXNID txnid,
+ const DBT *key,
+ pthread_barrier_t *b) {
+ for (int i = 0; i < 100000; i++) {
+ int r;
+ r = pthread_barrier_wait(b);
+ assert(r == 0 || r == PTHREAD_BARRIER_SERIAL_THREAD);
+
+ lock_request request;
+ request.create();
+ request.set(lt, txnid, key, key, lock_request::type::WRITE, false);
+
+ // if the callback is included, then the race is easy to reproduce.
+ // Otherwise, several test runs may be required before the race
+ // happens.
+ request.set_start_before_pending_test_callback(
+ start_before_pending);
+
+ // try to acquire the lock
+ r = request.start();
+ if (r == DB_LOCK_NOTGRANTED) {
+ // wait for the lock to be granted
+ r = request.wait(1000 * 1000);
+ }
+
+ if (r == 0) {
+ // release the lock
+ range_buffer buffer;
+ buffer.create();
+ buffer.append(key, key);
+ lt->release_locks(txnid, &buffer);
+ buffer.destroy();
+
+ // retry pending lock requests
+ lock_request::retry_all_lock_requests(lt);
+ }
+
+ request.destroy();
+ memset(&request, 0xab, sizeof request);
+
+ toku_pthread_yield();
+ if ((i % 10) == 0)
+ std::cerr << std::this_thread::get_id() << " " << i
+ << std::endl;
}
-
- if (r == 0) {
- // release the lock
- range_buffer buffer;
- buffer.create();
- buffer.append(key, key);
- lt->release_locks(txnid, &buffer);
- buffer.destroy();
-
- // retry pending lock requests
- lock_request::retry_all_lock_requests(lt);
- }
-
- request.destroy();
- memset(&request, 0xab, sizeof request);
-
- toku_pthread_yield();
- if ((i % 10) == 0)
- std::cout << std::this_thread::get_id() << " " << i << std::endl;
}
-}
} /* namespace toku */
int main(void) {
-
toku::locktree lt;
- DICTIONARY_ID dict_id = { 1 };
+ DICTIONARY_ID dict_id = {1};
lt.create(nullptr, dict_id, toku::dbt_comparator);
const DBT *one = toku::get_dbt(1);
@@ -113,16 +119,17 @@ int main(void) {
const int n_workers = 2;
std::thread worker[n_workers];
pthread_barrier_t b;
- int r = pthread_barrier_init(&b, nullptr, n_workers); assert(r == 0);
+ int r = pthread_barrier_init(&b, nullptr, n_workers);
+ assert(r == 0);
for (int i = 0; i < n_workers; i++) {
worker[i] = std::thread(toku::run_locker, &lt, i, one, &b);
}
for (int i = 0; i < n_workers; i++) {
worker[i].join();
}
- r = pthread_barrier_destroy(&b); assert(r == 0);
+ r = pthread_barrier_destroy(&b);
+ assert(r == 0);
lt.release_reference();
lt.destroy();
return 0;
}
-
diff --git a/storage/tokudb/PerconaFT/portability/toku_debug_sync.h b/storage/tokudb/PerconaFT/portability/toku_debug_sync.h
new file mode 100644
index 00000000000..b5394e58d68
--- /dev/null
+++ b/storage/tokudb/PerconaFT/portability/toku_debug_sync.h
@@ -0,0 +1,77 @@
+/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
+#ident "$Id$"
+/*======
+This file is part of PerconaFT.
+
+
+Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
+
+ PerconaFT is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2,
+ as published by the Free Software Foundation.
+
+ PerconaFT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ PerconaFT is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License, version 3,
+ as published by the Free Software Foundation.
+
+ PerconaFT is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+======= */
+
+#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
+
+#pragma once
+
+struct tokutxn;
+
+#if defined(ENABLED_DEBUG_SYNC)
+
+/*
+ the below macros are defined in my_global.h, which is included in m_string.h,
+ the same macros are defined in TokuSetupCompiler.cmake as compiler options,
+ undefine them here to avoid build errors
+*/
+#undef __STDC_FORMAT_MACROS
+#undef __STDC_LIMIT_MACROS
+
+#include "m_string.h"
+#include "debug_sync.h"
+
+void toku_txn_get_client_id(struct tokutxn *txn,
+ uint64_t *client_id,
+ void **client_extra);
+
+inline void toku_debug_sync(struct tokutxn *txn, const char *sync_point_name) {
+ uint64_t client_id;
+ void *client_extra;
+ THD *thd;
+
+ if (likely(!opt_debug_sync_timeout))
+ return;
+
+ toku_txn_get_client_id(txn, &client_id, &client_extra);
+ thd = reinterpret_cast<THD *>(client_extra);
+ DEBUG_SYNC(thd, sync_point_name);
+}
+
+#else // defined(ENABLED_DEBUG_SYNC)
+
+inline void toku_debug_sync(struct tokutxn *, const char *) {};
+
+#endif // defined(ENABLED_DEBUG_SYNC)
diff --git a/storage/tokudb/PerconaFT/portability/toku_portability.h b/storage/tokudb/PerconaFT/portability/toku_portability.h
index f127b0fe172..28ea8014f53 100644
--- a/storage/tokudb/PerconaFT/portability/toku_portability.h
+++ b/storage/tokudb/PerconaFT/portability/toku_portability.h
@@ -121,6 +121,7 @@ typedef int64_t toku_off_t;
#include "toku_htod.h"
#include "toku_assert.h"
#include "toku_crash.h"
+#include "toku_debug_sync.h"
#define UU(x) x __attribute__((__unused__))
@@ -183,8 +184,10 @@ extern void *realloc(void*, size_t) __THROW __attribute__((__deprecat
# pragma GCC poison u_int32_t
# pragma GCC poison u_int64_t
# pragma GCC poison BOOL
+#if !defined(MYSQL_TOKUDB_ENGINE)
# pragma GCC poison FALSE
# pragma GCC poison TRUE
+#endif // MYSQL_TOKUDB_ENGINE
#endif
#pragma GCC poison __sync_fetch_and_add
#pragma GCC poison __sync_fetch_and_sub
diff --git a/storage/tokudb/PerconaFT/src/tests/test_iterate_live_transactions.cc b/storage/tokudb/PerconaFT/src/tests/test_iterate_live_transactions.cc
index 23c79620cd8..1eb04a06594 100644
--- a/storage/tokudb/PerconaFT/src/tests/test_iterate_live_transactions.cc
+++ b/storage/tokudb/PerconaFT/src/tests/test_iterate_live_transactions.cc
@@ -94,13 +94,13 @@ int test_main(int UU(argc), char *const UU(argv[])) {
r = env->open(env, TOKU_TEST_FILENAME, env_flags, 0755); CKERR(r);
r = env->txn_begin(env, NULL, &txn1, 0); CKERR(r);
- txn1->set_client_id(txn1, 0, NULL);
+ txn1->set_client_id(txn1, 0, nullptr);
txnid1 = txn1->id64(txn1);
r = env->txn_begin(env, NULL, &txn2, 0); CKERR(r);
- txn2->set_client_id(txn2, 1, NULL);
+ txn2->set_client_id(txn2, 1, nullptr);
txnid2 = txn2->id64(txn2);
r = env->txn_begin(env, NULL, &txn3, 0); CKERR(r);
- txn3->set_client_id(txn3, 2, NULL);
+ txn3->set_client_id(txn3, 2, nullptr);
txnid3 = txn3->id64(txn3);
{
diff --git a/storage/tokudb/PerconaFT/src/tests/transactional_fileops.cc b/storage/tokudb/PerconaFT/src/tests/transactional_fileops.cc
index c1e7c5b21c4..858a1d70f7f 100644
--- a/storage/tokudb/PerconaFT/src/tests/transactional_fileops.cc
+++ b/storage/tokudb/PerconaFT/src/tests/transactional_fileops.cc
@@ -87,6 +87,7 @@ setup (void) {
else error_file = stderr;
r=db_env_create(&env, 0); CKERR(r);
+ env->set_dir_per_db(env, true);
env->set_errfile(env, error_file ? error_file : stderr);
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
}
@@ -431,6 +432,14 @@ test_fileops_3(void) {
r = env->dbrename(env, txn_a, "a.db", NULL, "d.db", 0);
CKERR2(r, EEXIST);
+ // verify correct error return code when trying to
+ // rename a dictionary to a name that is beyond the limit
+ // of the operating system.
+ char longname[FILENAME_MAX+11];
+ memset(longname, 'b', FILENAME_MAX+7);
+ memcpy(longname+FILENAME_MAX+7, ".db", 4);
+ r = env->dbrename(env, txn_a, "a.db", NULL, longname, 0);
+ CKERR2(r, ENAMETOOLONG);
r=txn_a->abort(txn_a); CKERR(r);
}
diff --git a/storage/tokudb/PerconaFT/src/ydb.cc b/storage/tokudb/PerconaFT/src/ydb.cc
index 90129aa74c4..1edfe9c81f9 100644
--- a/storage/tokudb/PerconaFT/src/ydb.cc
+++ b/storage/tokudb/PerconaFT/src/ydb.cc
@@ -3073,28 +3073,31 @@ env_dbremove_subdb(DB_ENV * env, DB_TXN * txn, const char *fname, const char *db
// see if we can acquire a table lock for the given dname.
// requires: write lock on dname in the directory. dictionary
// open, close, and begin checkpoint cannot occur.
-// returns: true if we could open, lock, and close a dictionary
-// with the given dname, false otherwise.
-static bool
+// returns: zero if we could open, lock, and close a dictionary
+// with the given dname, errno otherwise.
+static int
can_acquire_table_lock(DB_ENV *env, DB_TXN *txn, const char *iname_in_env) {
int r;
- bool got_lock = false;
DB *db;
r = toku_db_create(&db, env, 0);
assert_zero(r);
r = toku_db_open_iname(db, txn, iname_in_env, 0, 0);
- assert_zero(r);
+ if(r) {
+ if (r == ENAMETOOLONG)
+ toku_ydb_do_error(env, r, "File name too long!\n");
+ goto exit;
+ }
r = toku_db_pre_acquire_table_lock(db, txn);
- if (r == 0) {
- got_lock = true;
- } else {
- got_lock = false;
+ if (r) {
+ r = DB_LOCK_NOTGRANTED;
}
- r = toku_db_close(db);
- assert_zero(r);
-
- return got_lock;
+exit:
+ if(db) {
+ int r2 = toku_db_close(db);
+ assert_zero(r2);
+ }
+ return r;
}
static int
@@ -3307,8 +3310,8 @@ env_dbrename(DB_ENV *env, DB_TXN *txn, const char *fname, const char *dbname, co
// otherwise, we're okay in marking this ft as remove on
// commit. no new handles can open for this dictionary
// because the txn has directory write locks on the dname
- if (txn && !can_acquire_table_lock(env, txn, new_iname.get())) {
- r = DB_LOCK_NOTGRANTED;
+ if (txn) {
+ r = can_acquire_table_lock(env, txn, new_iname.get());
}
// We don't do anything at the ft or cachetable layer for rename.
// We just update entries in the environment's directory.
diff --git a/storage/tokudb/PerconaFT/src/ydb_row_lock.cc b/storage/tokudb/PerconaFT/src/ydb_row_lock.cc
index 597e6311eb8..1d2f4e982f5 100644
--- a/storage/tokudb/PerconaFT/src/ydb_row_lock.cc
+++ b/storage/tokudb/PerconaFT/src/ydb_row_lock.cc
@@ -181,7 +181,16 @@ int toku_db_get_range_lock(DB *db, DB_TXN *txn, const DBT *left_key, const DBT *
request.create();
int r = toku_db_start_range_lock(db, txn, left_key, right_key, lock_type, &request);
if (r == DB_LOCK_NOTGRANTED) {
+ toku_debug_sync(db_txn_struct_i(txn)->tokutxn,
+ "toku_range_lock_before_wait");
r = toku_db_wait_range_lock(db, txn, &request);
+ if (r == DB_LOCK_NOTGRANTED)
+ toku_debug_sync(db_txn_struct_i(txn)->tokutxn,
+ "toku_range_lock_not_granted_after_wait");
+ }
+ else if (r == 0) {
+ toku_debug_sync(db_txn_struct_i(txn)->tokutxn,
+ "toku_range_lock_granted_immediately");
}
request.destroy();
@@ -191,12 +200,13 @@ int toku_db_get_range_lock(DB *db, DB_TXN *txn, const DBT *left_key, const DBT *
// Setup and start an asynchronous lock request.
int toku_db_start_range_lock(DB *db, DB_TXN *txn, const DBT *left_key, const DBT *right_key,
toku::lock_request::type lock_type, toku::lock_request *request) {
- DB_TXN *txn_anc = txn_oldest_ancester(txn);
- TXNID txn_anc_id = txn_anc->id64(txn_anc);
uint64_t client_id;
void *client_extra;
+ DB_TXN *txn_anc = txn_oldest_ancester(txn);
+ TXNID txn_anc_id = txn_anc->id64(txn_anc);
txn->get_client_id(txn, &client_id, &client_extra);
- request->set(db->i->lt, txn_anc_id, left_key, right_key, lock_type, toku_is_big_txn(txn_anc), client_extra);
+ request->set(db->i->lt, txn_anc_id, left_key, right_key, lock_type,
+ toku_is_big_txn(txn_anc), client_extra);
const int r = request->start();
if (r == 0) {
@@ -245,6 +255,8 @@ int toku_db_get_point_write_lock(DB *db, DB_TXN *txn, const DBT *key) {
// acquire a point write lock on the key for a given txn.
// this does not block the calling thread.
void toku_db_grab_write_lock (DB *db, DBT *key, TOKUTXN tokutxn) {
+ uint64_t client_id;
+ void *client_extra;
DB_TXN *txn = toku_txn_get_container_db_txn(tokutxn);
DB_TXN *txn_anc = txn_oldest_ancester(txn);
TXNID txn_anc_id = txn_anc->id64(txn_anc);
@@ -252,10 +264,10 @@ void toku_db_grab_write_lock (DB *db, DBT *key, TOKUTXN tokutxn) {
// This lock request must succeed, so we do not want to wait
toku::lock_request request;
request.create();
- uint64_t client_id;
- void *client_extra;
txn->get_client_id(txn, &client_id, &client_extra);
- request.set(db->i->lt, txn_anc_id, key, key, toku::lock_request::type::WRITE, toku_is_big_txn(txn_anc), client_extra);
+ request.set(db->i->lt, txn_anc_id, key, key,
+ toku::lock_request::type::WRITE, toku_is_big_txn(txn_anc),
+ client_extra);
int r = request.start();
invariant_zero(r);
db_txn_note_row_lock(db, txn_anc, key, key);
diff --git a/storage/tokudb/PerconaFT/tools/CMakeLists.txt b/storage/tokudb/PerconaFT/tools/CMakeLists.txt
index f11b9f350d7..e6540bf69be 100644
--- a/storage/tokudb/PerconaFT/tools/CMakeLists.txt
+++ b/storage/tokudb/PerconaFT/tools/CMakeLists.txt
@@ -6,6 +6,14 @@ foreach(tool ${tools})
add_dependencies(${tool} install_tdb_h)
target_link_libraries(${tool} ${LIBTOKUDB}_static ft_static z lzma snappy ${LIBTOKUPORTABILITY}_static ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_SYSTEM_LIBS})
+ # detect when we are being built as a subproject
+ if (DEFINED MYSQL_PROJECT_NAME_DOCSTRING)
+ if ((CMAKE_BUILD_TYPE MATCHES "Debug") AND
+ (CMAKE_CXX_FLAGS_DEBUG MATCHES " -DENABLED_DEBUG_SYNC"))
+ target_link_libraries(${tool} sql)
+ endif()
+ endif ()
+
add_space_separated_property(TARGET ${tool} COMPILE_FLAGS -fvisibility=hidden)
endforeach(tool)
diff --git a/storage/tokudb/PerconaFT/tools/ftverify.cc b/storage/tokudb/PerconaFT/tools/ftverify.cc
index 2324249ba00..ee40b991ea6 100644
--- a/storage/tokudb/PerconaFT/tools/ftverify.cc
+++ b/storage/tokudb/PerconaFT/tools/ftverify.cc
@@ -325,7 +325,7 @@ check_block(BLOCKNUM blocknum, int64_t UU(blocksize), int64_t UU(address), void
}
just_decompress_sub_block(&sb);
- r = verify_ftnode_sub_block(&sb);
+ r = verify_ftnode_sub_block(&sb, nullptr, blocknum);
if (r != 0) {
printf(" Uncompressed child partition %d checksum failed.\n", i);
failure++;
diff --git a/storage/tokudb/PerconaFT/tools/tokuftdump.cc b/storage/tokudb/PerconaFT/tools/tokuftdump.cc
index f6d777b4161..2838ae5182e 100644
--- a/storage/tokudb/PerconaFT/tools/tokuftdump.cc
+++ b/storage/tokudb/PerconaFT/tools/tokuftdump.cc
@@ -158,7 +158,8 @@ static void dump_descriptor(DESCRIPTOR d) {
static void open_header(int fd, FT *header, CACHEFILE cf) {
FT ft = NULL;
int r;
- r = toku_deserialize_ft_from (fd, MAX_LSN, &ft);
+ const char *fn = toku_cachefile_fname_in_env(cf);
+ r = toku_deserialize_ft_from (fd, fn, MAX_LSN, &ft);
if (r != 0) {
fprintf(stderr, "%s: can not deserialize from %s error %d\n", arg0, fname, r);
exit(1);
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index 962b9928c5e..e6626e5e145 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -532,51 +532,6 @@ typedef struct index_read_info {
DBT* orig_key;
} *INDEX_READ_INFO;
-static int ai_poll_fun(void *extra, float progress) {
- LOADER_CONTEXT context = (LOADER_CONTEXT)extra;
- if (thd_kill_level(context->thd)) {
- sprintf(context->write_status_msg, "The process has been killed, aborting add index.");
- return ER_ABORTING_CONNECTION;
- }
- float percentage = progress * 100;
- sprintf(context->write_status_msg, "Adding of indexes about %.1f%% done", percentage);
- thd_proc_info(context->thd, context->write_status_msg);
-#ifdef HA_TOKUDB_HAS_THD_PROGRESS
- thd_progress_report(context->thd, (unsigned long long) percentage, 100);
-#endif
- return 0;
-}
-
-static int loader_poll_fun(void *extra, float progress) {
- LOADER_CONTEXT context = (LOADER_CONTEXT)extra;
- if (thd_kill_level(context->thd)) {
- sprintf(context->write_status_msg, "The process has been killed, aborting bulk load.");
- return ER_ABORTING_CONNECTION;
- }
- float percentage = progress * 100;
- sprintf(context->write_status_msg, "Loading of data about %.1f%% done", percentage);
- thd_proc_info(context->thd, context->write_status_msg);
-#ifdef HA_TOKUDB_HAS_THD_PROGRESS
- thd_progress_report(context->thd, (unsigned long long) percentage, 100);
-#endif
- return 0;
-}
-
-static void loader_ai_err_fun(DB *db, int i, int err, DBT *key, DBT *val, void *error_extra) {
- LOADER_CONTEXT context = (LOADER_CONTEXT)error_extra;
- assert_always(context->ha);
- context->ha->set_loader_error(err);
-}
-
-static void loader_dup_fun(DB *db, int i, int err, DBT *key, DBT *val, void *error_extra) {
- LOADER_CONTEXT context = (LOADER_CONTEXT)error_extra;
- assert_always(context->ha);
- context->ha->set_loader_error(err);
- if (err == DB_KEYEXIST) {
- context->ha->set_dup_value_for_pk(key);
- }
-}
-
//
// smart DBT callback function for optimize
// in optimize, we want to flatten DB by doing
@@ -3397,11 +3352,13 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) {
lc.thd = thd;
lc.ha = this;
-
- error = loader->set_poll_function(loader, loader_poll_fun, &lc);
+
+ error = loader->set_poll_function(
+ loader, ha_tokudb::bulk_insert_poll, &lc);
assert_always(!error);
- error = loader->set_error_callback(loader, loader_dup_fun, &lc);
+ error = loader->set_error_callback(
+ loader, ha_tokudb::loader_dup, &lc);
assert_always(!error);
trx->stmt_progress.using_loader = true;
@@ -3414,6 +3371,47 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) {
}
TOKUDB_HANDLER_DBUG_VOID_RETURN;
}
+int ha_tokudb::bulk_insert_poll(void* extra, float progress) {
+ LOADER_CONTEXT context = (LOADER_CONTEXT)extra;
+ if (thd_killed(context->thd)) {
+ sprintf(context->write_status_msg,
+ "The process has been killed, aborting bulk load.");
+ return ER_ABORTING_CONNECTION;
+ }
+ float percentage = progress * 100;
+ sprintf(context->write_status_msg,
+ "Loading of data t %s about %.1f%% done",
+ context->ha->share->full_table_name(),
+ percentage);
+ thd_proc_info(context->thd, context->write_status_msg);
+#ifdef HA_TOKUDB_HAS_THD_PROGRESS
+ thd_progress_report(context->thd, (unsigned long long)percentage, 100);
+#endif
+ return 0;
+}
+void ha_tokudb::loader_add_index_err(DB* db,
+ int i,
+ int err,
+ DBT* key,
+ DBT* val,
+ void* error_extra) {
+ LOADER_CONTEXT context = (LOADER_CONTEXT)error_extra;
+ assert_always(context->ha);
+ context->ha->set_loader_error(err);
+}
+void ha_tokudb::loader_dup(DB* db,
+ int i,
+ int err,
+ DBT* key,
+ DBT* val,
+ void* error_extra) {
+ LOADER_CONTEXT context = (LOADER_CONTEXT)error_extra;
+ assert_always(context->ha);
+ context->ha->set_loader_error(err);
+ if (err == DB_KEYEXIST) {
+ context->ha->set_dup_value_for_pk(key);
+ }
+}
//
// Method that is called at the end of many calls to insert rows
@@ -8192,12 +8190,14 @@ int ha_tokudb::tokudb_add_index(
goto cleanup;
}
- error = indexer->set_poll_function(indexer, ai_poll_fun, &lc);
+ error = indexer->set_poll_function(
+ indexer, ha_tokudb::tokudb_add_index_poll, &lc);
if (error) {
goto cleanup;
}
- error = indexer->set_error_callback(indexer, loader_ai_err_fun, &lc);
+ error = indexer->set_error_callback(
+ indexer, ha_tokudb::loader_add_index_err, &lc);
if (error) {
goto cleanup;
}
@@ -8252,12 +8252,14 @@ int ha_tokudb::tokudb_add_index(
goto cleanup;
}
- error = loader->set_poll_function(loader, loader_poll_fun, &lc);
+ error =
+ loader->set_poll_function(loader, ha_tokudb::bulk_insert_poll, &lc);
if (error) {
goto cleanup;
}
- error = loader->set_error_callback(loader, loader_ai_err_fun, &lc);
+ error = loader->set_error_callback(
+ loader, ha_tokudb::loader_add_index_err, &lc);
if (error) {
goto cleanup;
}
@@ -8464,6 +8466,24 @@ cleanup:
thd_proc_info(thd, orig_proc_info);
TOKUDB_HANDLER_DBUG_RETURN(error ? error : loader_error);
}
+int ha_tokudb::tokudb_add_index_poll(void* extra, float progress) {
+ LOADER_CONTEXT context = (LOADER_CONTEXT)extra;
+ if (thd_killed(context->thd)) {
+ sprintf(context->write_status_msg,
+ "The process has been killed, aborting add index.");
+ return ER_ABORTING_CONNECTION;
+ }
+ float percentage = progress * 100;
+ sprintf(context->write_status_msg,
+ "Adding of indexes to %s about %.1f%% done",
+ context->ha->share->full_table_name(),
+ percentage);
+ thd_proc_info(context->thd, context->write_status_msg);
+#ifdef HA_TOKUDB_HAS_THD_PROGRESS
+ thd_progress_report(context->thd, (unsigned long long)percentage, 100);
+#endif
+ return 0;
+}
//
// Internal function called by ha_tokudb::add_index and ha_tokudb::alter_table_phase2
diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h
index 4a7e395d0d1..3891e57738b 100644
--- a/storage/tokudb/ha_tokudb.h
+++ b/storage/tokudb/ha_tokudb.h
@@ -799,6 +799,19 @@ public:
#else
void start_bulk_insert(ha_rows rows);
#endif
+ static int bulk_insert_poll(void* extra, float progress);
+ static void loader_add_index_err(DB* db,
+ int i,
+ int err,
+ DBT* key,
+ DBT* val,
+ void* error_extra);
+ static void loader_dup(DB* db,
+ int i,
+ int err,
+ DBT* key,
+ DBT* val,
+ void* error_extra);
int end_bulk_insert();
int end_bulk_insert(bool abort);
@@ -938,17 +951,23 @@ public:
#endif
private:
- int tokudb_add_index(
- TABLE *table_arg,
- KEY *key_info,
- uint num_of_keys,
- DB_TXN* txn,
- bool* inc_num_DBs,
- bool* modified_DB
- );
- void restore_add_index(TABLE* table_arg, uint num_of_keys, bool incremented_numDBs, bool modified_DBs);
- int drop_indexes(TABLE *table_arg, uint *key_num, uint num_of_keys, KEY *key_info, DB_TXN* txn);
- void restore_drop_indexes(TABLE *table_arg, uint *key_num, uint num_of_keys);
+ int tokudb_add_index(TABLE* table_arg,
+ KEY* key_info,
+ uint num_of_keys,
+ DB_TXN* txn,
+ bool* inc_num_DBs,
+ bool* modified_DB);
+ static int tokudb_add_index_poll(void *extra, float progress);
+ void restore_add_index(TABLE* table_arg,
+ uint num_of_keys,
+ bool incremented_numDBs,
+ bool modified_DBs);
+ int drop_indexes(TABLE* table_arg,
+ uint* key_num,
+ uint num_of_keys,
+ KEY* key_info,
+ DB_TXN* txn);
+ void restore_drop_indexes(TABLE* table_arg, uint* key_num, uint num_of_keys);
public:
// delete all rows from the table
diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc
index 1154840bf3c..7b44044bd81 100644
--- a/storage/tokudb/hatoku_hton.cc
+++ b/storage/tokudb/hatoku_hton.cc
@@ -55,7 +55,7 @@ static bool tokudb_show_status(
static void tokudb_handle_fatal_signal(handlerton* hton, THD* thd, int sig);
#endif
static int tokudb_close_connection(handlerton* hton, THD* thd);
-static void tokudb_kill_query(handlerton *hton, THD *thd, enum thd_kill_levels level);
+static void tokudb_kill_connection(handlerton *hton, THD *thd, enum thd_kill_levels level);
static int tokudb_commit(handlerton* hton, THD* thd, bool all);
static int tokudb_rollback(handlerton* hton, THD* thd, bool all);
#if TOKU_INCLUDE_XA
@@ -337,7 +337,7 @@ static int tokudb_init_func(void *p) {
tokudb_hton->create = tokudb_create_handler;
tokudb_hton->close_connection = tokudb_close_connection;
- tokudb_hton->kill_query = tokudb_kill_query;
+ tokudb_hton->kill_query = tokudb_kill_connection;
tokudb_hton->savepoint_offset = sizeof(SP_INFO_T);
tokudb_hton->savepoint_set = tokudb_savepoint;
@@ -762,7 +762,8 @@ static int tokudb_close_connection(handlerton* hton, THD* thd) {
return error;
}
-void tokudb_kill_query(handlerton *hton, THD *thd, enum thd_kill_levels level) {
+void tokudb_kill_connection(handlerton *hton, THD *thd,
+ enum thd_kill_levels level) {
TOKUDB_DBUG_ENTER("");
db_env->kill_waiter(db_env, thd);
DBUG_VOID_RETURN;
diff --git a/storage/tokudb/mysql-test/rpl/include/rpl_tokudb_row_img_general_loop.inc b/storage/tokudb/mysql-test/rpl/include/rpl_tokudb_row_img_general_loop.inc
new file mode 100644
index 00000000000..321f09353a1
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/include/rpl_tokudb_row_img_general_loop.inc
@@ -0,0 +1,42 @@
+#
+# This is a helper script for rpl_row_img.test. It creates
+# all combinations MyISAM / InnoDB in a three server replication
+# chain. Each engine combination is tested against the current
+# seetings for binlog_row_image (on each server).
+#
+# The test script that is executed on every combination is the
+# only argument to this wrapper script. See below.
+#
+# This script takes one parameter:
+# - $row_img_test_script
+# the name of the test script to include in every combination
+#
+# Sample usage:
+# -- let $row_img_test_script= extra/rpl_tests/rpl_row_img.test
+# -- source include/rpl_row_img_general_loop.test
+
+
+-- let $engine_type_a= 2
+-- let $server_1_engine= TokuDB
+while($engine_type_a)
+{
+ -- let $engine_type_b= 2
+ -- let $server_2_engine= TokuDB
+ while($engine_type_b)
+ {
+ -- let $engine_type_c= 2
+ -- let $server_3_engine= TokuDB
+ while($engine_type_c)
+ {
+ -- echo ### engines: $server_1_engine, $server_2_engine, $server_3_engine
+ -- source $row_img_test_script
+
+ -- let $server_3_engine= InnoDB
+ -- dec $engine_type_c
+ }
+ -- let $server_2_engine= InnoDB
+ -- dec $engine_type_b
+ }
+ -- let $server_1_engine= InnoDB
+ -- dec $engine_type_a
+}
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_update_pk_uc0_lookup0.result b/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_update_pk_uc0_lookup0.result
index daa04e5f43e..8bb426d9448 100644
--- a/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_update_pk_uc0_lookup0.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_update_pk_uc0_lookup0.result
@@ -18,8 +18,10 @@ update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
-select unix_timestamp() into @tstart;
-select unix_timestamp() into @tend;
+# select unix_timestamp() into @tstart;
+# Commented out for MariaDB
+# select unix_timestamp() into @tend;
+# select @tend-@tstart <= 5; # assert no delay in the delete time
select * from t;
a b
1 3
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_write_pk.result b/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_write_pk.result
index 518d3318710..ca547e34be2 100644
--- a/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_write_pk.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_parallel_tokudb_write_pk.result
@@ -6,7 +6,6 @@ Variable_name Value
tokudb_rpl_unique_checks OFF
tokudb_rpl_unique_checks_delay 5000
create table t (a bigint not null, primary key(a)) engine=tokudb;
-select unix_timestamp() into @tstart;
insert into t values (1);
insert into t values (2),(3);
insert into t values (4);
diff --git a/storage/tokudb/mysql-test/tokudb_rpl/r/rpl_rfr_disable_on_expl_pk_absence.result b/storage/tokudb/mysql-test/rpl/r/rpl_rfr_disable_on_expl_pk_absence.result
index 2977dc859f5..2977dc859f5 100644
--- a/storage/tokudb/mysql-test/tokudb_rpl/r/rpl_rfr_disable_on_expl_pk_absence.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_rfr_disable_on_expl_pk_absence.result
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_commit_after_flush.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_commit_after_flush.result
new file mode 100644
index 00000000000..d72837498cd
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_commit_after_flush.result
@@ -0,0 +1,10 @@
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1 (a INT) ENGINE=tokudb;
+begin;
+insert into t1 values(1);
+flush tables with read lock;
+commit;
+unlock tables;
+drop table t1;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_insert_id.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_insert_id.result
new file mode 100644
index 00000000000..fdff14d3cdc
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_insert_id.result
@@ -0,0 +1,530 @@
+#
+# Setup
+#
+#
+# See if queries that use both auto_increment and LAST_INSERT_ID()
+# are replicated well
+#
+# We also check how the foreign_key_check variable is replicated
+#
+include/master-slave.inc
+[connection master]
+SET @old_concurrent_insert= @@global.concurrent_insert;
+SET @@global.concurrent_insert= 0;
+create table t1(a int auto_increment, key(a)) engine=tokudb;
+create table t2(b int auto_increment, c int, key(b)) engine=tokudb;
+insert into t1 values (1),(2),(3);
+insert into t1 values (null);
+insert into t2 values (null,last_insert_id());
+select * from t1 ORDER BY a;
+a
+1
+2
+3
+4
+select * from t2 ORDER BY b;
+b c
+1 4
+drop table t1;
+drop table t2;
+create table t1(a int auto_increment, key(a)) engine=tokudb;
+create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=tokudb;
+SET FOREIGN_KEY_CHECKS=0;
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 values (null,last_insert_id());
+SET FOREIGN_KEY_CHECKS=1;
+select * from t1;
+a
+10
+11
+12
+13
+select * from t2;
+b c
+5 0
+6 11
+#
+# check if INSERT SELECT in auto_increment is well replicated (bug #490)
+#
+drop table t2;
+drop table t1;
+create table t1(a int auto_increment, key(a)) engine=tokudb;
+create table t2(b int auto_increment, c int, key(b)) engine=tokudb;
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 (c) select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
+b c
+5 0
+6 10
+7 11
+8 12
+9 13
+select * from t1 ORDER BY a;
+a
+10
+11
+12
+13
+select * from t2 ORDER BY b;
+b c
+5 0
+6 10
+7 11
+8 12
+9 13
+drop table t1;
+drop table t2;
+#
+# Bug#8412: Error codes reported in binary log for CHARACTER SET,
+# FOREIGN_KEY_CHECKS
+#
+SET TIMESTAMP=1000000000;
+CREATE TABLE t1 ( a INT UNIQUE ) engine=tokudb;
+SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO t1 VALUES (1),(1);
+Got one of the listed errors
+drop table t1;
+#
+# Bug#14553: NULL in WHERE resets LAST_INSERT_ID
+#
+set @@session.sql_auto_is_null=1;
+create table t1(a int auto_increment, key(a)) engine=tokudb;
+create table t2(a int) engine=tokudb;
+insert into t1 (a) values (null);
+insert into t2 (a) select a from t1 where a is null;
+insert into t2 (a) select a from t1 where a is null;
+select * from t2;
+a
+1
+select * from t2;
+a
+1
+drop table t1;
+drop table t2;
+#
+# End of 4.1 tests
+#
+#
+# BUG#15728: LAST_INSERT_ID function inside a stored function returns 0
+#
+# The solution is not to reset last_insert_id on enter to sub-statement.
+#
+drop function if exists bug15728;
+drop function if exists bug15728_insert;
+drop table if exists t1, t2;
+create table t1 (
+id int not null auto_increment,
+last_id int,
+primary key (id)
+) engine=tokudb;
+create function bug15728() returns int(11)
+return last_insert_id();
+insert into t1 (last_id) values (0);
+insert into t1 (last_id) values (last_insert_id());
+insert into t1 (last_id) values (bug15728());
+create table t2 (
+id int not null auto_increment,
+last_id int,
+primary key (id)
+) engine=tokudb;
+create function bug15728_insert() returns int(11) modifies sql data
+begin
+insert into t2 (last_id) values (bug15728());
+return bug15728();
+end|
+create trigger t1_bi before insert on t1 for each row
+begin
+declare res int;
+select bug15728_insert() into res;
+set NEW.last_id = res;
+end|
+insert into t1 (last_id) values (0);
+drop trigger t1_bi;
+select last_insert_id();
+last_insert_id()
+4
+select bug15728_insert();
+bug15728_insert()
+2
+select last_insert_id();
+last_insert_id()
+4
+insert into t1 (last_id) values (bug15728());
+select last_insert_id();
+last_insert_id()
+5
+drop procedure if exists foo;
+create procedure foo()
+begin
+declare res int;
+insert into t2 (last_id) values (bug15728());
+insert into t1 (last_id) values (bug15728());
+end|
+call foo();
+select * from t1;
+id last_id
+1 0
+2 1
+3 2
+4 1
+5 4
+6 3
+select * from t2;
+id last_id
+1 3
+2 4
+3 5
+select * from t1;
+id last_id
+1 0
+2 1
+3 2
+4 1
+5 4
+6 3
+select * from t2;
+id last_id
+1 3
+2 4
+3 5
+drop function bug15728;
+drop function bug15728_insert;
+drop table t1,t2;
+drop procedure foo;
+create table t1 (n int primary key auto_increment not null,
+b int, unique(b)) engine=tokudb;
+set sql_log_bin=0;
+insert into t1 values(null,100);
+replace into t1 values(null,50),(null,100),(null,150);
+select * from t1 order by n;
+n b
+2 50
+3 100
+4 150
+truncate table t1;
+set sql_log_bin=1;
+insert into t1 values(null,100);
+select * from t1 order by n;
+n b
+1 100
+insert into t1 values(null,200),(null,300);
+delete from t1 where b <> 100;
+select * from t1 order by n;
+n b
+1 100
+replace into t1 values(null,100),(null,350);
+select * from t1 order by n;
+n b
+2 100
+3 350
+select * from t1 order by n;
+n b
+2 100
+3 350
+insert into t1 values (NULL,400),(3,500),(NULL,600) on duplicate key UPDATE n=1000;
+select * from t1 order by n;
+n b
+2 100
+4 400
+1000 350
+1001 600
+select * from t1 order by n;
+n b
+2 100
+4 400
+1000 350
+1001 600
+drop table t1;
+create table t1 (n int primary key auto_increment not null,
+b int, unique(b)) engine=tokudb;
+insert into t1 values(null,100);
+select * from t1 order by n;
+n b
+1 100
+insert into t1 values(null,200),(null,300);
+delete from t1 where b <> 100;
+select * from t1 order by n;
+n b
+1 100
+insert into t1 values(null,100),(null,350) on duplicate key update n=2;
+select * from t1 order by n;
+n b
+2 100
+3 350
+select * from t1 order by n;
+n b
+2 100
+3 350
+drop table t1;
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
+UNIQUE(b)) ENGINE=tokudb;
+INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 10
+2 2
+SELECT * FROM t1 ORDER BY a;
+a b
+1 10
+2 2
+drop table t1;
+CREATE TABLE t1 (
+id bigint(20) unsigned NOT NULL auto_increment,
+field_1 int(10) unsigned NOT NULL,
+field_2 varchar(255) NOT NULL,
+field_3 varchar(255) NOT NULL,
+PRIMARY KEY (id),
+UNIQUE KEY field_1 (field_1, field_2)
+) ENGINE=tokudb;
+CREATE TABLE t2 (
+field_a int(10) unsigned NOT NULL,
+field_b varchar(255) NOT NULL,
+field_c varchar(255) NOT NULL
+) ENGINE=tokudb;
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (1, 'a', '1a');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (2, 'b', '2b');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (3, 'c', '3c');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (4, 'd', '4d');
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (5, 'e', '5e');
+INSERT INTO t1 (field_1, field_2, field_3)
+SELECT t2.field_a, t2.field_b, t2.field_c
+FROM t2
+ON DUPLICATE KEY UPDATE
+t1.field_3 = t2.field_c;
+INSERT INTO t2 (field_a, field_b, field_c) VALUES (6, 'f', '6f');
+INSERT INTO t1 (field_1, field_2, field_3)
+SELECT t2.field_a, t2.field_b, t2.field_c
+FROM t2
+ON DUPLICATE KEY UPDATE
+t1.field_3 = t2.field_c;
+SELECT * FROM t1 ORDER BY id;
+id field_1 field_2 field_3
+1 1 a 1a
+2 2 b 2b
+3 3 c 3c
+4 4 d 4d
+5 5 e 5e
+8 6 f 6f
+SELECT * FROM t1 ORDER BY id;
+id field_1 field_2 field_3
+1 1 a 1a
+2 2 b 2b
+3 3 c 3c
+4 4 d 4d
+5 5 e 5e
+8 6 f 6f
+drop table t1, t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP TABLE IF EXISTS t1, t2;
+SELECT LAST_INSERT_ID(0);
+LAST_INSERT_ID(0)
+0
+CREATE TABLE t1 (
+id INT NOT NULL DEFAULT 0,
+last_id INT,
+PRIMARY KEY (id)
+) ENGINE=tokudb;
+CREATE TABLE t2 (
+id INT NOT NULL AUTO_INCREMENT,
+last_id INT,
+PRIMARY KEY (id)
+) ENGINE=tokudb;
+CREATE PROCEDURE p1()
+BEGIN
+INSERT INTO t2 (last_id) VALUES (LAST_INSERT_ID());
+INSERT INTO t1 (last_id) VALUES (LAST_INSERT_ID());
+END|
+CALL p1();
+SELECT * FROM t1 ORDER BY id;
+id last_id
+0 1
+SELECT * FROM t2 ORDER BY id;
+id last_id
+1 0
+SELECT * FROM t1 ORDER BY id;
+id last_id
+0 1
+SELECT * FROM t2 ORDER BY id;
+id last_id
+1 0
+DROP PROCEDURE p1;
+DROP TABLE t1, t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+DROP FUNCTION IF EXISTS f3;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (
+i INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+j INT DEFAULT 0
+) ENGINE=tokudb;
+CREATE TABLE t2 (i INT) ENGINE=tokudb;
+CREATE PROCEDURE p1()
+BEGIN
+INSERT INTO t1 (i) VALUES (NULL);
+INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+INSERT INTO t1 (i) VALUES (NULL), (NULL);
+INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+END |
+CREATE FUNCTION f1() RETURNS INT MODIFIES SQL DATA
+BEGIN
+INSERT INTO t1 (i) VALUES (NULL);
+INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+INSERT INTO t1 (i) VALUES (NULL), (NULL);
+INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+RETURN 0;
+END |
+CREATE FUNCTION f2() RETURNS INT NOT DETERMINISTIC
+RETURN LAST_INSERT_ID() |
+CREATE FUNCTION f3() RETURNS INT MODIFIES SQL DATA
+BEGIN
+INSERT INTO t2 (i) VALUES (LAST_INSERT_ID());
+RETURN 0;
+END |
+INSERT INTO t1 VALUES (NULL, -1);
+CALL p1();
+SELECT f1();
+f1()
+0
+INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
+(NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
+INSERT INTO t1 VALUES (NULL, f2());
+INSERT INTO t1 VALUES (NULL, 0), (NULL, LAST_INSERT_ID());
+UPDATE t1 SET j= -1 WHERE i IS NULL;
+INSERT INTO t1 (i) VALUES (NULL);
+INSERT INTO t1 (i) VALUES (NULL);
+SELECT f3();
+f3()
+0
+SELECT * FROM t1 ORDER BY i;
+i j
+1 -1
+2 0
+3 0
+4 0
+5 0
+6 0
+7 0
+8 3
+9 3
+10 3
+11 3
+12 3
+13 8
+14 -1
+15 13
+16 0
+17 0
+SELECT * FROM t2 ORDER BY i;
+i
+2
+3
+5
+6
+16
+SELECT * FROM t1;
+i j
+1 -1
+2 0
+3 0
+4 0
+5 0
+6 0
+7 0
+8 3
+9 3
+10 3
+11 3
+12 3
+13 8
+14 -1
+15 13
+16 0
+17 0
+SELECT * FROM t2;
+i
+2
+3
+5
+6
+16
+DROP PROCEDURE p1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP FUNCTION f3;
+DROP TABLE t1, t2;
+#
+# End of 5.0 tests
+#
+create table t2 (
+id int not null auto_increment,
+last_id int,
+primary key (id)
+) engine=tokudb;
+truncate table t2;
+create table t1 (id tinyint primary key) engine=tokudb;
+create function insid() returns int
+begin
+insert into t2 (last_id) values (0);
+return 0;
+end|
+set sql_log_bin=0;
+insert into t2 (id) values(1),(2),(3);
+delete from t2;
+set sql_log_bin=1;
+select insid();
+insid()
+0
+set sql_log_bin=0;
+insert into t2 (id) values(5),(6),(7);
+delete from t2 where id>=5;
+set sql_log_bin=1;
+insert into t1 select insid();
+select * from t1 order by id;
+id
+0
+select * from t2 order by id;
+id last_id
+4 0
+8 0
+select * from t1 order by id;
+id
+0
+select * from t2 order by id;
+id last_id
+4 0
+8 0
+drop table t1;
+drop function insid;
+truncate table t2;
+create table t1 (n int primary key auto_increment not null,
+b int, unique(b)) engine=tokudb;
+create procedure foo()
+begin
+insert into t1 values(null,10);
+insert ignore into t1 values(null,10);
+insert ignore into t1 values(null,10);
+insert into t2 values(null,3);
+end|
+call foo();
+select * from t1 order by n;
+n b
+1 10
+select * from t2 order by id;
+id last_id
+1 3
+select * from t1 order by n;
+n b
+1 10
+select * from t2 order by id;
+id last_id
+1 3
+drop table t1, t2;
+drop procedure foo;
+SET @@global.concurrent_insert= @old_concurrent_insert;
+set @@session.sql_auto_is_null=default;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_insert_id_pk.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_insert_id_pk.result
new file mode 100644
index 00000000000..359904787e3
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_insert_id_pk.result
@@ -0,0 +1,74 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+create table t1(a int auto_increment, primary key(a));
+create table t2(b int auto_increment, c int, primary key(b));
+insert into t1 values (1),(2),(3);
+insert into t1 values (null);
+insert into t2 values (null,last_insert_id());
+select * from t1 ORDER BY a;
+a
+1
+2
+3
+4
+select * from t2 ORDER BY b;
+b c
+1 4
+drop table t1;
+drop table t2;
+create table t1(a int auto_increment, key(a)) engine=tokudb;
+create table t2(b int auto_increment, c int, key(b), foreign key(b) references t1(a)) engine=tokudb;
+SET FOREIGN_KEY_CHECKS=0;
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 values (null,last_insert_id());
+SET FOREIGN_KEY_CHECKS=1;
+select * from t1;
+a
+10
+11
+12
+13
+select * from t2;
+b c
+5 0
+6 11
+drop table t2;
+drop table t1;
+create table t1(a int auto_increment, primary key(a));
+create table t2(b int auto_increment, c int, primary key(b));
+insert into t1 values (10);
+insert into t1 values (null),(null),(null);
+insert into t2 values (5,0);
+insert into t2 (c) select * from t1 ORDER BY a;
+select * from t2 ORDER BY b;
+b c
+5 0
+6 10
+7 11
+8 12
+9 13
+select * from t1 ORDER BY a;
+a
+10
+11
+12
+13
+select * from t2 ORDER BY b;
+b c
+5 0
+6 10
+7 11
+8 12
+9 13
+drop table t1;
+drop table t2;
+SET TIMESTAMP=1000000000;
+CREATE TABLE t1 ( a INT UNIQUE );
+SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO t1 VALUES (1),(1);
+Got one of the listed errors
+drop table t1;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update.result
new file mode 100644
index 00000000000..89236dcea4e
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update.result
@@ -0,0 +1,25 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=TokuDB;
+CREATE TABLE t2 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=TokuDB;
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
+drop table t1, t2;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update2.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update2.result
new file mode 100644
index 00000000000..df5fac74cf0
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update2.result
@@ -0,0 +1,53 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT');
+drop table if exists t1,t2;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=TokuDB;
+CREATE TABLE t2 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=TokuDB;
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 4
+2 5
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+SELECT * FROM t1 ORDER BY a;
+a b
+1 4
+2 5
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+drop table t1,t2;
+reset master;
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (0);
+UPDATE t1, (SELECT 3 as b) AS x SET t1.a = x.b;
+select * from t1;
+a
+3
+select * from t1;
+a
+3
+drop table t1;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update3.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update3.result
new file mode 100644
index 00000000000..bcad07eb0b6
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_multi_update3.result
@@ -0,0 +1,195 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
+
+-------- Test for BUG#9361 --------
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=TokuDB;
+CREATE TABLE t2 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=TokuDB;
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+UPDATE t2, (SELECT a FROM t1 ORDER BY a) AS t SET t2.b = t.a+5 ;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 6
+2 6
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 6
+2 6
+drop table t1,t2;
+
+-------- Test 1 for BUG#9361 --------
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (
+a1 char(30),
+a2 int,
+a3 int,
+a4 char(30),
+a5 char(30)
+);
+CREATE TABLE t2 (
+b1 int,
+b2 char(30)
+);
+INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
+INSERT INTO t2 VALUES (1, 'baz');
+UPDATE t1 a, t2
+SET a.a1 = 'No'
+WHERE a.a2 =
+(SELECT b1
+FROM t2
+WHERE b2 = 'baz')
+AND a.a3 IS NULL
+AND a.a4 = 'foo'
+AND a.a5 = 'bar';
+SELECT * FROM t1;
+a1 a2 a3 a4 a5
+No 1 NULL foo bar
+SELECT * FROM t2;
+b1 b2
+1 baz
+DROP TABLE t1, t2;
+
+-------- Test 2 for BUG#9361 --------
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t3;
+CREATE TABLE t1 (
+i INT,
+j INT,
+x INT,
+y INT,
+z INT
+);
+CREATE TABLE t2 (
+i INT,
+k INT,
+x INT,
+y INT,
+z INT
+);
+CREATE TABLE t3 (
+j INT,
+k INT,
+x INT,
+y INT,
+z INT
+);
+INSERT INTO t1 VALUES ( 1, 2,13,14,15);
+INSERT INTO t2 VALUES ( 1, 3,23,24,25);
+INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
+UPDATE t1 AS a
+INNER JOIN t2 AS b
+ON a.i = b.i
+INNER JOIN t3 AS c
+ON a.j = c.j AND b.k = c.k
+SET a.x = b.x,
+a.y = b.y,
+a.z = (
+SELECT sum(z)
+FROM t3
+WHERE y = 34
+)
+WHERE b.x = 23;
+SELECT * FROM t1;
+i j x y z
+1 2 23 24 71
+DROP TABLE t1, t2, t3;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 'test.t1'
+DROP TABLE IF EXISTS t2;
+Warnings:
+Note 1051 Unknown table 'test.t2'
+CREATE TABLE t1 (
+idp int(11) NOT NULL default '0',
+idpro int(11) default NULL,
+price decimal(19,4) default NULL,
+PRIMARY KEY (idp)
+);
+CREATE TABLE t2 (
+idpro int(11) NOT NULL default '0',
+price decimal(19,4) default NULL,
+nbprice int(11) default NULL,
+PRIMARY KEY (idpro)
+);
+INSERT INTO t1 VALUES
+(1,1,'3.0000'),
+(2,2,'1.0000'),
+(3,1,'1.0000'),
+(4,1,'4.0000'),
+(5,3,'2.0000'),
+(6,2,'4.0000');
+INSERT INTO t2 VALUES
+(1,'0.0000',0),
+(2,'0.0000',0),
+(3,'0.0000',0);
+update
+t2
+join
+( select idpro, min(price) as min_price, count(*) as nbr_price
+from t1
+where idpro>0 and price>0
+group by idpro
+) as table_price
+on t2.idpro = table_price.idpro
+set t2.price = table_price.min_price,
+t2.nbprice = table_price.nbr_price;
+select "-- MASTER AFTER JOIN --" as "";
+
+-- MASTER AFTER JOIN --
+select * from t1;
+idp idpro price
+1 1 3.0000
+2 2 1.0000
+3 1 1.0000
+4 1 4.0000
+5 3 2.0000
+6 2 4.0000
+select * from t2;
+idpro price nbprice
+1 1.0000 3
+2 1.0000 2
+3 2.0000 1
+select "-- SLAVE AFTER JOIN --" as "";
+
+-- SLAVE AFTER JOIN --
+select * from t1;
+idp idpro price
+1 1 3.0000
+2 2 1.0000
+3 1 1.0000
+4 1 4.0000
+5 3 2.0000
+6 2 4.0000
+select * from t2;
+idpro price nbprice
+1 1.0000 3
+2 1.0000 2
+3 2.0000 1
+DROP TABLE t1, t2;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/tokudb_rpl/r/rpl_tokudb_rfr_partition_table.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_rfr_partition_table.result
index 4594959c6d0..4594959c6d0 100644
--- a/storage/tokudb/mysql-test/tokudb_rpl/r/rpl_tokudb_rfr_partition_table.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_rfr_partition_table.result
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_crash_safe.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_crash_safe.result
new file mode 100644
index 00000000000..04578c3ff68
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_crash_safe.result
@@ -0,0 +1,2183 @@
+include/master-slave.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+[connection master]
+call mtr.add_suppression('Attempting backtrace');
+call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression(".* InnoDB: Warning: allocated tablespace .*, old maximum was .*");
+###################################################################################
+# PREPARE EXECUTION
+###################################################################################
+include/stop_slave.inc
+SHOW CREATE TABLE mysql.slave_relay_log_info;
+Table Create Table
+slave_relay_log_info CREATE TABLE `slave_relay_log_info` (
+ `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
+ `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
+ `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
+ `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
+ `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
+ `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
+ `Number_of_workers` int(10) unsigned NOT NULL,
+ `Id` int(10) unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Relay Log Information'
+SHOW CREATE TABLE mysql.slave_worker_info;
+Table Create Table
+slave_worker_info CREATE TABLE `slave_worker_info` (
+ `Id` int(10) unsigned NOT NULL,
+ `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Relay_log_pos` bigint(20) unsigned NOT NULL,
+ `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Master_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Checkpoint_relay_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Checkpoint_master_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_seqno` int(10) unsigned NOT NULL,
+ `Checkpoint_group_size` int(10) unsigned NOT NULL,
+ `Checkpoint_group_bitmap` blob NOT NULL,
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Worker Information'
+ALTER TABLE mysql.slave_relay_log_info ENGINE= Innodb;
+ALTER TABLE mysql.slave_worker_info ENGINE= Innodb;
+SHOW CREATE TABLE mysql.slave_relay_log_info;
+Table Create Table
+slave_relay_log_info CREATE TABLE `slave_relay_log_info` (
+ `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
+ `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
+ `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
+ `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
+ `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
+ `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
+ `Number_of_workers` int(10) unsigned NOT NULL,
+ `Id` int(10) unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Relay Log Information'
+SHOW CREATE TABLE mysql.slave_worker_info;
+Table Create Table
+slave_worker_info CREATE TABLE `slave_worker_info` (
+ `Id` int(10) unsigned NOT NULL,
+ `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Relay_log_pos` bigint(20) unsigned NOT NULL,
+ `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Master_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Checkpoint_relay_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Checkpoint_master_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_seqno` int(10) unsigned NOT NULL,
+ `Checkpoint_group_size` int(10) unsigned NOT NULL,
+ `Checkpoint_group_bitmap` blob NOT NULL,
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Worker Information'
+include/start_slave.inc
+rpl_mixing_engines.inc [commands=configure]
+CREATE TABLE nt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE nt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE nt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE nt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE nt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE nt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE tt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+CREATE TABLE tt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+CREATE TABLE tt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+CREATE TABLE tt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+CREATE TABLE tt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+CREATE TABLE tt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+INSERT INTO nt_1(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO nt_2(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO nt_3(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO nt_4(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO nt_5(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO nt_6(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_1(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_2(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_3(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_4(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_5(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_6(trans_id, stmt_id) VALUES(1,1);
+CREATE PROCEDURE pc_i_tt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+END|
+CREATE PROCEDURE pc_i_nt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+END|
+CREATE FUNCTION fc_i_tt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+RETURN "fc_i_tt_5_suc";
+END|
+CREATE FUNCTION fc_i_nt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+RETURN "fc_i_nt_5_suc";
+END|
+CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+RETURN "fc_i_nt_3_tt_3_suc";
+END|
+CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= NEW.trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
+INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+END|
+CREATE TRIGGER tr_i_nt_4_to_tt_4 AFTER INSERT ON nt_4 FOR EACH ROW
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM tt_4 WHERE trans_id= NEW.trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
+INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+END|
+CREATE TRIGGER tr_i_tt_5_to_tt_6 AFTER INSERT ON tt_5 FOR EACH ROW
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM tt_6 WHERE trans_id= NEW.trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id, 1), 1) INTO in_stmt_id;
+INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+END|
+CREATE TRIGGER tr_i_nt_5_to_nt_6 AFTER INSERT ON nt_5 FOR EACH ROW
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM nt_6 WHERE trans_id= NEW.trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
+INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+END|
+###################################################################################
+# EXECUTE CASES CRASHING THE XID
+###################################################################################
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=T]
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (7, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-trig]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (8, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-func]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (9, 1);
+fc_i_tt_5_suc (9, 1)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-proc]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (10, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-trig C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (11, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (11, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-func C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (12, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (12, 4);
+fc_i_tt_5_suc (12, 4)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-proc C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (13, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (13, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-trig T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (14, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (14, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-func T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (15, 2);
+fc_i_tt_5_suc (15, 2)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (15, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-proc T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (16, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (16, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=T]
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (17, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-trig]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (18, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-func]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (19, 1);
+fc_i_tt_5_suc (19, 1)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-proc]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (20, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-trig C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (21, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (21, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-func C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (22, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (22, 4);
+fc_i_tt_5_suc (22, 4)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-proc C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (23, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (23, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-trig T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (24, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (24, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-func T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (25, 2);
+fc_i_tt_5_suc (25, 2)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (25, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-proc T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (26, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (26, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=T]
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (27, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-trig]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (28, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-func]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (29, 1);
+fc_i_tt_5_suc (29, 1)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-proc]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (30, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-trig C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (31, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (31, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-func C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (32, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (32, 4);
+fc_i_tt_5_suc (32, 4)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-proc C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (33, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (33, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-trig T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (34, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (34, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-func T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (35, 2);
+fc_i_tt_5_suc (35, 2)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (35, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-proc T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (36, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (36, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=T]
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (37, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-trig]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (38, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-func]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (39, 1);
+fc_i_tt_5_suc (39, 1)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-proc]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (40, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-trig C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (41, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (41, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-func C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (42, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (42, 4);
+fc_i_tt_5_suc (42, 4)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-proc C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (43, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (43, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-trig T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (44, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (44, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-func T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (45, 2);
+fc_i_tt_5_suc (45, 2)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (45, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-proc T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (46, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (46, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_5)
+master-bin.000001 # Table_map # # table_id: # (test.tt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Table_map # # table_id: # (test.tt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+###################################################################################
+# EXECUTE CASES CRASHING THE BEGIN/COMMIT
+###################################################################################
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_and_update_pos";;
+FAILURE d,crash_after_commit_and_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=N]
+-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO nt_1(trans_id, stmt_id) VALUES (47, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_and_update_pos";;
+FAILURE d,crash_after_commit_and_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=N-trig]
+-b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO nt_5(trans_id, stmt_id) VALUES (48, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_5)
+master-bin.000001 # Table_map # # table_id: # (test.nt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_5)
+master-bin.000001 # Table_map # # table_id: # (test.nt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_and_update_pos";;
+FAILURE d,crash_after_commit_and_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=N-func]
+-b-b-b-b-b-b-b-b-b-b-b- >> N-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_nt_5_suc (49, 1);
+fc_i_nt_5_suc (49, 1)
+fc_i_nt_5_suc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_5)
+master-bin.000001 # Table_map # # table_id: # (test.nt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> N-func << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.nt_5)
+master-bin.000001 # Table_map # # table_id: # (test.nt_6)
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: #
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+###################################################################################
+# CHECK CONSISTENCY
+###################################################################################
+include/sync_slave_sql_with_master.inc
+###################################################################################
+# CLEAN
+###################################################################################
+rpl_mixing_engines.inc [commands=clean]
+DROP TABLE tt_1;
+DROP TABLE tt_2;
+DROP TABLE tt_3;
+DROP TABLE tt_4;
+DROP TABLE tt_5;
+DROP TABLE tt_6;
+DROP TABLE nt_1;
+DROP TABLE nt_2;
+DROP TABLE nt_3;
+DROP TABLE nt_4;
+DROP TABLE nt_5;
+DROP TABLE nt_6;
+DROP PROCEDURE pc_i_tt_5_suc;
+DROP PROCEDURE pc_i_nt_5_suc;
+DROP FUNCTION fc_i_tt_5_suc;
+DROP FUNCTION fc_i_nt_5_suc;
+DROP FUNCTION fc_i_nt_3_tt_3_suc;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_blobs.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_blobs.result
new file mode 100644
index 00000000000..a0713d01593
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_blobs.result
@@ -0,0 +1,4739 @@
+include/rpl_init.inc [topology=1->2->3]
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+CON: 'server_1', IMG: 'NOBLOB', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+CON: 'server_2', IMG: 'NOBLOB', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+CON: 'server_3', IMG: 'NOBLOB', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+### engines: TokuDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+CON: 'server_1', IMG: 'MINIMAL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_2', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_3', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+### engines: TokuDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+### engines: TokuDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check when there is no key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the AI (they are not updated)
+### will not break replication (check even if there is a key in the table)
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
+### will not break replication
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that updates without blobs in the BI (PK exists int the table)
+### will not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob in a key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a unique (not null) key does not break replication
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Asserts that declaring a blob as part of a primary key does not break replication
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_full.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_full.result
new file mode 100644
index 00000000000..d86105a3440
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_full.result
@@ -0,0 +1,3681 @@
+include/rpl_init.inc [topology=1->2->3]
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+### engines: TokuDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### Testing with TokuDB storage engine
+CON: 'server_1', IMG: 'MINIMAL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_2', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_3', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+#### case #1: AI: no values logged
+CREATE TABLE t1 (c1 int DEFAULT 100) Engine=ENGINE;
+INSERT INTO t1 VALUES ();
+SELECT * FROM t1;
+c1
+100
+include/rpl_sync.inc
+SELECT * FROM t1;
+c1
+100
+SELECT * FROM t1;
+c1
+100
+DROP TABLE t1;
+include/rpl_sync.inc
+#### case #2: AI: not empty but slave does not have usable data for its columns (INSERT)
+CREATE TABLE t1 (c1 int DEFAULT 100) Engine=ENGINE;
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 (c1 int DEFAULT 100) Engine=ENGINE;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 (c1 int DEFAULT 100, c2 int, primary key(c2)) Engine=ENGINE;
+SET SQL_LOG_BIN=1;
+INSERT INTO t1(c2) VALUES (1);
+SELECT * FROM t1;
+c1 c2
+100 1
+include/rpl_sync.inc
+SELECT * FROM t1;
+c1
+100
+SELECT * FROM t1;
+c1
+100
+DROP TABLE t1;
+include/rpl_sync.inc
+#### case #3: BI: usable columns on the slave, AI: no usable columns on the slave
+CREATE TABLE t1 (c1 int DEFAULT 100) Engine=ENGINE;
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 (c1 int DEFAULT 100) Engine=ENGINE;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 (c1 int DEFAULT 100, c2 int) Engine=ENGINE;
+SET SQL_LOG_BIN=1;
+INSERT INTO t1 VALUES (1,1);
+SELECT * FROM t1;
+c1 c2
+1 1
+include/rpl_sync.inc
+SELECT * FROM t1;
+c1
+1
+SELECT * FROM t1;
+c1
+1
+UPDATE t1 SET c2=2 WHERE c1=1 AND c2=1;
+SELECT * FROM t1;
+c1 c2
+1 2
+include/rpl_sync.inc
+SELECT * FROM t1;
+c1
+1
+SELECT * FROM t1;
+c1
+1
+DROP TABLE t1;
+include/rpl_sync.inc
+#### case #4: AI, BI: no usable columns on the slave (NOOP UPDATE).
+####
+CREATE TABLE t1 (c1 int DEFAULT 100) Engine=ENGINE;
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 (c1 int DEFAULT 100) Engine=ENGINE;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 (c1 int DEFAULT 100, c2 int, c3 int, primary key(c2)) Engine=ENGINE;
+SET SQL_LOG_BIN=1;
+INSERT INTO t1 VALUES (1,1,1);
+SELECT * FROM t1;
+c1 c2 c3
+1 1 1
+include/rpl_sync.inc
+SELECT * FROM t1;
+c1
+1
+SELECT * FROM t1;
+c1
+1
+UPDATE t1 SET c3=300 WHERE c2=1;
+SELECT * FROM t1;
+c1 c2 c3
+1 1 300
+include/rpl_sync.inc
+SELECT * FROM t1;
+c1
+1
+SELECT * FROM t1;
+c1
+1
+DROP TABLE t1;
+include/rpl_sync.inc
+#### case #5: BI: no usable columns on the slave, AI: usable columns on the slave (slave must stop).
+####
+CREATE TABLE t1 (c1 INT DEFAULT 100) Engine=ENGINE;
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 (c1 INT DEFAULT 100) Engine=ENGINE;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=0;
+CREATE TABLE t1 (c1 INT DEFAULT 100, c2 INT PRIMARY KEY) Engine=ENGINE;
+SET SQL_LOG_BIN=1;
+INSERT INTO t1 VALUES (1,1);
+SELECT * FROM t1;
+c1 c2
+1 1
+include/rpl_sync.inc
+SELECT * FROM t1;
+c1
+1
+SELECT * FROM t1;
+c1
+1
+UPDATE t1 SET c1=300 WHERE c2=1;
+SELECT * FROM t1;
+c1 c2
+300 1
+SET SQL_LOG_BIN=0;
+call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032");
+call mtr.add_suppression("Slave SQL: .*Could not execute Update_rows event on table test.t1; Can.t find record in .t1.* Error_code: 1032");
+call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
+SET SQL_LOG_BIN=1;
+include/wait_for_slave_sql_error_and_skip.inc [errno=1032]
+DROP TABLE t1;
+include/rpl_sync.inc
+CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_min.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_min.result
new file mode 100644
index 00000000000..45a5e6ee341
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_min.result
@@ -0,0 +1,3522 @@
+include/rpl_init.inc [topology=1->2->3]
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+CON: 'server_1', IMG: 'MINIMAL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_2', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_3', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+### engines: TokuDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_noblob.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_noblob.result
new file mode 100644
index 00000000000..52906a7ee36
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_eng_noblob.result
@@ -0,0 +1,3522 @@
+include/rpl_init.inc [topology=1->2->3]
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+CON: 'server_1', IMG: 'NOBLOB', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+CON: 'server_2', IMG: 'NOBLOB', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+CON: 'server_3', IMG: 'NOBLOB', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+### engines: TokuDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, TokuDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite NOT NULL Unique key with holes
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key with holes
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Primary Key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Primary key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Unique key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+****** TEST: One Composite key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: One key
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+******* TEST: No keys
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, '1', '1', '1' );
+INSERT INTO t VALUES (4, '4', '4', '4' );
+INSERT INTO t VALUES (7, '7', '7', '7' );
+INSERT INTO t VALUES (9, '9', '9', NULL );
+INSERT INTO t VALUES (2, '1', '2', '2' );
+INSERT INTO t VALUES (3, '1', '3', '2' );
+include/rpl_sync.inc
+UPDATE t SET c4 = '7';
+UPDATE t SET c4 = '5' WHERE c1 = 1;
+UPDATE t SET c2 = '5' WHERE c1 = 1;
+UPDATE t SET c1 = '5' WHERE c1 = 1;
+UPDATE t SET c4 = '8' WHERE c2 = '4';
+UPDATE t SET c1 = '8' WHERE c2 = '4';
+UPDATE t SET c2 = '8' WHERE c2 = '4';
+UPDATE t SET c3 = '0' WHERE c4 = NULL;
+UPDATE t SET c2 = '0' WHERE c4 = '0';
+UPDATE t SET c2 = '2' WHERE c4 = '2';
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c1 = 7;
+DELETE FROM t WHERE c1 = 8;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_full.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_full.result
new file mode 100644
index 00000000000..e802156918e
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_full.result
@@ -0,0 +1,3505 @@
+include/rpl_init.inc [topology=1->2->3]
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+### engines: TokuDB, TokuDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, TokuDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_min.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_min.result
new file mode 100644
index 00000000000..368b3b5f938
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_min.result
@@ -0,0 +1,3530 @@
+include/rpl_init.inc [topology=1->2->3]
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+CON: 'server_1', IMG: 'MINIMAL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_2', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+CON: 'server_3', IMG: 'MINIMAL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'MINIMAL';
+SET GLOBAL binlog_row_image= 'MINIMAL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image MINIMAL
+### engines: TokuDB, TokuDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, TokuDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_noblob.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_noblob.result
new file mode 100644
index 00000000000..bb6c3ea1c3e
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_img_idx_noblob.result
@@ -0,0 +1,3530 @@
+include/rpl_init.inc [topology=1->2->3]
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+CON: 'server_1', IMG: 'NOBLOB', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+CON: 'server_2', IMG: 'NOBLOB', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+CON: 'server_3', IMG: 'NOBLOB', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'NOBLOB';
+SET GLOBAL binlog_row_image= 'NOBLOB';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image NOBLOB
+### engines: TokuDB, TokuDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, TokuDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: TokuDB, InnoDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, TokuDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= TokuDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, TokuDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= TokuDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+### engines: InnoDB, InnoDB, InnoDB
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no keys slaves with no keys as well
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with keys
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields (first slave with UK NOT NULL, second with PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with no key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, first slave with key on different field and second slave with key on yet another different field.
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields (first slave has UK NOT NULL)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with Key, slaves with PKs on different fields
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, slaves with no keys
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NULLABLE, first slave with K on different field second slave with key on yet another different field
+CREATE TABLE t (c1 int, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL, first slave with UK NOT NULL on different field
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with UK NOT NULL and slaves with PK on different fields
+CREATE TABLE t (c1 int NOT NULL, c2 blob, c3 int, unique key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and no keys on the slaves
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Master with PK and first slave with KEY only
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c3)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave (which has unique NOT NULL key instead of PK)
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+SET SQL_LOG_BIN=0;
+### Different PKs on master and first slave
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= InnoDB;;
+CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= InnoDB;;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+SET SQL_LOG_BIN=1;
+INSERT INTO t VALUES (1, "a", 10);
+INSERT INTO t VALUES (2, "b", 20);
+INSERT INTO t VALUES (3, "c", 30);
+include/rpl_sync.inc
+UPDATE t SET c1=10 WHERE c2="a";
+UPDATE t SET c1=20 WHERE c1=2;
+UPDATE t SET c1=30 WHERE c3=30;
+UPDATE t SET c3=40 WHERE c1=30;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DELETE FROM t WHERE c2="a";
+DELETE FROM t WHERE c1=20;
+DELETE FROM t;
+include/rpl_sync.inc
+include/diff_tables.inc [server_1:test.t, server_2:test.t, server_3:test.t]
+DROP TABLE t;
+include/rpl_sync.inc
+CON: 'server_1', IMG: 'FULL', RESTART SLAVE: 'N'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_2', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+CON: 'server_3', IMG: 'FULL', RESTART SLAVE: 'Y'
+SET SESSION binlog_row_image= 'FULL';
+SET GLOBAL binlog_row_image= 'FULL';
+include/stop_slave.inc
+include/start_slave.inc
+FLUSH TABLES;
+SHOW VARIABLES LIKE 'binlog_row_image';
+Variable_name Value
+binlog_row_image FULL
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_log.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_log.result
new file mode 100644
index 00000000000..8cbbda48c1f
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_log.result
@@ -0,0 +1,293 @@
+include/master-slave.inc
+[connection master]
+include/stop_slave.inc
+include/wait_for_slave_to_stop.inc
+reset master;
+reset slave;
+start slave;
+include/wait_for_slave_to_start.inc
+set @save_slave_ddl_exec_mode=@@global.slave_ddl_exec_mode;
+set @@global.slave_ddl_exec_mode=STRICT;
+create table t1(n int not null auto_increment primary key)ENGINE=TokuDB;
+insert into t1 values (NULL);
+drop table t1;
+create table t1 (word char(20) not null)ENGINE=TokuDB;
+load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
+select count(*) from t1;
+count(*)
+69
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=TokuDB
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+flush logs;
+create table t3 (a int)ENGINE=TokuDB;
+select * from t1 order by 1 asc;
+word
+Aarhus
+Aaron
+Aaron
+Ababa
+Ababa
+aback
+aback
+abaft
+abaft
+abandon
+abandon
+abandoned
+abandoned
+abandoning
+abandoning
+abandonment
+abandonment
+abandons
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+select * from t1 order by 1 asc;
+word
+Aarhus
+Aaron
+Aaron
+Ababa
+Ababa
+aback
+aback
+abaft
+abaft
+abandon
+abandon
+abandoned
+abandoned
+abandoning
+abandoning
+abandonment
+abandonment
+abandons
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+flush logs;
+include/stop_slave.inc
+include/start_slave.inc
+create table t2 (n int)ENGINE=TokuDB;
+insert into t2 values (1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=TokuDB
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Rotate # # master-bin.000002;pos=POS
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
+master-bin.000002 # Gtid # # GTID #-#-#
+master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=TokuDB
+master-bin.000002 # Gtid # # GTID #-#-#
+master-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=TokuDB
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Table_map # # table_id: # (test.t2)
+master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000002 # Xid # # COMMIT /* XID */
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+show binary logs;
+Log_name File_size
+slave-bin.000001 #
+slave-bin.000002 #
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
+slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Xid # # COMMIT /* XID */
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=TokuDB
+slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000001 # Table_map # # table_id: # (test.t1)
+slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+slave-bin.000001 # Xid # # COMMIT /* XID */
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=TokuDB
+slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
+slave-bin.000002 # Gtid # # GTID #-#-#
+slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=TokuDB
+slave-bin.000002 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000002 # Table_map # # table_id: # (test.t2)
+slave-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+slave-bin.000002 # Xid # # COMMIT /* XID */
+include/check_slave_is_running.inc
+show binlog events in 'slave-bin.000005' from 4;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+include/rpl_reset.inc
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int)
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # COMMIT
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
+set @@global.slave_ddl_exec_mode=@save_slave_ddl_exec_mode;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_lower_case_table_names.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_lower_case_table_names.result
new file mode 100644
index 00000000000..d4a50261d60
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_lower_case_table_names.result
@@ -0,0 +1,51 @@
+include/master-slave.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+[connection master]
+******** [ MASTER ] ********
+CREATE DATABASE BUG_37656;
+use BUG_37656;
+show databases like 'BUG_37656';
+Database (BUG_37656)
+BUG_37656
+******** [ SLAVE ] ********
+show databases like 'bug_37656';
+Database (bug_37656)
+bug_37656
+******** [ MASTER ] ********
+CREATE TABLE T1 (a int);
+CREATE TABLE T2 (b int) ENGINE=TokuDB;
+CREATE TABLE T3 (txt TEXT);
+show tables;
+Tables_in_BUG_37656
+T1
+T2
+T3
+******** [ SLAVE ] ********
+use bug_37656;
+show tables;
+Tables_in_bug_37656
+t2
+t3
+CREATE TABLE t1 (a INT);
+******** [ MASTER ] ********
+use BUG_37656;
+INSERT INTO T1 VALUES (1);
+INSERT INTO T2 VALUES (1);
+use test;
+INSERT INTO BUG_37656.T1 VALUES (2);
+INSERT INTO BUG_37656.T2 VALUES (2);
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE BUG_37656.T3;
+******** [ SLAVE ] ********
+include/diff_tables.inc [master:BUG_37656.T2, slave:bug_37656.t2]
+include/diff_tables.inc [master:BUG_37656.T3, slave:bug_37656.t3]
+******** [ MASTER ] ********
+DROP DATABASE BUG_37656;
+include/rpl_reset.inc
+CREATE DATABASE B50653;
+USE B50653;
+CREATE PROCEDURE b50653_proc() BEGIN SELECT 1; END;
+DROP PROCEDURE b50653_proc;
+DROP DATABASE B50653;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_sp003.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_sp003.result
new file mode 100644
index 00000000000..4d9497386d6
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_sp003.result
@@ -0,0 +1,54 @@
+include/master-slave.inc
+[connection master]
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=TOKUDB;
+CREATE PROCEDURE test.p1()
+BEGIN
+INSERT INTO test.t1 VALUES (4);
+SELECT get_lock("test", 100);
+UPDATE test.t1 set a=a+4 WHERE a=4;
+END|
+CREATE PROCEDURE test.p2()
+BEGIN
+UPDATE test.t1 SET a=a+1;
+END|
+SELECT get_lock("test", 200);
+get_lock("test", 200)
+1
+CALL test.p1();
+CALL test.p2();
+SELECT release_lock("test");
+release_lock("test")
+1
+get_lock("test", 100)
+1
+SELECT release_lock("test");
+release_lock("test")
+1
+SELECT * FROM test.t1;
+a
+5
+SELECT * FROM test.t1;
+a
+5
+DROP TABLE IF EXISTS test.t1;
+CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=TOKUDB;
+CALL test.p2();
+CALL test.p1();
+get_lock("test", 100)
+1
+SELECT release_lock("test");
+release_lock("test")
+1
+SELECT * FROM test.t1;
+a
+8
+SELECT * FROM test.t1;
+a
+8
+DROP PROCEDURE IF EXISTS test.p1;
+DROP PROCEDURE IF EXISTS test.p2;
+DROP TABLE IF EXISTS test.t1;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_sp006.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_sp006.result
new file mode 100644
index 00000000000..c8da9ade375
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_sp006.result
@@ -0,0 +1,41 @@
+include/master-slave.inc
+[connection master]
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS p2;
+CREATE TABLE IF NOT EXISTS t1(name CHAR(16), birth DATE,PRIMARY KEY(name))ENGINE=TokuDB;
+CREATE TABLE IF NOT EXISTS t2(name CHAR(16), age INT ,PRIMARY KEY(name))ENGINE=TokuDB;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE done INT DEFAULT 0;
+DECLARE spa CHAR(16);
+DECLARE spb INT;
+DECLARE cur1 CURSOR FOR SELECT name,
+(YEAR(CURDATE())-YEAR(birth))-(RIGHT(CURDATE(),5)<RIGHT(birth,5))
+FROM t1;
+DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
+OPEN cur1;
+SET AUTOCOMMIT=0;
+REPEAT
+FETCH cur1 INTO spa, spb;
+IF NOT done THEN
+START TRANSACTION;
+INSERT INTO t2 VALUES (spa,spb);
+COMMIT;
+END IF;
+UNTIL done END REPEAT;
+SET AUTOCOMMIT=1;
+CLOSE cur1;
+END|
+CREATE PROCEDURE p2()
+BEGIN
+INSERT INTO t1 VALUES ('MySQL','1993-02-04'),('ROCKS', '1990-08-27'),('Texas', '1999-03-30'),('kyle','2005-1-1');
+END|
+CALL p2();
+CALL p1();
+DROP TABLE t1;
+DROP TABLE t2;
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_trig004.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_trig004.result
new file mode 100644
index 00000000000..a0573fac89e
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_row_trig004.result
@@ -0,0 +1,27 @@
+include/master-slave.inc
+[connection master]
+DROP TRIGGER test.t1_bi_t2;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+CREATE TABLE test.t1 (n MEDIUMINT NOT NULL AUTO_INCREMENT, d FLOAT, PRIMARY KEY(n))ENGINE=TOKUDB;
+CREATE TABLE test.t2 (n MEDIUMINT NOT NULL, f FLOAT, PRIMARY KEY(n))ENGINE=TOKUDB;
+CREATE TRIGGER test.t1_bi_t2 BEFORE INSERT ON test.t2 FOR EACH ROW INSERT INTO test.t1 VALUES (NULL, 1.234)//
+INSERT INTO test.t2 VALUES (1, 0.0);
+INSERT INTO test.t2 VALUES (1, 0.0);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+select * from test.t1;
+n d
+1 1.234
+select * from test.t2;
+n f
+1 0
+select * from test.t1;
+n d
+1 1.234
+select * from test.t2;
+n f
+1 0
+DROP TRIGGER test.t1_bi_t2;
+DROP TABLE test.t1;
+DROP TABLE test.t2;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_log.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_log.result
new file mode 100644
index 00000000000..42defbe07b5
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_log.result
@@ -0,0 +1,292 @@
+include/master-slave.inc
+[connection master]
+include/stop_slave.inc
+include/wait_for_slave_to_stop.inc
+reset master;
+reset slave;
+start slave;
+include/wait_for_slave_to_start.inc
+set @save_slave_ddl_exec_mode=@@global.slave_ddl_exec_mode;
+set @@global.slave_ddl_exec_mode=STRICT;
+create table t1(n int not null auto_increment primary key)ENGINE=TokuDB;
+insert into t1 values (NULL);
+drop table t1;
+create table t1 (word char(20) not null)ENGINE=TokuDB;
+load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
+select count(*) from t1;
+count(*)
+69
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=TokuDB
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (`word`) ;file_id=#
+master-bin.000001 # Xid # # COMMIT /* XID */
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
+master-bin.000001 # Xid # # COMMIT /* XID */
+flush logs;
+create table t3 (a int)ENGINE=TokuDB;
+select * from t1 order by 1 asc;
+word
+Aarhus
+Aaron
+Aaron
+Ababa
+Ababa
+aback
+aback
+abaft
+abaft
+abandon
+abandon
+abandoned
+abandoned
+abandoning
+abandoning
+abandonment
+abandonment
+abandons
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+select * from t1 order by 1 asc;
+word
+Aarhus
+Aaron
+Aaron
+Ababa
+Ababa
+aback
+aback
+abaft
+abaft
+abandon
+abandon
+abandoned
+abandoned
+abandoning
+abandoning
+abandonment
+abandonment
+abandons
+abandons
+abase
+abased
+abasement
+abasements
+abases
+abash
+abashed
+abashes
+abashing
+abasing
+abate
+abated
+abatement
+abatements
+abater
+abates
+abating
+Abba
+abbe
+abbey
+abbeys
+abbot
+abbots
+Abbott
+abbreviate
+abbreviated
+abbreviates
+abbreviating
+abbreviation
+abbreviations
+Abby
+abdomen
+abdomens
+abdominal
+abduct
+abducted
+abduction
+abductions
+abductor
+abductors
+abducts
+Abe
+abed
+Abel
+Abelian
+Abelson
+Aberdeen
+Abernathy
+aberrant
+aberration
+flush logs;
+include/stop_slave.inc
+include/start_slave.inc
+create table t2 (n int)ENGINE=TokuDB;
+insert into t2 values (1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=TokuDB
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
+master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (`word`) ;file_id=#
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Rotate # # master-bin.000002;pos=POS
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000002 # Binlog_checkpoint # # master-bin.000002
+master-bin.000002 # Gtid # # GTID #-#-#
+master-bin.000002 # Query # # use `test`; create table t3 (a int)ENGINE=TokuDB
+master-bin.000002 # Gtid # # GTID #-#-#
+master-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=TokuDB
+master-bin.000002 # Gtid # # BEGIN GTID #-#-#
+master-bin.000002 # Query # # use `test`; insert into t2 values (1)
+master-bin.000002 # Xid # # COMMIT /* XID */
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+show binary logs;
+Log_name File_size
+slave-bin.000001 #
+slave-bin.000002 #
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=TokuDB
+slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000001 # Intvar # # INSERT_ID=1
+slave-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
+slave-bin.000001 # Xid # # COMMIT /* XID */
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=TokuDB
+slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
+slave-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../tmp/SQL_LOAD-<SERVER UUID>-<MASTER server-id>-<file-id>.<extension>' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' IGNORE 1 LINES (`word`) ;file_id=#
+slave-bin.000001 # Xid # # COMMIT /* XID */
+slave-bin.000001 # Gtid # # GTID #-#-#
+slave-bin.000001 # Query # # use `test`; create table t3 (a int)ENGINE=TokuDB
+slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000002 # Binlog_checkpoint # # slave-bin.000002
+slave-bin.000002 # Gtid # # GTID #-#-#
+slave-bin.000002 # Query # # use `test`; create table t2 (n int)ENGINE=TokuDB
+slave-bin.000002 # Gtid # # BEGIN GTID #-#-#
+slave-bin.000002 # Query # # use `test`; insert into t2 values (1)
+slave-bin.000002 # Xid # # COMMIT /* XID */
+include/check_slave_is_running.inc
+show binlog events in 'slave-bin.000005' from 4;
+ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+include/rpl_reset.inc
+create table t1(a int auto_increment primary key, b int);
+insert into t1 values (NULL, 1);
+set insert_id=5;
+insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int)
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL, 1)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Intvar # # LAST_INSERT_ID=1
+master-bin.000001 # Intvar # # INSERT_ID=5
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id())
+master-bin.000001 # Query # # COMMIT
+select * from t1;
+a b
+1 1
+5 1
+6 1
+drop table t1;
+set @@global.slave_ddl_exec_mode=@save_slave_ddl_exec_mode;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_mixed_crash_safe.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_mixed_crash_safe.result
new file mode 100644
index 00000000000..226a2b93140
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_mixed_crash_safe.result
@@ -0,0 +1,1773 @@
+include/master-slave.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+[connection master]
+call mtr.add_suppression('Attempting backtrace');
+call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression(".* InnoDB: Warning: allocated tablespace .*, old maximum was .*");
+###################################################################################
+# PREPARE EXECUTION
+###################################################################################
+include/stop_slave.inc
+SHOW CREATE TABLE mysql.slave_relay_log_info;
+Table Create Table
+slave_relay_log_info CREATE TABLE `slave_relay_log_info` (
+ `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
+ `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
+ `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
+ `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
+ `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
+ `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
+ `Number_of_workers` int(10) unsigned NOT NULL,
+ `Id` int(10) unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Relay Log Information'
+SHOW CREATE TABLE mysql.slave_worker_info;
+Table Create Table
+slave_worker_info CREATE TABLE `slave_worker_info` (
+ `Id` int(10) unsigned NOT NULL,
+ `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Relay_log_pos` bigint(20) unsigned NOT NULL,
+ `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Master_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Checkpoint_relay_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Checkpoint_master_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_seqno` int(10) unsigned NOT NULL,
+ `Checkpoint_group_size` int(10) unsigned NOT NULL,
+ `Checkpoint_group_bitmap` blob NOT NULL,
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Worker Information'
+ALTER TABLE mysql.slave_relay_log_info ENGINE= Innodb;
+ALTER TABLE mysql.slave_worker_info ENGINE= Innodb;
+SHOW CREATE TABLE mysql.slave_relay_log_info;
+Table Create Table
+slave_relay_log_info CREATE TABLE `slave_relay_log_info` (
+ `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
+ `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
+ `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
+ `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
+ `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
+ `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
+ `Number_of_workers` int(10) unsigned NOT NULL,
+ `Id` int(10) unsigned NOT NULL COMMENT 'Internal Id that uniquely identifies this record.',
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Relay Log Information'
+SHOW CREATE TABLE mysql.slave_worker_info;
+Table Create Table
+slave_worker_info CREATE TABLE `slave_worker_info` (
+ `Id` int(10) unsigned NOT NULL,
+ `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Relay_log_pos` bigint(20) unsigned NOT NULL,
+ `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Master_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Checkpoint_relay_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ `Checkpoint_master_log_pos` bigint(20) unsigned NOT NULL,
+ `Checkpoint_seqno` int(10) unsigned NOT NULL,
+ `Checkpoint_group_size` int(10) unsigned NOT NULL,
+ `Checkpoint_group_bitmap` blob NOT NULL,
+ PRIMARY KEY (`Id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 STATS_PERSISTENT=0 COMMENT='Worker Information'
+include/start_slave.inc
+rpl_mixing_engines.inc [commands=configure]
+CREATE TABLE nt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE nt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE nt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE nt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE nt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE nt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
+CREATE TABLE tt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+CREATE TABLE tt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+CREATE TABLE tt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+CREATE TABLE tt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+CREATE TABLE tt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+CREATE TABLE tt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = TokuDB;
+INSERT INTO nt_1(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO nt_2(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO nt_3(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO nt_4(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO nt_5(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO nt_6(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_1(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_2(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_3(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_4(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_5(trans_id, stmt_id) VALUES(1,1);
+INSERT INTO tt_6(trans_id, stmt_id) VALUES(1,1);
+CREATE PROCEDURE pc_i_tt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+END|
+CREATE PROCEDURE pc_i_nt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+END|
+CREATE FUNCTION fc_i_tt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+RETURN "fc_i_tt_5_suc";
+END|
+CREATE FUNCTION fc_i_nt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
+RETURN "fc_i_nt_5_suc";
+END|
+CREATE FUNCTION fc_i_nt_3_tt_3_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO nt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+SELECT max(stmt_id) INTO in_stmt_id FROM tt_3 WHERE trans_id= p_trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
+INSERT INTO tt_3(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
+RETURN "fc_i_nt_3_tt_3_suc";
+END|
+CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= NEW.trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
+INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+END|
+CREATE TRIGGER tr_i_nt_4_to_tt_4 AFTER INSERT ON nt_4 FOR EACH ROW
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM tt_4 WHERE trans_id= NEW.trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
+INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+END|
+CREATE TRIGGER tr_i_tt_5_to_tt_6 AFTER INSERT ON tt_5 FOR EACH ROW
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM tt_6 WHERE trans_id= NEW.trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id, 1), 1) INTO in_stmt_id;
+INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+END|
+CREATE TRIGGER tr_i_nt_5_to_nt_6 AFTER INSERT ON nt_5 FOR EACH ROW
+BEGIN
+DECLARE in_stmt_id INTEGER;
+SELECT max(stmt_id) INTO in_stmt_id FROM nt_6 WHERE trans_id= NEW.trans_id;
+SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
+INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
+INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
+END|
+###################################################################################
+# EXECUTE CASES CRASHING THE XID
+###################################################################################
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=T]
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (7, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (7, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (7, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-trig]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (8, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (8, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (8, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-func]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (9, 1);
+fc_i_tt_5_suc (9, 1)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(9,1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(9,1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-proc]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (10, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',10), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',10), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',10), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',10), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-trig C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (11, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (11, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (11, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (11, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (11, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (11, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-func C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (12, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (12, 4);
+fc_i_tt_5_suc (12, 4)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (12, 2)
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(12,4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (12, 2)
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(12,4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-proc C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (13, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (13, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (13, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',13), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',13), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (13, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',13), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',13), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-trig T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (14, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (14, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (14, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (14, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (14, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (14, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-func T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (15, 2);
+fc_i_tt_5_suc (15, 2)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (15, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(15,2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (15, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(15,2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (15, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_apply";;
+FAILURE d,crash_after_apply and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-proc T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (16, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (16, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',16), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',16), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (16, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',16), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',16), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (16, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=T]
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (17, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (17, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (17, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-trig]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (18, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (18, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (18, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-func]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (19, 1);
+fc_i_tt_5_suc (19, 1)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(19,1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(19,1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-proc]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (20, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',20), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',20), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',20), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',20), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-trig C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (21, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (21, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (21, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (21, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (21, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (21, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-func C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (22, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (22, 4);
+fc_i_tt_5_suc (22, 4)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (22, 2)
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(22,4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (22, 2)
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(22,4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-proc C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (23, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (23, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (23, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',23), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',23), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (23, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',23), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',23), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-trig T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (24, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (24, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (24, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (24, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (24, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (24, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-func T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (25, 2);
+fc_i_tt_5_suc (25, 2)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (25, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(25,2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (25, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(25,2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (25, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_before_update_pos";;
+FAILURE d,crash_before_update_pos and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-proc T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (26, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (26, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',26), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',26), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (26, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',26), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',26), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (26, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=T]
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (27, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (27, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (27, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-trig]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (28, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (28, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (28, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-func]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (29, 1);
+fc_i_tt_5_suc (29, 1)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(29,1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(29,1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=T-proc]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (30, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',30), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',30), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',30), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',30), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-trig C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (31, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (31, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (31, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (31, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (31, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (31, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-func C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (32, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (32, 4);
+fc_i_tt_5_suc (32, 4)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (32, 2)
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(32,4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (32, 2)
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(32,4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T T-proc C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (33, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (33, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (33, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',33), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',33), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (33, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',33), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',33), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-trig T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (34, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (34, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (34, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (34, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (34, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (34, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-func T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (35, 2);
+fc_i_tt_5_suc (35, 2)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (35, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(35,2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (35, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(35,2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (35, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_update_pos_before_apply";;
+FAILURE d,crash_after_update_pos_before_apply and OUTCOME O1
+rpl_mixing_engines.inc [commands=B T-proc T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (36, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (36, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',36), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',36), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (36, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',36), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',36), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (36, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=T]
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (37, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (37, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (37, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-trig]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (38, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (38, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (38, 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-func]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (39, 1);
+fc_i_tt_5_suc (39, 1)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(39,1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(39,1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=T-proc]
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (40, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',40), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',40), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',40), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Xid # # COMMIT /* XID */
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',40), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-trig C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (41, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (41, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (41, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (41, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-trig C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (41, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (41, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-trig C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-func C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (42, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (42, 4);
+fc_i_tt_5_suc (42, 4)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (42, 2)
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(42,4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-func C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (42, 2)
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(42,4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-func C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T T-proc C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (43, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (43, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (43, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',43), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',43), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T T-proc C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (43, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',43), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',43), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T T-proc C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-trig T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_5(trans_id, stmt_id) VALUES (44, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (44, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (44, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (44, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-trig T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (44, 2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (44, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-trig T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-func T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_tt_5_suc (45, 2);
+fc_i_tt_5_suc (45, 2)
+fc_i_tt_5_suc
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (45, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(45,2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (45, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-func T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_tt_5_suc`(45,2)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (45, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-func T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_before_update_pos";;
+FAILURE d,crash_after_commit_before_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=B T-proc T C]
+-b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
+BEGIN;
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
+CALL pc_i_tt_5_suc (46, 2);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO tt_1(trans_id, stmt_id) VALUES (46, 4);
+include/show_binlog_events.inc
+-e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
+COMMIT;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',46), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',46), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (46, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> B T-proc T C << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',46), NAME_CONST('in_stmt_id',1))
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',46), NAME_CONST('in_stmt_id',1) + 1)
+master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (46, 4)
+master-bin.000001 # Xid # # COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T-proc T C << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+###################################################################################
+# EXECUTE CASES CRASHING THE BEGIN/COMMIT
+###################################################################################
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_and_update_pos";;
+FAILURE d,crash_after_commit_and_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=N]
+-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO nt_1(trans_id, stmt_id) VALUES (47, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (47, 1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (47, 1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_and_update_pos";;
+FAILURE d,crash_after_commit_and_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=N-trig]
+-b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
+INSERT INTO nt_5(trans_id, stmt_id) VALUES (48, 1);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (48, 1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (48, 1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+
+
+
+STOP SLAVE SQL_THREAD;
+include/wait_for_slave_sql_to_stop.inc
+SET GLOBAL debug="d,crash_after_commit_and_update_pos";;
+FAILURE d,crash_after_commit_and_update_pos and OUTCOME O2
+rpl_mixing_engines.inc [commands=N-func]
+-b-b-b-b-b-b-b-b-b-b-b- >> N-func << -b-b-b-b-b-b-b-b-b-b-b-
+SELECT fc_i_nt_5_suc (49, 1);
+fc_i_nt_5_suc (49, 1)
+fc_i_nt_5_suc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(49,1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
+-b-b-b-b-b-b-b-b-b-b-b- >> N-func << -b-b-b-b-b-b-b-b-b-b-b-
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; SELECT `test`.`fc_i_nt_5_suc`(49,1)
+master-bin.000001 # Query # # COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> N-func << -e-e-e-e-e-e-e-e-e-e-e-
+
+include/rpl_reconnect.inc
+START SLAVE;
+include/wait_for_slave_to_start.inc
+###################################################################################
+# CHECK CONSISTENCY
+###################################################################################
+include/sync_slave_sql_with_master.inc
+###################################################################################
+# CLEAN
+###################################################################################
+rpl_mixing_engines.inc [commands=clean]
+DROP TABLE tt_1;
+DROP TABLE tt_2;
+DROP TABLE tt_3;
+DROP TABLE tt_4;
+DROP TABLE tt_5;
+DROP TABLE tt_6;
+DROP TABLE nt_1;
+DROP TABLE nt_2;
+DROP TABLE nt_3;
+DROP TABLE nt_4;
+DROP TABLE nt_5;
+DROP TABLE nt_6;
+DROP PROCEDURE pc_i_tt_5_suc;
+DROP PROCEDURE pc_i_nt_5_suc;
+DROP FUNCTION fc_i_tt_5_suc;
+DROP FUNCTION fc_i_nt_5_suc;
+DROP FUNCTION fc_i_nt_3_tt_3_suc;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_mixed_lower_case_table_names.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_mixed_lower_case_table_names.result
new file mode 100644
index 00000000000..e3d83733ed0
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_stm_mixed_lower_case_table_names.result
@@ -0,0 +1,48 @@
+include/master-slave.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+[connection master]
+******** [ MASTER ] ********
+CREATE DATABASE BUG_37656;
+use BUG_37656;
+show databases like 'BUG_37656';
+Database (BUG_37656)
+BUG_37656
+******** [ SLAVE ] ********
+show databases like 'bug_37656';
+Database (bug_37656)
+bug_37656
+******** [ MASTER ] ********
+CREATE TABLE T1 (a int);
+CREATE TABLE T2 (b int) ENGINE=TokuDB;
+CREATE TABLE T3 (txt TEXT);
+show tables;
+Tables_in_BUG_37656
+T1
+T2
+T3
+******** [ SLAVE ] ********
+use bug_37656;
+show tables;
+Tables_in_bug_37656
+t2
+t3
+CREATE TABLE t1 (a INT);
+******** [ MASTER ] ********
+use BUG_37656;
+INSERT INTO T1 VALUES (1);
+INSERT INTO T2 VALUES (1);
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE BUG_37656.T3;
+******** [ SLAVE ] ********
+include/diff_tables.inc [master:BUG_37656.T2, slave:bug_37656.t2]
+include/diff_tables.inc [master:BUG_37656.T3, slave:bug_37656.t3]
+******** [ MASTER ] ********
+DROP DATABASE BUG_37656;
+include/rpl_reset.inc
+CREATE DATABASE B50653;
+USE B50653;
+CREATE PROCEDURE b50653_proc() BEGIN SELECT 1; END;
+DROP PROCEDURE b50653_proc;
+DROP DATABASE B50653;
+include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_not_null_tokudb.test b/storage/tokudb/mysql-test/rpl/t/rpl_not_null_tokudb.test
index 57243376ac2..53cf555ce64 100644
--- a/storage/tokudb/mysql-test/rpl/t/rpl_not_null_tokudb.test
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_not_null_tokudb.test
@@ -11,9 +11,9 @@
# 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures)
#
#################################################################################
---source include/master-slave.inc
--source include/have_tokudb.inc
--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
let $engine=TokuDB;
--source extra/rpl_tests/rpl_not_null.test
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_delete_pk-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_delete_pk-slave.opt
index 0aa48174807..e1bddaa2204 100644
--- a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_delete_pk-slave.opt
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_delete_pk-slave.opt
@@ -1,5 +1,2 @@
---read-only=ON
---loose-tokudb-rpl-unique-checks-delay=10000
---loose-tokudb-rpl-unique-checks=OFF
---loose-tokudb-rpl-lookup-rows-delay=10000
---loose-tokudb-rpl-lookup-rows=OFF
+--read-only=ON --loose-tokudb-rpl-unique-checks-delay=10000 --loose-tokudb-rpl-unique-checks=OFF --loose-tokudb-rpl-lookup-rows-delay=10000 --loose-tokudb-rpl-lookup-rows=OFF
+
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_update_pk_uc0_lookup0-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_update_pk_uc0_lookup0-slave.opt
index 0aa48174807..93a2685e847 100644
--- a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_update_pk_uc0_lookup0-slave.opt
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_update_pk_uc0_lookup0-slave.opt
@@ -1,5 +1 @@
---read-only=ON
---loose-tokudb-rpl-unique-checks-delay=10000
---loose-tokudb-rpl-unique-checks=OFF
---loose-tokudb-rpl-lookup-rows-delay=10000
---loose-tokudb-rpl-lookup-rows=OFF
+--read-only=ON --loose-tokudb-rpl-unique-checks-delay=10000 --loose-tokudb-rpl-unique-checks=OFF --loose-tokudb-rpl-lookup-rows-delay=10000 --loose-tokudb-rpl-lookup-rows=OFF
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_update_pk_uc0_lookup0.test b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_update_pk_uc0_lookup0.test
index d6ccf2487ae..25fe8847dad 100644
--- a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_update_pk_uc0_lookup0.test
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_update_pk_uc0_lookup0.test
@@ -42,15 +42,16 @@ update t set b=b+2 where a=1;
update t set b=b+3 where a=4;
update t set b=b+4 where a=3;
update t set b=b+1 where 1<=a and a<=3;
-select unix_timestamp() into @tstart;
+--echo # select unix_timestamp() into @tstart;
# wait for the delete to finish on the slave
connection master;
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
connection master;
-select unix_timestamp() into @tend;
-#select @tend-@tstart <= 5; # assert no delay in the delete time
+--echo # Commented out for MariaDB
+--echo # select unix_timestamp() into @tend;
+--echo # select @tend-@tstart <= 5; # assert no delay in the delete time
connection slave;
select * from t;
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_write_pk-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_write_pk-slave.opt
index 7f49776e4e8..dd719829112 100644
--- a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_write_pk-slave.opt
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_write_pk-slave.opt
@@ -1,3 +1,2 @@
---read-only=ON
---loose-tokudb-rpl-unique-checks-delay=5000
---loose-tokudb-rpl-unique-checks=OFF
+--read-only=ON --loose-tokudb-rpl-unique-checks-delay=5000 --loose-tokudb-rpl-unique-checks=OFF
+
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_write_pk.test b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_write_pk.test
index db96ac321c0..d2a1cbea328 100644
--- a/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_write_pk.test
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_parallel_tokudb_write_pk.test
@@ -22,7 +22,6 @@ connection master;
# select @@autocommit;
eval create table t (a bigint not null, primary key(a)) engine=$engine;
# show create table t;
-select unix_timestamp() into @tstart;
insert into t values (1);
insert into t values (2),(3);
insert into t values (4);
@@ -30,8 +29,7 @@ insert into t values (4);
sync_slave_with_master;
# source include/sync_slave_sql_with_master.inc;
-#connection master;
-#select unix_timestamp()-@tstart;
+connection master;
connection slave;
# insert into t values (5); # test read-only
diff --git a/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_rfr_disable_on_expl_pk_absence-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_rfr_disable_on_expl_pk_absence-slave.opt
index c87bbb62418..c87bbb62418 100644
--- a/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_rfr_disable_on_expl_pk_absence-slave.opt
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_rfr_disable_on_expl_pk_absence-slave.opt
diff --git a/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_rfr_disable_on_expl_pk_absence.test b/storage/tokudb/mysql-test/rpl/t/rpl_rfr_disable_on_expl_pk_absence.test
index 67e77c1511c..67e77c1511c 100644
--- a/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_rfr_disable_on_expl_pk_absence.test
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_rfr_disable_on_expl_pk_absence.test
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_row_basic_3tokudb.test b/storage/tokudb/mysql-test/rpl/t/rpl_row_basic_3tokudb.test
index eb1bad94e29..4c38646b112 100644
--- a/storage/tokudb/mysql-test/rpl/t/rpl_row_basic_3tokudb.test
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_row_basic_3tokudb.test
@@ -1,11 +1,11 @@
--- source include/have_tokudb.inc
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
+--source include/have_tokudb.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
connection slave;
let $bit_field_special = ALL_LOSSY;
-let $type= 'TokuDB';
-let $extra_index= ;
--- source extra/rpl_tests/rpl_row_basic.test
+let $type = 'TokuDB';
+let $extra_index = ;
+--source extra/rpl_tests/rpl_row_basic.test
--source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_stm_tokudb.test b/storage/tokudb/mysql-test/rpl/t/rpl_stm_tokudb.test
index bd4de6e467c..25f0ab3b934 100644
--- a/storage/tokudb/mysql-test/rpl/t/rpl_stm_tokudb.test
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_stm_tokudb.test
@@ -4,6 +4,7 @@
source include/master-slave.inc;
source include/have_tokudb.inc;
source include/have_binlog_format_statement.inc;
+# gtids disabled because it tests DROP TEMPORARY inside a transaction
source extra/rpl_tests/rpl_tokudb.test;
--source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_commit_after_flush.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_commit_after_flush.test
new file mode 100644
index 00000000000..b39661c111b
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_commit_after_flush.test
@@ -0,0 +1,5 @@
+-- source include/have_tokudb.inc
+-- source include/master-slave.inc
+let $engine_type=tokudb;
+-- source extra/rpl_tests/rpl_commit_after_flush.test
+--source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id-master.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id-master.opt
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id-master.opt
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id-slave.opt
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id-slave.opt
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id.test
new file mode 100644
index 00000000000..b0308402b40
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id.test
@@ -0,0 +1,6 @@
+#################################
+# Wrapper for rpl_insert_id.test#
+#################################
+-- source include/have_tokudb.inc
+let $engine_type=tokudb;
+-- source extra/rpl_tests/rpl_insert_id.test
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id_pk.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id_pk.test
new file mode 100644
index 00000000000..103cad8a266
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_insert_id_pk.test
@@ -0,0 +1,6 @@
+#################################
+# Wrapper for rpl_insert_id.test#
+#################################
+-- source include/have_tokudb.inc
+let $engine_type=tokudb;
+-- source extra/rpl_tests/rpl_insert_id_pk.test
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update.test
new file mode 100644
index 00000000000..89a73b1506f
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update.test
@@ -0,0 +1,3 @@
+-- source include/have_tokudb.inc
+let $engine_type=TokuDB;
+-- source extra/rpl_tests/rpl_multi_update.test
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update2-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update2-slave.opt
new file mode 100644
index 00000000000..17d4171af0e
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update2-slave.opt
@@ -0,0 +1 @@
+--replicate-ignore-table=nothing.sensible
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update2.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update2.test
new file mode 100644
index 00000000000..b73b302d024
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update2.test
@@ -0,0 +1,12 @@
+#######################################################
+# Wrapper for rpl_multi_update2.test to allow multi #
+# Engines to reuse test code. By JBM 2006-02-15 #
+# Added comments section and to skip when ndb is #
+# Default engine. #
+#######################################################
+--source include/have_tokudb.inc
+--source include/master-slave.inc
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT');
+let $engine_type=TokuDB;
+--source extra/rpl_tests/rpl_multi_update2.test
+--source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update3.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update3.test
new file mode 100644
index 00000000000..2cdf44bff16
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_multi_update3.test
@@ -0,0 +1,12 @@
+#######################################################
+# Wrapper for rpl_multi_update3.test to allow multi #
+# Engines to reuse test code. By JBM 2006-02-15 #
+# Added comments section and to skip when ndb is #
+# Default engine. #
+#######################################################
+--source include/have_tokudb.inc
+--source include/master-slave.inc
+call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
+let $engine_type=TokuDB;
+--source extra/rpl_tests/rpl_multi_update3.test
+--source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_tokudb_rfr_partition_table-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_rfr_partition_table-slave.opt
index 2a7ec2590cc..2a7ec2590cc 100644
--- a/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_tokudb_rfr_partition_table-slave.opt
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_rfr_partition_table-slave.opt
diff --git a/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_tokudb_rfr_partition_table.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_rfr_partition_table.test
index eadeda83cd5..a9cdaa57248 100644
--- a/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_tokudb_rfr_partition_table.test
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_rfr_partition_table.test
@@ -1,5 +1,7 @@
# test tokudb read free replication feature with partition table
+skip MDEV-13441;
+--source include/have_partition.inc
--source include/have_debug.inc
--source include/have_partition.inc
--source include/have_tokudb.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe-master.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe-master.opt
new file mode 100644
index 00000000000..e980c2de7ff
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe-master.opt
@@ -0,0 +1 @@
+--transaction_isolation=READ-COMMITTED
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe-slave.opt
new file mode 100644
index 00000000000..264c5c1a4b4
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe-slave.opt
@@ -0,0 +1 @@
+--skip-slave-start --relay-log-info-repository=TABLE --relay-log-recovery=1 --transaction_isolation=READ-COMMITTED
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe.test
new file mode 100644
index 00000000000..6bd79691528
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_crash_safe.test
@@ -0,0 +1,19 @@
+# This test takes long time, so only run it with the --big-test mtr-flag.
+--source include/big_test.inc
+--source include/not_embedded.inc
+--source include/not_valgrind.inc
+--source include/have_debug.inc
+--source include/have_tokudb.inc
+--source include/have_binlog_format_row.inc
+--source include/not_mts_slave_parallel_workers.inc
+--source include/master-slave.inc
+
+call mtr.add_suppression('Attempting backtrace');
+call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression(".* InnoDB: Warning: allocated tablespace .*, old maximum was .*");
+
+let $engine_type=TokuDB;
+let $database_name=test;
+--source extra/rpl_tests/rpl_crash_safe.test
+--source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_blobs.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_blobs.test
new file mode 100644
index 00000000000..ff4a0435a5e
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_blobs.test
@@ -0,0 +1,54 @@
+#Want to skip this test from daily Valgrind execution
+skip Require rpl files from MySQL;
+--source include/no_valgrind_without_big.inc
+
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+#
+# This file contains tests for WL#5096.
+#
+
+-- let $rpl_topology= 1->2->3
+-- source include/rpl_init.inc
+-- source include/have_binlog_format_row.inc
+
+#
+# WL#5096 Tests.
+#
+
+#
+# Tests combinations of binlog-row-image against mixes of MyISAM and InnoDB
+# storage engines on all three servers.
+#
+# All the combinarions need not to be separated into their own files as
+# the tests for indexes and engines mixes are, because noblobs test script
+# does not take too long time, thence we do not risk triggering PB2 timeout
+# on valgrind runs.
+#
+
+## NOBLOB
+
+-- let $row_img_set=server_1:NOBLOB:N,server_2:NOBLOB:Y,server_3:NOBLOB:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
+-- source suite/tokudb.rpl/include/rpl_tokudb_row_img_general_loop.inc
+
+## MINIMAL
+
+-- let $row_img_set=server_1:MINIMAL:N,server_2:MINIMAL:Y,server_3:MINIMAL:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
+-- source suite/tokudb.rpl/include/rpl_tokudb_row_img_general_loop.inc
+
+## FULL
+
+-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_blobs.test
+-- source suite/tokudb.rpl/include/rpl_tokudb_row_img_general_loop.inc
+
+
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_full.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_full.test
new file mode 100644
index 00000000000..68ff71752ac
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_full.test
@@ -0,0 +1,51 @@
+#Want to skip this test from daily Valgrind execution
+skip Require rpl files from MySQL;
+-- source include/no_valgrind_without_big.inc
+#
+# This file contains tests for WL#5096 and bug fixes.
+#
+
+-- source include/have_binlog_format_row.inc
+-- source include/not_gtid_enabled.inc
+
+-- let $rpl_topology= 1->2->3
+-- source include/rpl_init.inc
+
+-- connection server_1
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_2
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_3
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_1
+
+#
+# WL#5096
+#
+
+#
+# Tests for different storage engines on each server,
+# but same index structure on tables. The tests are conducted
+# using FULL binlog-row-image on all servers.
+#
+
+-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img.test
+-- source suite/tokudb.rpl/include/rpl_tokudb_row_img_general_loop.inc
+
+#
+# BUG#49100
+#
+
+-- echo ### Testing with TokuDB storage engine
+
+-- let $engine=TokuDB
+-- source extra/rpl_tests/rpl_row_empty_imgs.test
+
+
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_min.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_min.test
new file mode 100644
index 00000000000..3ba958fc691
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_min.test
@@ -0,0 +1,43 @@
+#Want to skip this test from daily Valgrind execution
+skip Require rpl files from MySQL;
+-- source include/no_valgrind_without_big.inc
+#
+# This file contains tests for WL#5096 and bug fixes.
+#
+
+-- let $rpl_topology= 1->2->3
+-- source include/rpl_init.inc
+-- source include/have_binlog_format_row.inc
+
+-- connection server_1
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_2
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_3
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_1
+
+#
+# WL#5096
+#
+
+#
+# Tests for different storage engines on each server,
+# but same index structure on tables. The tests are conducted
+# using MINIMAL binlog-row-image on all servers.
+#
+
+-- let $row_img_set=server_1:MINIMAL:N,server_2:MINIMAL:Y,server_3:MINIMAL:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img.test
+-- source suite/tokudb.rpl/include/rpl_tokudb_row_img_general_loop.inc
+
+-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
+-- source include/rpl_row_img_set.inc
+
+
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_noblob.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_noblob.test
new file mode 100644
index 00000000000..f539e3ac370
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_eng_noblob.test
@@ -0,0 +1,43 @@
+#Want to skip this test from daily Valgrind execution
+skip Require rpl files from MySQL;
+-- source include/no_valgrind_without_big.inc
+#
+# This file contains tests for WL#5096 and bug fixes.
+#
+
+-- let $rpl_topology= 1->2->3
+-- source include/rpl_init.inc
+-- source include/have_binlog_format_row.inc
+
+-- connection server_1
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_2
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_3
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_1
+
+#
+# WL#5096
+#
+
+#
+# Tests for different storage engines on each server,
+# but same index structure on tables. The tests are conducted
+# using NOBLOB binlog-row-image on all servers.
+#
+
+-- let $row_img_set=server_1:NOBLOB:N,server_2:NOBLOB:Y,server_3:NOBLOB:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img.test
+-- source suite/tokudb.rpl/include/rpl_tokudb_row_img_general_loop.inc
+
+-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
+-- source include/rpl_row_img_set.inc
+
+
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_full.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_full.test
new file mode 100644
index 00000000000..9dfd1675f53
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_full.test
@@ -0,0 +1,39 @@
+#Want to skip this test from daily Valgrind execution
+skip Require rpl files from MySQL;
+-- source include/no_valgrind_without_big.inc
+#
+# This file contains tests for WL#5096.
+#
+
+-- let $rpl_topology= 1->2->3
+-- source include/rpl_init.inc
+-- source include/have_binlog_format_row.inc
+
+-- connection server_1
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_2
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_3
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_1
+
+#
+# WL#5096 Tests.
+#
+
+#
+# Tests FULL image against a mix of MyISAM and InnoDB engines on
+# each of the three servers.
+#
+
+-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_diff_indexes.test
+-- source suite/tokudb.rpl/include/rpl_tokudb_row_img_general_loop.inc
+
+
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_min.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_min.test
new file mode 100644
index 00000000000..03e022940a6
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_min.test
@@ -0,0 +1,42 @@
+#Want to skip this test from daily Valgrind execution
+skip Require rpl files from MySQL;
+--source include/no_valgrind_without_big.inc
+#
+# This file contains tests for WL#5096.
+#
+
+--let $rpl_topology= 1->2->3
+--source include/rpl_init.inc
+-- source include/have_binlog_format_row.inc
+
+-- connection server_1
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_2
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_3
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_1
+
+#
+# WL#5096 Tests.
+#
+
+#
+# Tests MINIMAL image against a mix of MyISAM and InnoDB engines on
+# each of the three servers.
+#
+
+-- let $row_img_set=server_1:MINIMAL:N,server_2:MINIMAL:Y,server_3:MINIMAL:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_diff_indexes.test
+-- source suite/tokudb.rpl/include/rpl_tokudb_row_img_general_loop.inc
+
+-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
+-- source include/rpl_row_img_set.inc
+
+
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_noblob.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_noblob.test
new file mode 100644
index 00000000000..ed147c8902b
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_img_idx_noblob.test
@@ -0,0 +1,42 @@
+#Want to skip this test from daily Valgrind execution
+skip Require rpl files from MySQL;
+-- source include/no_valgrind_without_big.inc
+#
+# This file contains tests for WL#5096.
+#
+
+-- let $rpl_topology= 1->2->3
+-- source include/rpl_init.inc
+-- source include/have_binlog_format_row.inc
+
+-- connection server_1
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_2
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_3
+-- source include/have_innodb.inc
+-- source include/have_tokudb.inc
+-- connection server_1
+
+#
+# WL#5096
+#
+
+#
+# Tests NOBLOB image against a mix of MyISAM and InnoDB engines on
+# each of the three servers.
+#
+
+-- let $row_img_set=server_1:NOBLOB:N,server_2:NOBLOB:Y,server_3:NOBLOB:Y
+-- source include/rpl_row_img_set.inc
+
+-- let $row_img_test_script= extra/rpl_tests/rpl_row_img_diff_indexes.test
+-- source suite/tokudb.rpl/include/rpl_tokudb_row_img_general_loop.inc
+
+-- let $row_img_set=server_1:FULL:N,server_2:FULL:Y,server_3:FULL:Y
+-- source include/rpl_row_img_set.inc
+
+
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_log-master.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_log-master.opt
new file mode 100644
index 00000000000..773ec62bef2
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_log-master.opt
@@ -0,0 +1,2 @@
+--skip-external-locking
+--default-storage-engine=MyISAM
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_log.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_log.test
new file mode 100644
index 00000000000..826eb5eab86
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_log.test
@@ -0,0 +1,14 @@
+###################################
+# Wrapper for rpl_row_log.test #
+# Added wrapper so that MyISAM & #
+# Innodb and NDB could all use the#
+# Same test. NDB produced a diff #
+# bin-log #
+###################################
+-- source include/have_binlog_format_row.inc
+-- source include/have_tokudb.inc
+-- source include/master-slave.inc
+let $engine_type=TokuDB;
+-- source extra/rpl_tests/rpl_log.test
+
+--source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_lower_case_table_names-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_lower_case_table_names-slave.opt
new file mode 100644
index 00000000000..8be29bbe976
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_lower_case_table_names-slave.opt
@@ -0,0 +1 @@
+--replicate-do-db=bug_37656 --replicate-ignore-table=bug_37656.t1 --replicate-do-table=bug_37656.t2 --replicate-do-table=bug_37656.t3 --lower-case-table-names=1
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_lower_case_table_names.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_lower_case_table_names.test
new file mode 100644
index 00000000000..c9f6d9055b3
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_lower_case_table_names.test
@@ -0,0 +1,15 @@
+# BUG#37656
+#
+# For details look into extra/rpl_tests/rpl_lower_case_table_names.test
+#
+skip Missing extra/rpl_tests/rpl_lower_case_table_names.test;
+
+-- source include/not_gtid_enabled.inc
+-- source include/have_tokudb.inc
+-- source include/not_windows.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+-- let $engine=TokuDB
+-- source extra/rpl_tests/rpl_lower_case_table_names.test
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_sp003.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_sp003.test
new file mode 100644
index 00000000000..1c5be34fb23
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_sp003.test
@@ -0,0 +1,13 @@
+#################################
+# Wrapper for rpl_row_sp003.test#
+#################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/have_tokudb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+let $engine_type=TOKUDB;
+-- source extra/rpl_tests/rpl_row_sp003.test
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_sp006.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_sp006.test
new file mode 100644
index 00000000000..064339b8e68
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_sp006.test
@@ -0,0 +1,13 @@
+#################################
+# Wrapper for rpl_row_sp006.test#
+#################################
+########################################################
+# By JBM 2005-02-15 Wrapped to allow reuse of test code#
+# Added to skip if ndb is default #
+########################################################
+-- source include/have_tokudb.inc
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+let $engine_type=TokuDB;
+-- source extra/rpl_tests/rpl_row_sp006.test
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_trig004.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_trig004.test
new file mode 100644
index 00000000000..471c5f8cc3d
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_row_trig004.test
@@ -0,0 +1,18 @@
+#############################################################################
+# Original Author: JBM #
+# Original Date: Oct/18/2005 #
+#############################################################################
+# TEST: Use before insert triggers and has the second insert fail #
+#############################################################################
+# Change by JBM 2006-02-14 added to skip when NDB default engine #
+# This test has been wrapped to allow multipal engines to use same code #
+#############################################################################
+
+# Includes
+-- source include/have_binlog_format_row.inc
+-- source include/have_tokudb.inc
+-- source include/master-slave.inc
+let $engine_type=TOKUDB;
+-- source extra/rpl_tests/rpl_trig004.test
+
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_log-master.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_log-master.opt
new file mode 100644
index 00000000000..773ec62bef2
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_log-master.opt
@@ -0,0 +1,2 @@
+--skip-external-locking
+--default-storage-engine=MyISAM
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_log.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_log.test
new file mode 100644
index 00000000000..b877d555619
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_log.test
@@ -0,0 +1,14 @@
+###################################
+# Wrapper for rpl_row_log.test #
+# Added wrapper so that MyISAM & #
+# Innodb and NDB could all use the#
+# Same test. NDB produced a diff #
+# bin-log #
+###################################
+-- source include/have_binlog_format_statement.inc
+-- source include/have_tokudb.inc
+-- source include/master-slave.inc
+let $engine_type=TokuDB;
+-- source extra/rpl_tests/rpl_log.test
+
+--source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe-master.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe-master.opt
new file mode 100644
index 00000000000..e980c2de7ff
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe-master.opt
@@ -0,0 +1 @@
+--transaction_isolation=READ-COMMITTED
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe-slave.opt
new file mode 100644
index 00000000000..264c5c1a4b4
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe-slave.opt
@@ -0,0 +1 @@
+--skip-slave-start --relay-log-info-repository=TABLE --relay-log-recovery=1 --transaction_isolation=READ-COMMITTED
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe.test
new file mode 100644
index 00000000000..724550fae4a
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_crash_safe.test
@@ -0,0 +1,18 @@
+--source include/big_test.inc
+--source include/not_embedded.inc
+--source include/not_valgrind.inc
+--source include/have_debug.inc
+--source include/have_tokudb.inc
+--source include/have_binlog_format_mixed_or_statement.inc
+--source include/not_mts_slave_parallel_workers.inc
+--source include/master-slave.inc
+
+call mtr.add_suppression('Attempting backtrace');
+call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression(".* InnoDB: Warning: allocated tablespace .*, old maximum was .*");
+
+let $engine_type=TokuDB;
+let $database_name=test;
+--source extra/rpl_tests/rpl_crash_safe.test
+--source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_lower_case_table_names-slave.opt b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_lower_case_table_names-slave.opt
new file mode 100644
index 00000000000..8be29bbe976
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_lower_case_table_names-slave.opt
@@ -0,0 +1 @@
+--replicate-do-db=bug_37656 --replicate-ignore-table=bug_37656.t1 --replicate-do-table=bug_37656.t2 --replicate-do-table=bug_37656.t3 --lower-case-table-names=1
diff --git a/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_lower_case_table_names.test b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_lower_case_table_names.test
new file mode 100644
index 00000000000..f9fd0e13b83
--- /dev/null
+++ b/storage/tokudb/mysql-test/rpl/t/rpl_tokudb_stm_mixed_lower_case_table_names.test
@@ -0,0 +1,14 @@
+# BUG#37656
+#
+# For details look into extra/rpl_tests/rpl_lower_case_table_names.test
+#
+skip Missing extra/rpl_tests/rpl_lower_case_table_names.test;
+
+-- source include/have_tokudb.inc
+-- source include/not_windows.inc
+-- source include/have_binlog_format_mixed_or_statement.inc
+-- source include/master-slave.inc
+
+-- let $engine=TokuDB
+-- source extra/rpl_tests/rpl_lower_case_table_names.test
+-- source include/rpl_end.inc
diff --git a/storage/tokudb/mysql-test/tokudb/r/kill_query_blocked_in_lt.result b/storage/tokudb/mysql-test/tokudb/r/kill_query_blocked_in_lt.result
new file mode 100644
index 00000000000..27423a840e8
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb/r/kill_query_blocked_in_lt.result
@@ -0,0 +1,26 @@
+### connection default
+CREATE TABLE t (a INT PRIMARY KEY, b INT) ENGINE=TokuDB;
+INSERT INTO t (a, b) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5),
+(6, 6), (7, 7), (8, 8), (9, 9), (10, 10),
+(11, 11), (12, 12), (13, 13), (14, 14), (15, 15),
+(16, 16), (17, 17), (18, 18), (19, 19), (20, 20);
+### connection con1
+SET DEBUG_SYNC= 'toku_range_lock_granted_immediately SIGNAL lock_granted WAIT_FOR lock_granted_continue';
+UPDATE t SET b=1 WHERE a BETWEEN 5 AND 10;
+### connection default
+SET DEBUG_SYNC= 'now WAIT_FOR lock_granted';
+### connection con2
+SET DEBUG_SYNC= 'toku_range_lock_before_wait SIGNAL lock_not_granted WAIT_FOR lock_not_granted_continue';
+SET DEBUG_SYNC= 'toku_range_lock_not_granted_after_wait SIGNAL lock_not_granted_after_wait';
+UPDATE t SET b=1 WHERE a BETWEEN 5 AND 10;
+### connection default
+SET DEBUG_SYNC= 'now SIGNAL lock_not_granted_continue WAIT_FOR lock_not_granted';
+KILL QUERY con2_id
+SET DEBUG_SYNC= 'now SIGNAL lock_granted_continue WAIT_FOR lock_not_granted_after_wait';
+### connection con1
+### reap
+### connection con2
+### reap
+ERROR 70100: Query execution was interrupted
+### connection default
+DROP TABLE t;
diff --git a/storage/tokudb/mysql-test/tokudb/r/locks-select-update-3.result b/storage/tokudb/mysql-test/tokudb/r/locks-select-update-3.result
index c1f05cdafd8..3f05f65661c 100644
--- a/storage/tokudb/mysql-test/tokudb/r/locks-select-update-3.result
+++ b/storage/tokudb/mysql-test/tokudb/r/locks-select-update-3.result
@@ -1,6 +1,4 @@
-SET DEFAULT_STORAGE_ENGINE='tokudb';
-drop table if exists t;
-create table t (a int primary key, b int);
+create table t (a int primary key, b int) engine=tokudb;
insert into t values (1,0);
set session transaction isolation level read committed;
begin;
@@ -8,7 +6,7 @@ select * from t where a=1 for update;
a b
1 0
update t set b=b+1 where a=1;
-set session tokudb_lock_timeout= 60000;
+set session tokudb_lock_timeout=60000;
set session transaction isolation level read committed;
begin;
select * from t where a=1 for update;
diff --git a/storage/tokudb/mysql-test/tokudb/t/kill_query_blocked_in_lt.test b/storage/tokudb/mysql-test/tokudb/t/kill_query_blocked_in_lt.test
new file mode 100644
index 00000000000..f1412f0cd40
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb/t/kill_query_blocked_in_lt.test
@@ -0,0 +1,57 @@
+--source include/have_tokudb.inc
+--source include/have_debug_sync.inc
+
+--echo ### connection default
+
+skip MDEV-13442;
+CREATE TABLE t (a INT PRIMARY KEY, b INT) ENGINE=TokuDB;
+
+INSERT INTO t (a, b) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5),
+ (6, 6), (7, 7), (8, 8), (9, 9), (10, 10),
+ (11, 11), (12, 12), (13, 13), (14, 14), (15, 15),
+ (16, 16), (17, 17), (18, 18), (19, 19), (20, 20);
+
+--connect(con1, localhost, root)
+--connect(con2, localhost, root)
+
+--connection con1
+--echo ### connection con1
+SET DEBUG_SYNC= 'toku_range_lock_granted_immediately SIGNAL lock_granted WAIT_FOR lock_granted_continue';
+--send UPDATE t SET b=1 WHERE a BETWEEN 5 AND 10
+
+--connection default
+--echo ### connection default
+SET DEBUG_SYNC= 'now WAIT_FOR lock_granted';
+
+--connection con2
+--echo ### connection con2
+--let $con2_id= `SELECT CONNECTION_ID()`
+SET DEBUG_SYNC= 'toku_range_lock_before_wait SIGNAL lock_not_granted WAIT_FOR lock_not_granted_continue';
+SET DEBUG_SYNC= 'toku_range_lock_not_granted_after_wait SIGNAL lock_not_granted_after_wait';
+--send UPDATE t SET b=1 WHERE a BETWEEN 5 AND 10
+
+--connection default
+--echo ### connection default
+SET DEBUG_SYNC= 'now SIGNAL lock_not_granted_continue WAIT_FOR lock_not_granted';
+
+--disable_query_log
+--eval KILL QUERY $con2_id
+--enable_query_log
+--echo KILL QUERY con2_id
+SET DEBUG_SYNC= 'now SIGNAL lock_granted_continue WAIT_FOR lock_not_granted_after_wait';
+
+--connection con1
+--echo ### connection con1
+--echo ### reap
+--reap
+
+--connection con2
+--echo ### connection con2
+--echo ### reap
+--error ER_QUERY_INTERRUPTED
+--reap
+
+--connection default
+--echo ### connection default
+
+DROP TABLE t;
diff --git a/storage/tokudb/mysql-test/tokudb/t/locks-select-update-3.test b/storage/tokudb/mysql-test/tokudb/t/locks-select-update-3.test
index 5b54fa7313e..fcd89d5783f 100644
--- a/storage/tokudb/mysql-test/tokudb/t/locks-select-update-3.test
+++ b/storage/tokudb/mysql-test/tokudb/t/locks-select-update-3.test
@@ -1,12 +1,8 @@
source include/have_tokudb.inc;
+source include/count_sessions.inc;
# test that select for update is executed with serializable isolation
-SET DEFAULT_STORAGE_ENGINE='tokudb';
-
---disable_warnings
-drop table if exists t;
---enable_warnings
-create table t (a int primary key, b int);
+create table t (a int primary key, b int) engine=tokudb;
insert into t values (1,0);
set session transaction isolation level read committed;
begin;
@@ -15,7 +11,7 @@ select * from t where a=1 for update;
# t2 update
update t set b=b+1 where a=1;
connect(conn1,localhost,root);
-set session tokudb_lock_timeout= 60000;
+set session tokudb_lock_timeout=60000;
set session transaction isolation level read committed;
begin;
# t2 select for update, should hang until t1 commits
@@ -34,3 +30,4 @@ connection default;
disconnect conn1;
drop table t;
+source include/wait_until_count_sessions.inc;
diff --git a/storage/tokudb/mysql-test/tokudb_backup/r/rpl_safe_slave.result b/storage/tokudb/mysql-test/tokudb_backup/r/rpl_safe_slave.result
index 13b5915354f..3f742690bd8 100644
--- a/storage/tokudb/mysql-test/tokudb_backup/r/rpl_safe_slave.result
+++ b/storage/tokudb/mysql-test/tokudb_backup/r/rpl_safe_slave.result
@@ -53,8 +53,6 @@ Variable_name Value
Slave_open_temp_tables 0
### Continue backup
SET DEBUG_SYNC = "now SIGNAL ttlss_continue";
-## Reset debug_sync points
-SET DEBUG_SYNC = "RESET";
### Wait for backup finish
include/filter_file.inc
### Slave tokubackup_slave_info content:
diff --git a/storage/tokudb/mysql-test/tokudb_backup/t/rpl_safe_slave.inc b/storage/tokudb/mysql-test/tokudb_backup/t/rpl_safe_slave.inc
index e0732ee63fc..9b795008eff 100644
--- a/storage/tokudb/mysql-test/tokudb_backup/t/rpl_safe_slave.inc
+++ b/storage/tokudb/mysql-test/tokudb_backup/t/rpl_safe_slave.inc
@@ -59,9 +59,6 @@ SHOW STATUS LIKE 'Slave_open_temp_tables';
--echo ### Continue backup
SET DEBUG_SYNC = "now SIGNAL ttlss_continue";
---echo ## Reset debug_sync points
-SET DEBUG_SYNC = "RESET";
-
--connection slave_2
--echo ### Wait for backup finish
--reap
diff --git a/storage/tokudb/mysql-test/tokudb_mariadb/r/mdev12972.result b/storage/tokudb/mysql-test/tokudb_mariadb/r/mdev12972.result
new file mode 100644
index 00000000000..92aefedac69
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_mariadb/r/mdev12972.result
@@ -0,0 +1,19 @@
+CREATE TABLE t1 (pk INT PRIMARY KEY, i1 INT, c1 VARCHAR(1), KEY(c1)) ENGINE=TokuDB;
+INSERT INTO t1 VALUES
+(1,2,NULL),(2,5,'x'),(3,3,'i'),(4,1,'e'),(5,4,'p');
+CREATE TABLE t2 (i2 INT) ENGINE=TokuDB;
+INSERT INTO t2 VALUES (1),(2);
+CREATE TABLE t3 (i3 INT, c3 VARCHAR(1), KEY(i3)) ENGINE=TokuDB;
+INSERT INTO t3 VALUES
+(1,'e'),(1,'z'),(1,'i'),(1,'q'),(1,'i'),(1,'f'),(1,'m'),(2,'c'),(1,'d'),
+(2,'n'),(1,'t'),(2,'e'),(1,'w'),(2,'y'),(1,'j'),(2,'i'),(1,'f'),(2,'f'),
+(1,'s'),(2,'y');
+SET join_cache_level = 8;
+SET optimizer_switch ='mrr=on,mrr_sort_keys=on,optimize_join_buffer_size=on';
+SELECT * FROM t1 AS t1_outer WHERE EXISTS ( SELECT * FROM t2 WHERE i2 IN ( SELECT i3 FROM t3 INNER JOIN t1 AS t1_inner ON (t1_inner.c1 = c3 ) WHERE t1_inner.i1 < t1_outer.i1 ) );
+pk i1 c1
+1 2 NULL
+2 5 x
+3 3 i
+5 4 p
+DROP TABLE t1, t2, t3;
diff --git a/storage/tokudb/mysql-test/tokudb_mariadb/t/mdev12972.test b/storage/tokudb/mysql-test/tokudb_mariadb/t/mdev12972.test
new file mode 100644
index 00000000000..9d136ff0c65
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_mariadb/t/mdev12972.test
@@ -0,0 +1,26 @@
+#
+# MDEV-12972 Random and Frequent Segfault (SIG 11) During Runtime
+#
+# This was actually a memory overrun in MRR that TokuDB triggered
+#
+
+CREATE TABLE t1 (pk INT PRIMARY KEY, i1 INT, c1 VARCHAR(1), KEY(c1)) ENGINE=TokuDB;
+INSERT INTO t1 VALUES
+(1,2,NULL),(2,5,'x'),(3,3,'i'),(4,1,'e'),(5,4,'p');
+
+CREATE TABLE t2 (i2 INT) ENGINE=TokuDB;
+INSERT INTO t2 VALUES (1),(2);
+
+CREATE TABLE t3 (i3 INT, c3 VARCHAR(1), KEY(i3)) ENGINE=TokuDB;
+INSERT INTO t3 VALUES
+(1,'e'),(1,'z'),(1,'i'),(1,'q'),(1,'i'),(1,'f'),(1,'m'),(2,'c'),(1,'d'),
+(2,'n'),(1,'t'),(2,'e'),(1,'w'),(2,'y'),(1,'j'),(2,'i'),(1,'f'),(2,'f'),
+(1,'s'),(2,'y');
+
+SET join_cache_level = 8;
+SET optimizer_switch ='mrr=on,mrr_sort_keys=on,optimize_join_buffer_size=on';
+
+--sorted_result
+SELECT * FROM t1 AS t1_outer WHERE EXISTS ( SELECT * FROM t2 WHERE i2 IN ( SELECT i3 FROM t3 INNER JOIN t1 AS t1_inner ON (t1_inner.c1 = c3 ) WHERE t1_inner.i1 < t1_outer.i1 ) );
+
+DROP TABLE t1, t2, t3;
diff --git a/storage/tokudb/tokudb_information_schema.cc b/storage/tokudb/tokudb_information_schema.cc
index 2b4128cc03a..5cd0609ac74 100644
--- a/storage/tokudb/tokudb_information_schema.cc
+++ b/storage/tokudb/tokudb_information_schema.cc
@@ -76,8 +76,7 @@ int trx_callback(
uint64_t txn_id = txn->id64(txn);
uint64_t client_id;
- void *client_extra;
- txn->get_client_id(txn, &client_id, &client_extra);
+ txn->get_client_id(txn, &client_id, NULL);
uint64_t start_time = txn->get_start_time(txn);
trx_extra_t* e = reinterpret_cast<struct trx_extra_t*>(extra);
THD* thd = e->thd;
@@ -317,8 +316,7 @@ int locks_callback(
uint64_t txn_id = txn->id64(txn);
uint64_t client_id;
- void *client_extra;
- txn->get_client_id(txn, &client_id, &client_extra);
+ txn->get_client_id(txn, &client_id, NULL);
locks_extra_t* e = reinterpret_cast<struct locks_extra_t*>(extra);
THD* thd = e->thd;
TABLE* table = e->table;
diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc
index 7f5d3548acf..b1a0f2daa21 100644
--- a/storage/xtradb/buf/buf0flu.cc
+++ b/storage/xtradb/buf/buf0flu.cc
@@ -2861,7 +2861,10 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
when SRV_SHUTDOWN_CLEANUP is set other threads like the master
and the purge threads may be working as well. We start flushing
the buffer pool but can't be sure that no new pages are being
- dirtied until we enter SRV_SHUTDOWN_FLUSH_PHASE phase. */
+ dirtied until we enter SRV_SHUTDOWN_FLUSH_PHASE phase. Because
+ the LRU manager thread is also flushing at SRV_SHUTDOWN_CLEANUP
+ but not SRV_SHUTDOWN_FLUSH_PHASE, we only leave the
+ SRV_SHUTDOWN_CLEANUP loop when the LRU manager quits. */
do {
n_flushed = page_cleaner_do_flush_batch(PCT_IO(100), LSN_MAX);
@@ -2870,7 +2873,10 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
if (n_flushed == 0) {
os_thread_sleep(100000);
}
- } while (srv_shutdown_state == SRV_SHUTDOWN_CLEANUP);
+
+ os_rmb;
+ } while (srv_shutdown_state == SRV_SHUTDOWN_CLEANUP
+ || buf_lru_manager_is_active);
/* At this point all threads including the master and the purge
thread must have been suspended. */
@@ -2887,6 +2893,11 @@ DECLARE_THREAD(buf_flush_page_cleaner_thread)(
buf_flush_wait_batch_end(NULL, BUF_FLUSH_LIST);
buf_flush_wait_LRU_batch_end();
+#ifdef UNIV_DEBUG
+ os_rmb;
+ ut_ad(!buf_lru_manager_is_active);
+#endif
+
bool success;
do {
@@ -2965,6 +2976,7 @@ DECLARE_THREAD(buf_flush_lru_manager_thread)(
}
buf_lru_manager_is_active = false;
+ os_wmb;
/* 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/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index f7a2ae423f8..7550943de7a 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -1395,9 +1395,6 @@ dict_table_add_to_cache(
dict_table_autoinc_restore(table);
ut_ad(dict_lru_validate());
-
- dict_sys->size += mem_heap_get_size(table->heap)
- + strlen(table->name) + 1;
}
/**********************************************************************//**
@@ -1812,9 +1809,6 @@ dict_table_rename_in_cache(
HASH_INSERT(dict_table_t, name_hash, dict_sys->table_hash, fold,
table);
- dict_sys->size += strlen(new_name) - strlen(old_name);
- ut_a(dict_sys->size > 0);
-
/* Update the table_name field in indexes */
for (index = dict_table_get_first_index(table);
index != NULL;
@@ -2101,7 +2095,6 @@ dict_table_remove_from_cache_low(
{
dict_foreign_t* foreign;
dict_index_t* index;
- ulint size;
ut_ad(table);
ut_ad(dict_lru_validate());
@@ -2181,12 +2174,6 @@ dict_table_remove_from_cache_low(
trx_free_for_background(trx);
}
- size = mem_heap_get_size(table->heap) + strlen(table->name) + 1;
-
- ut_ad(dict_sys->size >= size);
-
- dict_sys->size -= size;
-
dict_mem_table_free(table);
}
@@ -2732,8 +2719,6 @@ undo_size_ok:
dict_index_is_ibuf(index)
? SYNC_IBUF_INDEX_TREE : SYNC_INDEX_TREE);
- dict_sys->size += mem_heap_get_size(new_index->heap);
-
dict_mem_index_free(index);
return(DB_SUCCESS);
@@ -2750,7 +2735,6 @@ dict_index_remove_from_cache_low(
ibool lru_evict) /*!< in: TRUE if index being evicted
to make room in the table LRU list */
{
- ulint size;
ulint retries = 0;
btr_search_t* info;
@@ -2819,12 +2803,6 @@ dict_index_remove_from_cache_low(
/* Remove the index from the list of indexes of the table */
UT_LIST_REMOVE(indexes, table->indexes, index);
- size = mem_heap_get_size(index->heap);
-
- ut_ad(dict_sys->size >= size);
-
- dict_sys->size -= size;
-
dict_mem_index_free(index);
}
@@ -7326,3 +7304,38 @@ dict_tf_to_row_format_string(
return(0);
}
#endif /* !UNIV_HOTBACKUP */
+
+/** Calculate the used memory occupied by the data dictionary
+table and index objects.
+@return number of bytes occupied. */
+UNIV_INTERN
+ulint
+dict_sys_get_size()
+{
+ ulint size = 0;
+
+ ut_ad(dict_sys);
+
+ mutex_enter(&dict_sys->mutex);
+
+ for(ulint i = 0; i < hash_get_n_cells(dict_sys->table_hash); i++) {
+ dict_table_t* table;
+
+ for (table = static_cast<dict_table_t*>(HASH_GET_FIRST(dict_sys->table_hash,i));
+ table != NULL;
+ table = static_cast<dict_table_t*>(HASH_GET_NEXT(name_hash, table))) {
+ dict_index_t* index;
+ size += mem_heap_get_size(table->heap) + strlen(table->name) +1;
+
+ for(index = dict_table_get_first_index(table);
+ index != NULL;
+ index = dict_table_get_next_index(index)) {
+ size += mem_heap_get_size(index->heap);
+ }
+ }
+ }
+
+ mutex_exit(&dict_sys->mutex);
+
+ return (size);
+}
diff --git a/storage/xtradb/handler/xtradb_i_s.cc b/storage/xtradb/handler/xtradb_i_s.cc
index eaf7da733bf..b3c79975fb3 100644
--- a/storage/xtradb/handler/xtradb_i_s.cc
+++ b/storage/xtradb/handler/xtradb_i_s.cc
@@ -314,19 +314,20 @@ static int xtradb_internal_hash_tables_fill_table(THD* thd, TABLE_LIST* tables,
if (dict_sys)
{
+ ulint dict_size = dict_sys_get_size();
OK(field_store_string(fields[INT_HASH_TABLES_NAME],
"Dictionary Cache"));
OK(field_store_ulint(fields[INT_HASH_TABLES_TOTAL],
((dict_sys->table_hash->n_cells
+ dict_sys->table_id_hash->n_cells
) * sizeof(hash_cell_t)
- + dict_sys->size)));
+ + dict_size)));
OK(field_store_ulint(fields[INT_HASH_TABLES_CONSTANT],
((dict_sys->table_hash->n_cells
+ dict_sys->table_id_hash->n_cells
) * sizeof(hash_cell_t))));
OK(field_store_ulint(fields[INT_HASH_TABLES_VARIABLE],
- dict_sys->size));
+ dict_size));
OK(schema_table_store_record(thd, table));
}
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h
index 0290b884ece..a43b04d9d1e 100644
--- a/storage/xtradb/include/dict0dict.h
+++ b/storage/xtradb/include/dict0dict.h
@@ -1653,9 +1653,6 @@ struct dict_sys_t{
on name */
hash_table_t* table_id_hash; /*!< hash table of the tables, based
on id */
- ulint size; /*!< varying space in bytes occupied
- by the data dictionary table and
- index objects */
dict_table_t* sys_tables; /*!< SYS_TABLES table */
dict_table_t* sys_columns; /*!< SYS_COLUMNS table */
dict_table_t* sys_indexes; /*!< SYS_INDEXES table */
@@ -1898,6 +1895,13 @@ dict_table_get_index_on_first_col(
ulint col_index); /*!< in: position of column
in table */
+/** Calculate the used memory occupied by the data dictionary
+table and index objects.
+@return number of bytes occupied. */
+UNIV_INTERN
+ulint
+dict_sys_get_size();
+
#endif /* !UNIV_HOTBACKUP */
#ifndef UNIV_NONINL
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 23c8c0a659d..739f6640eef 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -48,7 +48,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_BUGFIX 36
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 82.0
+#define PERCONA_INNODB_VERSION 82.1
#endif
/* Enable UNIV_LOG_ARCHIVE in XtraDB */
diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc
index 833f3240369..31a2cad05eb 100644
--- a/storage/xtradb/log/log0log.cc
+++ b/storage/xtradb/log/log0log.cc
@@ -3635,6 +3635,7 @@ wait_suspend_loop:
before proceeding further. */
count = 0;
+ os_rmb;
while (buf_page_cleaner_is_active || buf_lru_manager_is_active) {
if (srv_print_verbose_log && count == 0) {
ib_logf(IB_LOG_LEVEL_INFO,
@@ -3646,6 +3647,7 @@ wait_suspend_loop:
if (count > 600) {
count = 0;
}
+ os_rmb;
}
if (log_scrub_thread_active) {
diff --git a/storage/xtradb/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/xtradb/mysql-test/storage_engine/type_spatial_indexes.rdiff
index 154116b748c..e312cf8f65c 100644
--- a/storage/xtradb/mysql-test/storage_engine/type_spatial_indexes.rdiff
+++ b/storage/xtradb/mysql-test/storage_engine/type_spatial_indexes.rdiff
@@ -352,8 +352,8 @@
-116 0
-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
-fid AsText(Centroid(g))
--117 POINT(55.58852775304245 17.426536064113982)
--118 POINT(55.58852775304245 17.426536064113982)
+-117 POINT(57.98031067576927 17.854754130800433)
+-118 POINT(57.98031067576927 17.854754130800433)
-119 POINT(2 2)
-SELECT fid, Area(g) FROM gis_multi_polygon;
-fid Area(g)
diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc
index 0942dcc41d0..1f1fef6bea6 100644
--- a/storage/xtradb/srv/srv0srv.cc
+++ b/storage/xtradb/srv/srv0srv.cc
@@ -1605,6 +1605,8 @@ srv_printf_innodb_monitor(
recv_sys_subtotal = ((recv_sys && recv_sys->addr_hash)
? mem_heap_get_size(recv_sys->heap) : 0);
+ ulint dict_size = dict_sys ? dict_sys_get_size() : 0;
+
fprintf(file,
"Internal hash tables (constant factor + variable factor)\n"
" Adaptive hash index %lu \t(%lu + " ULINTPF ")\n"
@@ -1623,11 +1625,11 @@ srv_printf_innodb_monitor(
(ulong) (dict_sys ? ((dict_sys->table_hash->n_cells
+ dict_sys->table_id_hash->n_cells
) * sizeof(hash_cell_t)
- + dict_sys->size) : 0),
+ + dict_size) : 0),
(ulong) (dict_sys ? ((dict_sys->table_hash->n_cells
+ dict_sys->table_id_hash->n_cells
) * sizeof(hash_cell_t)) : 0),
- dict_sys ? (dict_sys->size) : 0,
+ dict_size,
(ulong) (fil_system_hash_cells() * sizeof(hash_cell_t)
+ fil_system_hash_nodes()),
@@ -1648,7 +1650,7 @@ srv_printf_innodb_monitor(
fprintf(file, "Dictionary memory allocated " ULINTPF "\n",
- dict_sys ? dict_sys->size : 0);
+ dict_sys ? dict_sys_get_size() : 0);
buf_print_io(file);
@@ -1810,7 +1812,7 @@ srv_export_innodb_status(void)
mem_dictionary = (dict_sys ? ((dict_sys->table_hash->n_cells
+ dict_sys->table_id_hash->n_cells
) * sizeof(hash_cell_t)
- + dict_sys->size) : 0);
+ + dict_sys_get_size()) : 0);
mutex_enter(&srv_innodb_monitor_mutex);