summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/galera/r
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/galera/r')
-rw-r--r--mysql-test/suite/galera/r/GAL-382.result13
-rw-r--r--mysql-test/suite/galera/r/GAL-401.result29
-rw-r--r--mysql-test/suite/galera/r/GAL-419.result15
-rw-r--r--mysql-test/suite/galera/r/GAL-480.result42
-rw-r--r--mysql-test/suite/galera/r/GCF-360.result24
-rw-r--r--mysql-test/suite/galera/r/GCF-939.result13
-rw-r--r--mysql-test/suite/galera/r/MDEV-10715.result30
-rw-r--r--mysql-test/suite/galera/r/MDEV-15443.result17
-rw-r--r--mysql-test/suite/galera/r/MDEV-16509.result76
-rw-r--r--mysql-test/suite/galera/r/MDEV-18832.result14
-rw-r--r--mysql-test/suite/galera/r/MDEV-20225.result23
-rw-r--r--mysql-test/suite/galera/r/MDEV-20616.result114
-rw-r--r--mysql-test/suite/galera/r/MDEV-20793.result44
-rw-r--r--mysql-test/suite/galera/r/MDEV-21479.result95
-rw-r--r--mysql-test/suite/galera/r/MDEV-22021.result57
-rw-r--r--mysql-test/suite/galera/r/MDEV-22051.result21
-rw-r--r--mysql-test/suite/galera/r/MDEV-22055.result18
-rw-r--r--mysql-test/suite/galera/r/MDEV-22227.result16
-rw-r--r--mysql-test/suite/galera/r/MDEV-22421.result7
-rw-r--r--mysql-test/suite/galera/r/MDEV-22458.result10
-rw-r--r--mysql-test/suite/galera/r/MDEV-22708.result11
-rw-r--r--mysql-test/suite/galera/r/MDEV-24063.result10
-rw-r--r--mysql-test/suite/galera/r/MDEV-24143.result23
-rw-r--r--mysql-test/suite/galera/r/MDEV-24327.result35
-rw-r--r--mysql-test/suite/galera/r/MDEV-25389.result17
-rw-r--r--mysql-test/suite/galera/r/MDEV-25494.result14
-rw-r--r--mysql-test/suite/galera/r/MDEV-25562.result6
-rw-r--r--mysql-test/suite/galera/r/MDEV-25740.result9
-rw-r--r--mysql-test/suite/galera/r/MDEV-26575.result11
-rw-r--r--mysql-test/suite/galera/r/MDEV-26597.result19
-rw-r--r--mysql-test/suite/galera/r/MDEV-27001.result6
-rw-r--r--mysql-test/suite/galera/r/MDEV-27123.result17
-rw-r--r--mysql-test/suite/galera/r/MDEV-27276.result36
-rw-r--r--mysql-test/suite/galera/r/MDEV-27862.result49
-rw-r--r--mysql-test/suite/galera/r/MDEV-28053.result14
-rw-r--r--mysql-test/suite/galera/r/MDEV-29142.result45
-rw-r--r--mysql-test/suite/galera/r/MDEV-29293.result21
-rw-r--r--mysql-test/suite/galera/r/MDEV-29512.result40
-rw-r--r--mysql-test/suite/galera/r/MDEV-30804.result11
-rw-r--r--mysql-test/suite/galera/r/MDEV-30955.result26
-rw-r--r--mysql-test/suite/galera/r/MDEV-6860.result14
-rw-r--r--mysql-test/suite/galera/r/MENT-1047.result4
-rw-r--r--mysql-test/suite/galera/r/MW-252.result12
-rw-r--r--mysql-test/suite/galera/r/MW-258.result45
-rw-r--r--mysql-test/suite/galera/r/MW-259.result21
-rw-r--r--mysql-test/suite/galera/r/MW-284.result32
-rw-r--r--mysql-test/suite/galera/r/MW-285.result21
-rw-r--r--mysql-test/suite/galera/r/MW-286.result24
-rw-r--r--mysql-test/suite/galera/r/MW-292.result50
-rw-r--r--mysql-test/suite/galera/r/MW-309.result24
-rw-r--r--mysql-test/suite/galera/r/MW-313.result34
-rw-r--r--mysql-test/suite/galera/r/MW-329.result23
-rw-r--r--mysql-test/suite/galera/r/MW-336.result83
-rw-r--r--mysql-test/suite/galera/r/MW-357.result11
-rw-r--r--mysql-test/suite/galera/r/MW-369.result284
-rw-r--r--mysql-test/suite/galera/r/MW-388.result50
-rw-r--r--mysql-test/suite/galera/r/MW-402.result252
-rw-r--r--mysql-test/suite/galera/r/MW-416.result102
-rw-r--r--mysql-test/suite/galera/r/MW-44.result13
-rw-r--r--mysql-test/suite/galera/r/MW-86-wait1.result48
-rw-r--r--mysql-test/suite/galera/r/MW-86-wait8.result49
-rw-r--r--mysql-test/suite/galera/r/basic.result36
-rw-r--r--mysql-test/suite/galera/r/binlog_checksum.result45
-rw-r--r--mysql-test/suite/galera/r/create.result98
-rw-r--r--mysql-test/suite/galera/r/enforce_storage_engine.result27
-rw-r--r--mysql-test/suite/galera/r/enforce_storage_engine2.result29
-rw-r--r--mysql-test/suite/galera/r/ev51914.result175
-rw-r--r--mysql-test/suite/galera/r/fk.result105
-rw-r--r--mysql-test/suite/galera/r/galera#414.result15
-rw-r--r--mysql-test/suite/galera/r/galera#500.result18
-rw-r--r--mysql-test/suite/galera/r/galera#505.result11
-rw-r--r--mysql-test/suite/galera/r/galera-features#117.result40
-rw-r--r--mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result382
-rw-r--r--mysql-test/suite/galera/r/galera_MDEV-29512.result40
-rw-r--r--mysql-test/suite/galera/r/galera_UK_conflict.result181
-rw-r--r--mysql-test/suite/galera/r/galera_admin.result117
-rw-r--r--mysql-test/suite/galera/r/galera_alter_engine_innodb.result13
-rw-r--r--mysql-test/suite/galera/r/galera_alter_engine_myisam.result28
-rw-r--r--mysql-test/suite/galera/r/galera_alter_table_force.result13
-rw-r--r--mysql-test/suite/galera/r/galera_applier_ftwrl_table.result22
-rw-r--r--mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result31
-rw-r--r--mysql-test/suite/galera/r/galera_as_master.result61
-rw-r--r--mysql-test/suite/galera/r/galera_as_master_large.result38
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave.result32
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_autoinc.result100
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_ctas.result31
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_gtid.result38
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_gtid_auto_engine.result41
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result49
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_nonprim.result34
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_replay.result73
-rw-r--r--mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result48
-rw-r--r--mysql-test/suite/galera/r/galera_backup_stage.result78
-rw-r--r--mysql-test/suite/galera/r/galera_backup_start.result6
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort.result17
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_at_after_statement.result27
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result20
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_for_update.result31
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result13
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_get_lock.result18
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_group_commit.result685
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_lock_table.result17
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result58
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_ps.result16
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_ps_bind.result38
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_ps_threadpool.result22
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_shutdown.result15
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_sleep.result14
-rw-r--r--mysql-test/suite/galera/r/galera_bf_background_statistics.result35
-rw-r--r--mysql-test/suite/galera/r/galera_bf_kill.result73
-rw-r--r--mysql-test/suite/galera/r/galera_bf_kill_debug.result54
-rw-r--r--mysql-test/suite/galera/r/galera_bf_lock_wait.result46
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_cache_size.result15
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_checksum.result30
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result12
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result9
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_row_image.result95
-rw-r--r--mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result205
-rw-r--r--mysql-test/suite/galera/r/galera_cache_index.result49
-rw-r--r--mysql-test/suite/galera/r/galera_can_run_toi.result37
-rw-r--r--mysql-test/suite/galera/r/galera_change_user.result14
-rw-r--r--mysql-test/suite/galera/r/galera_commit_empty.result15
-rw-r--r--mysql-test/suite/galera/r/galera_concurrent_ctas.result30
-rw-r--r--mysql-test/suite/galera/r/galera_create_function.result66
-rw-r--r--mysql-test/suite/galera/r/galera_create_procedure.result62
-rw-r--r--mysql-test/suite/galera/r/galera_create_table_as_select.result104
-rw-r--r--mysql-test/suite/galera/r/galera_create_table_like.result56
-rw-r--r--mysql-test/suite/galera/r/galera_create_trigger.result47
-rw-r--r--mysql-test/suite/galera/r/galera_create_view.result4
-rw-r--r--mysql-test/suite/galera/r/galera_ctas.result88
-rw-r--r--mysql-test/suite/galera/r/galera_ddl_fk_conflict.result274
-rw-r--r--mysql-test/suite/galera/r/galera_ddl_fk_no_conflict.result330
-rw-r--r--mysql-test/suite/galera/r/galera_ddl_multiline.result91
-rw-r--r--mysql-test/suite/galera/r/galera_defaults.result61
-rw-r--r--mysql-test/suite/galera/r/galera_delete_limit.result26
-rw-r--r--mysql-test/suite/galera/r/galera_desync_overlapped.result52
-rw-r--r--mysql-test/suite/galera/r/galera_disallow_local_gtid.result99
-rw-r--r--mysql-test/suite/galera/r/galera_drop_database.result53
-rw-r--r--mysql-test/suite/galera/r/galera_drop_multi.result24
-rw-r--r--mysql-test/suite/galera/r/galera_encrypt_tmp_files.result39
-rw-r--r--mysql-test/suite/galera/r/galera_enum.result53
-rw-r--r--mysql-test/suite/galera/r/galera_events.result31
-rw-r--r--mysql-test/suite/galera/r/galera_events2.result126
-rw-r--r--mysql-test/suite/galera/r/galera_fk_cascade_delete.result160
-rw-r--r--mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result66
-rw-r--r--mysql-test/suite/galera/r/galera_fk_cascade_update.result34
-rw-r--r--mysql-test/suite/galera/r/galera_fk_conflict.result29
-rw-r--r--mysql-test/suite/galera/r/galera_fk_lock_wait.result54
-rw-r--r--mysql-test/suite/galera/r/galera_fk_mismatch.result30
-rw-r--r--mysql-test/suite/galera/r/galera_fk_multibyte.result35
-rw-r--r--mysql-test/suite/galera/r/galera_fk_multicolumn.result39
-rw-r--r--mysql-test/suite/galera/r/galera_fk_multitable.result26
-rw-r--r--mysql-test/suite/galera/r/galera_fk_no_pk.result33
-rw-r--r--mysql-test/suite/galera/r/galera_fk_selfreferential.result17
-rw-r--r--mysql-test/suite/galera/r/galera_fk_setnull.result36
-rw-r--r--mysql-test/suite/galera/r/galera_fk_truncate.result47
-rw-r--r--mysql-test/suite/galera/r/galera_flush_local.result161
-rw-r--r--mysql-test/suite/galera/r/galera_forced_binlog_format.result36
-rw-r--r--mysql-test/suite/galera/r/galera_forced_binlog_format_ctas.result273
-rw-r--r--mysql-test/suite/galera/r/galera_ftwrl.result21
-rw-r--r--mysql-test/suite/galera/r/galera_ftwrl_concurrent.result122
-rw-r--r--mysql-test/suite/galera/r/galera_ftwrl_drain.result40
-rw-r--r--mysql-test/suite/galera/r/galera_fulltext.result94
-rw-r--r--mysql-test/suite/galera/r/galera_gcache_recover.result25
-rw-r--r--mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result36
-rw-r--r--mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result139
-rw-r--r--mysql-test/suite/galera/r/galera_gcs_fc_limit.result27
-rw-r--r--mysql-test/suite/galera/r/galera_gcs_fragment.result37
-rw-r--r--mysql-test/suite/galera/r/galera_gcs_max_packet_size.result18
-rw-r--r--mysql-test/suite/galera/r/galera_gra_log.result38
-rw-r--r--mysql-test/suite/galera/r/galera_gtid.result14
-rw-r--r--mysql-test/suite/galera/r/galera_gtid_server_id.result83
-rw-r--r--mysql-test/suite/galera/r/galera_gtid_slave.result45
-rw-r--r--mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result170
-rw-r--r--mysql-test/suite/galera/r/galera_gtid_trx_conflict.result45
-rw-r--r--mysql-test/suite/galera/r/galera_inject_bf_long_wait.result24
-rw-r--r--mysql-test/suite/galera/r/galera_insert_bulk.result30
-rw-r--r--mysql-test/suite/galera/r/galera_insert_ignore.result63
-rw-r--r--mysql-test/suite/galera/r/galera_insert_multi.result79
-rw-r--r--mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff190
-rw-r--r--mysql-test/suite/galera/r/galera_ist_MDEV-28423.result519
-rw-r--r--mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff190
-rw-r--r--mysql-test/suite/galera/r/galera_ist_MDEV-28583.result519
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff190
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mariabackup.result519
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff190
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs.result174
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff200
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mysqldump,release.rdiff15
-rw-r--r--mysql-test/suite/galera/r/galera_ist_mysqldump.result367
-rw-r--r--mysql-test/suite/galera/r/galera_ist_progress.result29
-rw-r--r--mysql-test/suite/galera/r/galera_ist_recv_bind.result23
-rw-r--r--mysql-test/suite/galera/r/galera_ist_restart_joiner.result50
-rw-r--r--mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff190
-rw-r--r--mysql-test/suite/galera/r/galera_ist_rsync.result519
-rw-r--r--mysql-test/suite/galera/r/galera_kill_applier.result30
-rw-r--r--mysql-test/suite/galera/r/galera_kill_ddl.result19
-rw-r--r--mysql-test/suite/galera/r/galera_kill_group_commit.result27
-rw-r--r--mysql-test/suite/galera/r/galera_kill_nochanges.result21
-rw-r--r--mysql-test/suite/galera/r/galera_kill_smallchanges.result21
-rw-r--r--mysql-test/suite/galera/r/galera_last_committed_id.result37
-rw-r--r--mysql-test/suite/galera/r/galera_load_data.result57
-rw-r--r--mysql-test/suite/galera/r/galera_lock_table.result31
-rw-r--r--mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result12
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin.result81
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin_ext.result69
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin_ext_mariabackup.result69
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin_opt.result81
-rw-r--r--mysql-test/suite/galera/r/galera_log_output_csv.result24
-rw-r--r--mysql-test/suite/galera/r/galera_many_columns.result42
-rw-r--r--mysql-test/suite/galera/r/galera_many_indexes.result137
-rw-r--r--mysql-test/suite/galera/r/galera_many_rows.result44
-rw-r--r--mysql-test/suite/galera/r/galera_many_tables_nopk.result25
-rw-r--r--mysql-test/suite/galera/r/galera_many_tables_pk.result31
-rw-r--r--mysql-test/suite/galera/r/galera_mdev_10812.result18
-rw-r--r--mysql-test/suite/galera/r/galera_mdev_13787.result6
-rw-r--r--mysql-test/suite/galera/r/galera_mdev_15611.result18
-rw-r--r--mysql-test/suite/galera/r/galera_mdl_race.result44
-rw-r--r--mysql-test/suite/galera/r/galera_multi_database.result35
-rw-r--r--mysql-test/suite/galera/r/galera_multirow_rollback.result73
-rw-r--r--mysql-test/suite/galera/r/galera_myisam_autocommit.result27
-rw-r--r--mysql-test/suite/galera/r/galera_myisam_transactions.result50
-rw-r--r--mysql-test/suite/galera/r/galera_nonPK_and_PA.result63
-rw-r--r--mysql-test/suite/galera/r/galera_nopk_bit.result35
-rw-r--r--mysql-test/suite/galera/r/galera_nopk_blob.result35
-rw-r--r--mysql-test/suite/galera/r/galera_nopk_large_varchar.result38
-rw-r--r--mysql-test/suite/galera/r/galera_nopk_unicode.result31
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result40
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result40
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result37
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_simple.result39
-rw-r--r--mysql-test/suite/galera/r/galera_partition.result417
-rw-r--r--mysql-test/suite/galera/r/galera_password.result24
-rw-r--r--mysql-test/suite/galera/r/galera_pc_ignore_sb.result27
-rw-r--r--mysql-test/suite/galera/r/galera_pc_recovery.result37
-rw-r--r--mysql-test/suite/galera/r/galera_performance_schema.result54
-rw-r--r--mysql-test/suite/galera/r/galera_pk_bigint_signed.result34
-rw-r--r--mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result31
-rw-r--r--mysql-test/suite/galera/r/galera_prepared_statement.result38
-rw-r--r--mysql-test/suite/galera/r/galera_query_cache.result64
-rw-r--r--mysql-test/suite/galera/r/galera_query_cache_invalidate.result123
-rw-r--r--mysql-test/suite/galera/r/galera_query_cache_sync_wait.result55
-rw-r--r--mysql-test/suite/galera/r/galera_read_only.result35
-rw-r--r--mysql-test/suite/galera/r/galera_repair_view.result17
-rw-r--r--mysql-test/suite/galera/r/galera_repl_key_format_flat16.result23
-rw-r--r--mysql-test/suite/galera/r/galera_repl_max_ws_size.result15
-rw-r--r--mysql-test/suite/galera/r/galera_restart_nochanges.result19
-rw-r--r--mysql-test/suite/galera/r/galera_restart_on_unknown_option.result51
-rw-r--r--mysql-test/suite/galera/r/galera_restart_replica.result122
-rw-r--r--mysql-test/suite/galera/r/galera_roles.result214
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_add_pk.result31
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_drop_pk.result50
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_error.result26
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_simple.result27
-rw-r--r--mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result54
-rw-r--r--mysql-test/suite/galera/r/galera_savepoint_replay.result53
-rw-r--r--mysql-test/suite/galera/r/galera_sbr.result19
-rw-r--r--mysql-test/suite/galera/r/galera_sbr_binlog.result19
-rw-r--r--mysql-test/suite/galera/r/galera_schema.result114
-rw-r--r--mysql-test/suite/galera/r/galera_schema_dirty_reads.result15
-rw-r--r--mysql-test/suite/galera/r/galera_sequences.result316
-rw-r--r--mysql-test/suite/galera/r/galera_serializable.result39
-rw-r--r--mysql-test/suite/galera/r/galera_server.result28
-rw-r--r--mysql-test/suite/galera/r/galera_set_position_after_cert_failure.result36
-rw-r--r--mysql-test/suite/galera/r/galera_set_position_after_dummy_writeset.result36
-rw-r--r--mysql-test/suite/galera/r/galera_shutdown_nonprim.result11
-rw-r--r--mysql-test/suite/galera/r/galera_slave_replay.result96
-rw-r--r--mysql-test/suite/galera/r/galera_sp_bf_abort.result356
-rw-r--r--mysql-test/suite/galera/r/galera_sp_insert_parallel.result41
-rw-r--r--mysql-test/suite/galera/r/galera_split_brain.result17
-rw-r--r--mysql-test/suite/galera/r/galera_sql_log_bin_zero.result16
-rw-r--r--mysql-test/suite/galera/r/galera_ssl.result21
-rw-r--r--mysql-test/suite/galera/r/galera_ssl_compression.result28
-rw-r--r--mysql-test/suite/galera/r/galera_ssl_upgrade.result33
-rw-r--r--mysql-test/suite/galera/r/galera_sst_encrypted.result348
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff192
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup.result520
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir,debug.rdiff192
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir.result520
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key-openssl.result5
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key.result6
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key_server.result6
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff192
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery.result520
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff192
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive.result522
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_lost_found.result39
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_qpress.result6
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mariabackup_table_options.result999
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff200
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump,release.rdiff15
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump.result711
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff200
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,release.rdiff15
-rw-r--r--mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result372
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff190
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync.result518
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff190
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync2.result518
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_binlogname.result174
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff190
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result518
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_capath,debug.rdiff191
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_capath.result520
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_key,debug.rdiff191
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_key.result520
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_server,debug.rdiff191
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_server.result520
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_logbasename.result174
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff188
-rw-r--r--mysql-test/suite/galera/r/galera_sst_rsync_recv_auto.result518
-rw-r--r--mysql-test/suite/galera/r/galera_status_cluster.result16
-rw-r--r--mysql-test/suite/galera/r/galera_status_local_index.result18
-rw-r--r--mysql-test/suite/galera/r/galera_status_local_state.result16
-rw-r--r--mysql-test/suite/galera/r/galera_strict_require_innodb.result120
-rw-r--r--mysql-test/suite/galera/r/galera_strict_require_primary_key.result209
-rw-r--r--mysql-test/suite/galera/r/galera_suspend_slave.result24
-rw-r--r--mysql-test/suite/galera/r/galera_sync_wait_show.result56
-rw-r--r--mysql-test/suite/galera/r/galera_sync_wait_upto.result27
-rw-r--r--mysql-test/suite/galera/r/galera_temporary_sequences.result46
-rw-r--r--mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result58
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_error.result26
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result44
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result31
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_locking.result60
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result29
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ddl_sequential.result41
-rw-r--r--mysql-test/suite/galera/r/galera_toi_drop_database.result34
-rw-r--r--mysql-test/suite/galera/r/galera_toi_ftwrl.result17
-rw-r--r--mysql-test/suite/galera/r/galera_toi_lock_exclusive.result24
-rw-r--r--mysql-test/suite/galera/r/galera_toi_lock_shared.result26
-rw-r--r--mysql-test/suite/galera/r/galera_toi_truncate.result33
-rw-r--r--mysql-test/suite/galera/r/galera_transaction_read_only.result32
-rw-r--r--mysql-test/suite/galera/r/galera_transaction_replay.result148
-rw-r--r--mysql-test/suite/galera/r/galera_trigger.result78
-rw-r--r--mysql-test/suite/galera/r/galera_truncate.result49
-rw-r--r--mysql-test/suite/galera/r/galera_truncate_temporary.result74
-rw-r--r--mysql-test/suite/galera/r/galera_unicode_identifiers.result52
-rw-r--r--mysql-test/suite/galera/r/galera_unicode_pk.result43
-rw-r--r--mysql-test/suite/galera/r/galera_update_limit.result24
-rw-r--r--mysql-test/suite/galera/r/galera_v1_row_events.result15
-rw-r--r--mysql-test/suite/galera/r/galera_var_OSU_method.result26
-rw-r--r--mysql-test/suite/galera/r/galera_var_OSU_method2.result28
-rw-r--r--mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result73
-rw-r--r--mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result43
-rw-r--r--mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result32
-rw-r--r--mysql-test/suite/galera/r/galera_var_cluster_address.result54
-rw-r--r--mysql-test/suite/galera/r/galera_var_cluster_conf_id.result10
-rw-r--r--mysql-test/suite/galera/r/galera_var_desync_on.result37
-rw-r--r--mysql-test/suite/galera/r/galera_var_dirty_reads.result55
-rw-r--r--mysql-test/suite/galera/r/galera_var_fkchecks.result30
-rw-r--r--mysql-test/suite/galera/r/galera_var_gtid_domain_id.result96
-rw-r--r--mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result186
-rw-r--r--mysql-test/suite/galera/r/galera_var_load_data_splitting.result22
-rw-r--r--mysql-test/suite/galera/r/galera_var_log_bin.result15
-rw-r--r--mysql-test/suite/galera/r/galera_var_max_ws_rows.result142
-rw-r--r--mysql-test/suite/galera/r/galera_var_max_ws_size.result20
-rw-r--r--mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result19
-rw-r--r--mysql-test/suite/galera/r/galera_var_node_address.result22
-rw-r--r--mysql-test/suite/galera/r/galera_var_notify_cmd.result13
-rw-r--r--mysql-test/suite/galera/r/galera_var_notify_ssl_ipv6.result13
-rw-r--r--mysql-test/suite/galera/r/galera_var_reject_queries.result28
-rw-r--r--mysql-test/suite/galera/r/galera_var_replicate_aria_off.result15
-rw-r--r--mysql-test/suite/galera/r/galera_var_replicate_aria_on.result271
-rw-r--r--mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result10
-rw-r--r--mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result238
-rw-r--r--mysql-test/suite/galera/r/galera_var_retry_autocommit.result86
-rw-r--r--mysql-test/suite/galera/r/galera_var_slave_threads.result60
-rw-r--r--mysql-test/suite/galera/r/galera_var_sst_auth.result22
-rw-r--r--mysql-test/suite/galera/r/galera_var_sync_wait.result36
-rw-r--r--mysql-test/suite/galera/r/galera_var_trx_fragment_size.result95
-rw-r--r--mysql-test/suite/galera/r/galera_var_wsrep_mode.result79
-rw-r--r--mysql-test/suite/galera/r/galera_var_wsrep_on_off.result132
-rw-r--r--mysql-test/suite/galera/r/galera_var_wsrep_provider_options.result10
-rw-r--r--mysql-test/suite/galera/r/galera_var_wsrep_start_position.result105
-rw-r--r--mysql-test/suite/galera/r/galera_view.result5
-rw-r--r--mysql-test/suite/galera/r/galera_virtual_blob.result21
-rw-r--r--mysql-test/suite/galera/r/galera_virtual_column.result19
-rw-r--r--mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result66
-rw-r--r--mysql-test/suite/galera/r/galera_vote_rejoin_dml.result73
-rw-r--r--mysql-test/suite/galera/r/galera_wan.result23
-rw-r--r--mysql-test/suite/galera/r/galera_wan_restart_ist.result109
-rw-r--r--mysql-test/suite/galera/r/galera_wan_restart_sst.result94
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result43
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_log_conficts.result27
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_mode.result16
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_new_cluster.result52
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result7
-rw-r--r--mysql-test/suite/galera/r/galera_zero_length_column.result43
-rw-r--r--mysql-test/suite/galera/r/grant.result23
-rw-r--r--mysql-test/suite/galera/r/have_wsrep_replicate_myisam.require2
-rw-r--r--mysql-test/suite/galera/r/lp1276424.result14
-rw-r--r--mysql-test/suite/galera/r/lp1347768.result19
-rw-r--r--mysql-test/suite/galera/r/lp1376747-2.result28
-rw-r--r--mysql-test/suite/galera/r/lp1376747-3.result29
-rw-r--r--mysql-test/suite/galera/r/lp1376747-4.result48
-rw-r--r--mysql-test/suite/galera/r/lp1376747.result28
-rw-r--r--mysql-test/suite/galera/r/lp1438990.result24
-rw-r--r--mysql-test/suite/galera/r/lp959512.result26
-rw-r--r--mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result257
-rw-r--r--mysql-test/suite/galera/r/mdev-22543.result19
-rw-r--r--mysql-test/suite/galera/r/mdev-26175.result24
-rw-r--r--mysql-test/suite/galera/r/mdev-28433.result25
-rw-r--r--mysql-test/suite/galera/r/mdev-30013.result17
-rw-r--r--mysql-test/suite/galera/r/mdev-31285.result23
-rw-r--r--mysql-test/suite/galera/r/mdev-31651.result11
-rw-r--r--mysql-test/suite/galera/r/mdev_10518.result96
-rw-r--r--mysql-test/suite/galera/r/mdev_18730.result27
-rw-r--r--mysql-test/suite/galera/r/mdev_21025.result11
-rw-r--r--mysql-test/suite/galera/r/mdev_21718.result16
-rw-r--r--mysql-test/suite/galera/r/mdev_9290.result21
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#110.result43
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#198.result33
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#201.result6
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#237.result20
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#247.result14
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#31.result20
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff201
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#33,release.rdiff15
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#33.result714
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#332.result141
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep#90.result46
-rw-r--r--mysql-test/suite/galera/r/mysql-wsrep-bugs-607.result31
-rw-r--r--mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result154
-rw-r--r--mysql-test/suite/galera/r/partition.result167
-rw-r--r--mysql-test/suite/galera/r/rename.result48
-rw-r--r--mysql-test/suite/galera/r/rpl_row_annotate.result77
-rw-r--r--mysql-test/suite/galera/r/sql_log_bin.result59
-rw-r--r--mysql-test/suite/galera/r/unique_key.result57
-rw-r--r--mysql-test/suite/galera/r/versioning_trx_id.result57
-rw-r--r--mysql-test/suite/galera/r/view.result58
-rw-r--r--mysql-test/suite/galera/r/wsrep_mode_strict_replication.result194
-rw-r--r--mysql-test/suite/galera/r/wsrep_slave_threads_basic.result51
-rw-r--r--mysql-test/suite/galera/r/wsrep_trx_fragment_size_sr.result15
434 files changed, 36507 insertions, 0 deletions
diff --git a/mysql-test/suite/galera/r/GAL-382.result b/mysql-test/suite/galera/r/GAL-382.result
new file mode 100644
index 00000000..21503267
--- /dev/null
+++ b/mysql-test/suite/galera/r/GAL-382.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+connection node_1;
+create table t1 (i int, j int, k int, primary key pk(i)) engine=innodb;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
+insert into t1 values (1, 1, 1), (2, 2, 2), (3, 3, 3);
+create table t2 (i int, j int, k int, primary key pk(i, j, k), index idx(i, k, j)) engine=innodb;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
+replace into t2 (i, j, k) select /*!99997 */ i, k, j from t1;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/GAL-401.result b/mysql-test/suite/galera/r/GAL-401.result
new file mode 100644
index 00000000..859a4415
--- /dev/null
+++ b/mysql-test/suite/galera/r/GAL-401.result
@@ -0,0 +1,29 @@
+connection node_2;
+connection node_1;
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+connection node_2;
+SET @@global.wsrep_desync = 1;
+SET SESSION wsrep_dirty_reads=1;
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+connection node_2;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+SET wsrep_dirty_reads=0;
+SHOW STATUS LIKE 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 0
+SET @@global.wsrep_desync = 0;
+SET SESSION wsrep_sync_wait=15;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` char(1) DEFAULT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+CALL mtr.add_suppression("WSREP: Protocol violation. JOIN message sender (.*) is not in state transfer \\(SYNCED\\). Message ignored.");
+connection node_1;
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false';
diff --git a/mysql-test/suite/galera/r/GAL-419.result b/mysql-test/suite/galera/r/GAL-419.result
new file mode 100644
index 00000000..c70c9ee3
--- /dev/null
+++ b/mysql-test/suite/galera/r/GAL-419.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node.*");
+call mtr.add_suppression("Aborting");
+call mtr.add_suppression("Plugin \'wsrep\' init function returned error.");
+call mtr.add_suppression("Plugin \'wsrep\' registration as a STORAGE ENGINE failed.");
+call mtr.add_suppression("Failed to initialize plugins.");
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+connection node_2;
diff --git a/mysql-test/suite/galera/r/GAL-480.result b/mysql-test/suite/galera/r/GAL-480.result
new file mode 100644
index 00000000..8a4f8edc
--- /dev/null
+++ b/mysql-test/suite/galera/r/GAL-480.result
@@ -0,0 +1,42 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 CHAR(10), f0 integer) ENGINE=InnoDB;
+FLUSH TABLE t1 FOR EXPORT;
+UNLOCK TABLES;
+ALTER TABLE t1 DROP COLUMN f1;
+SET SESSION wsrep_osu_method='RSU';
+ALTER TABLE t1 ADD COLUMN f1 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f1;
+ALTER TABLE t1 ADD COLUMN f2 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f2;
+ALTER TABLE t1 ADD COLUMN f3 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f3;
+ALTER TABLE t1 ADD COLUMN f4 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f4;
+ALTER TABLE t1 ADD COLUMN f5 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f5;
+ALTER TABLE t1 ADD COLUMN f6 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f6;
+ALTER TABLE t1 ADD COLUMN f7 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f7;
+ALTER TABLE t1 ADD COLUMN f8 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f8;
+ALTER TABLE t1 ADD COLUMN f9 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f9;
+ALTER TABLE t1 ADD COLUMN f10 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f10;
+ALTER TABLE t1 ADD COLUMN f11 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f11;
+ALTER TABLE t1 ADD COLUMN f12 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f12;
+ALTER TABLE t1 ADD COLUMN f13 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f13;
+ALTER TABLE t1 ADD COLUMN f14 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f14;
+ALTER TABLE t1 ADD COLUMN f15 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f15;
+ALTER TABLE t1 ADD COLUMN f16 CHAR(10);
+ALTER TABLE t1 DROP COLUMN f16;
+SET SESSION wsrep_osu_method='TOI';
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/GCF-360.result b/mysql-test/suite/galera/r/GCF-360.result
new file mode 100644
index 00000000..8c1ba193
--- /dev/null
+++ b/mysql-test/suite/galera/r/GCF-360.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_1;
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_4
+4
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+connection node_2;
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_4
+4
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+connection node_3;
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_4
+4
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+connection node_4;
+SELECT VARIABLE_VALUE AS expect_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+expect_4
+4
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
diff --git a/mysql-test/suite/galera/r/GCF-939.result b/mysql-test/suite/galera/r/GCF-939.result
new file mode 100644
index 00000000..24d4eab6
--- /dev/null
+++ b/mysql-test/suite/galera/r/GCF-939.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+connection node_1;
+DROP TABLE t1;
+ERROR 42S02: Unknown table 'test.t1'
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+GRA_.log
+GRA_.log
+DROP TABLE t1;
+CALL mtr.add_suppression("Ignoring error 'Unknown table 'test.t1'' on query");
+connection node_2;
+CALL mtr.add_suppression("Error 'Unknown table 'test.t1'' on query");
diff --git a/mysql-test/suite/galera/r/MDEV-10715.result b/mysql-test/suite/galera/r/MDEV-10715.result
new file mode 100644
index 00000000..12b9c236
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-10715.result
@@ -0,0 +1,30 @@
+connection node_2;
+connection node_1;
+connection node_1;
+create table t1(a int);
+set @@wsrep_gtid_seq_no=22;
+insert into t1 values(1);
+insert into t1 values(2);
+select @@gtid_binlog_state;
+@@gtid_binlog_state
+1-1-23
+select wsrep_last_seen_gtid();
+wsrep_last_seen_gtid()
+1-1-23
+select wsrep_last_written_gtid();
+wsrep_last_written_gtid()
+1-1-23
+connection node_2;
+select @@gtid_binlog_state;
+@@gtid_binlog_state
+1-1-23
+select wsrep_last_seen_gtid();
+wsrep_last_seen_gtid()
+1-1-23
+select wsrep_last_written_gtid();
+wsrep_last_written_gtid()
+1-1-0
+connection node_1;
+drop table t1;
+connection node_2;
+CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
diff --git a/mysql-test/suite/galera/r/MDEV-15443.result b/mysql-test/suite/galera/r/MDEV-15443.result
new file mode 100644
index 00000000..21332b37
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-15443.result
@@ -0,0 +1,17 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT * FROM t1;
+f1
+1
+SET GLOBAL wsrep_cluster_address='';
+SET SESSION wsrep_on=0;
+INSERT INTO t1 VALUES (2);
+DELETE FROM t1 WHERE f1 = 2;
+connection node_1;
+INSERT INTO t1 VALUES (2);
+connection node_2;
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-16509.result b/mysql-test/suite/galera/r/MDEV-16509.result
new file mode 100644
index 00000000..b56622da
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-16509.result
@@ -0,0 +1,76 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+SET DEBUG_SYNC = "wsrep_before_commit_order_leave SIGNAL bcol_reached WAIT_FOR bcol_continue";
+SET DEBUG_SYNC = "wsrep_after_commit_order_leave SIGNAL acol_reached WAIT_FOR acol_continue";
+SET DEBUG_SYNC = "after_group_after_commit SIGNAL after_group_reached WAIT_FOR after_group_continue";
+INSERT INTO t1 VALUES (1);
+connection ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR bcol_reached";
+wsrep_last_seen_gtid_match
+1
+SELECT * FROM t1;
+f1
+1
+SET DEBUG_SYNC = "now SIGNAL bcol_continue";
+SET DEBUG_SYNC = "now WAIT_FOR acol_reached";
+wsrep_last_seen_gtid_match
+1
+SELECT * FROM t1;
+f1
+1
+SET DEBUG_SYNC = "now SIGNAL acol_continue";
+SET DEBUG_SYNC = "now WAIT_FOR after_group_reached";
+wsrep_last_seen_gtid_do_not_match
+1
+SET DEBUG_SYNC = "now SIGNAL after_group_continue";
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+connection ctrl;
+connection node_1;
+SET DEBUG_SYNC = "wsrep_before_commit_order_leave SIGNAL bcol_reached_1 WAIT_FOR bcol_continue_1";
+SET DEBUG_SYNC = "wsrep_after_commit_order_leave SIGNAL acol_reached_1 WAIT_FOR acol_continue_1";
+SET DEBUG_SYNC = "after_group_after_commit SIGNAL agac_reached_1 WAIT_FOR agac_continue_1";
+INSERT INTO t1 VALUES (2);;
+connection ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR bcol_reached_1";
+wsrep_last_seen_gtid_match
+1
+connection node_1a;
+SET DEBUG_SYNC = "wsrep_before_commit_order_leave SIGNAL bcol_reached_2 WAIT_FOR bcol_continue_2";
+SET DEBUG_SYNC = "wsrep_after_commit_order_leave SIGNAL acol_reached_2 WAIT_FOR acol_continue_2";
+SET DEBUG_SYNC = "after_group_after_commit SIGNAL agac_reached_2 WAIT_FOR agac_continue_2";
+INSERT INTO t1 VALUES (3);;
+connection ctrl;
+SET DEBUG_SYNC = "now SIGNAL bcol_continue_1";
+SET DEBUG_SYNC = "now WAIT_FOR acol_reached_1";
+SET DEBUG_SYNC = "now WAIT_FOR bcol_reached_2";
+wsrep_last_seen_gtid_match
+1
+SET DEBUG_SYNC = "now SIGNAL bcol_continue_2";
+SET DEBUG_SYNC = "now WAIT_FOR acol_reached_2";
+wsrep_last_seen_gtid_match
+1
+SET DEBUG_SYNC = "now SIGNAL acol_continue_1";
+SET DEBUG_SYNC = "now WAIT_FOR agac_reached_1";
+wsrep_last_seen_gtid_no_match
+1
+SET DEBUG_SYNC = "now SIGNAL acol_continue_2";
+SET DEBUG_SYNC = "now WAIT_FOR agac_reached_2";
+wsrep_last_seen_gtid_no_match
+1
+SET DEBUG_SYNC = "now SIGNAL agac_continue_1";
+connection node_1;
+connection ctrl;
+SET DEBUG_SYNC = "now SIGNAL agac_continue_2";
+connection node_1a;
+connection ctrl;
+SET DEBUG_SYNC = "RESET";
+DROP TABLE t1;
+disconnect ctrl;
+disconnect node_1a;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/MDEV-18832.result b/mysql-test/suite/galera/r/MDEV-18832.result
new file mode 100644
index 00000000..676ee4bf
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-18832.result
@@ -0,0 +1,14 @@
+connection node_2;
+connection node_1;
+CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE;
+CREATE TABLE t1 (Id int(11) NOT NULL, PRIMARY KEY (Id));
+INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
+INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
+INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
+INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
+DROP SEQUENCE Seq1_1;
+CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE;
+INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+DROP SEQUENCE Seq1_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-20225.result b/mysql-test/suite/galera/r/MDEV-20225.result
new file mode 100644
index 00000000..24505130
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-20225.result
@@ -0,0 +1,23 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INT NOT NULL PRIMARY KEY AUTO_INCREMENT, f2 INT) ENGINE=InnoDB;
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, NEW.f1);
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_slave_threads = 2;
+SET GLOBAL debug_dbug = 'd,sync.mdev_20225';
+DROP TRIGGER tr1;
+connection node_2;
+connection node_1;
+INSERT INTO t1 VALUES (NULL);
+connection node_2a;
+SET GLOBAL debug_dbug = 'RESET';
+SET DEBUG_SYNC = 'now SIGNAL signal.mdev_20225_continue';
+SET DEBUG_SYNC = 'RESET';
+SET GLOBAL wsrep_slave_threads = 1;
+connection node_2;
+SHOW TRIGGERS;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/MDEV-20616.result b/mysql-test/suite/galera/r/MDEV-20616.result
new file mode 100644
index 00000000..488d8985
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-20616.result
@@ -0,0 +1,114 @@
+connection node_2;
+connection node_1;
+
+Test phase 1 to make sure that natral deadlock in trigger SP execution is
+handled correctly
+
+CREATE TABLE t1(a INT);
+CREATE TABLE t2(f1 INT, f2 INT, f3 INT);
+CREATE PROCEDURE proc()
+BEGIN
+INSERT INTO t2 VALUES(100, 200, 300);
+UPDATE t2 SET f3 = f3 + 100;
+END|
+CREATE TRIGGER t1 BEFORE INSERT ON t1 FOR EACH ROW CALL proc();
+INSERT INTO t1 VALUES(2);;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+INSERT INTO t1 VALUES(1);;
+connection node_1;
+connection node_1a;
+connection node_1;
+wsrep__bf_aborts
+0
+DROP TABLE t1;
+DROP TABLE t2;
+DROP PROCEDURE proc;
+
+Test phase 2 to make sure that BF abort for SP execution is
+handled correctly
+
+connection node_1;
+SET SESSION wsrep_retry_autocommit = 0;
+SET SESSION wsrep_sync_wait = 0;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+connection node_1a;
+SET SESSION wsrep_retry_autocommit = 0;
+SET SESSION wsrep_sync_wait = 0;
+CREATE PROCEDURE proc_update()
+BEGIN
+UPDATE t1 SET f2 = 'b';
+END|
+INSERT INTO t1 VALUES(1, 'a');
+connection node_1;
+SET debug_sync='wsrep_before_certification SIGNAL ready WAIT_FOR cont';
+CALL proc_update;
+connection node_1a;
+SET debug_sync='now WAIT_FOR ready';
+connection node_2;
+UPDATE t1 SET f2='c';
+connection node_1a;
+SET debug_sync='now SIGNAL cont';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1a;
+SET debug_sync='RESET';
+DROP PROCEDURE proc_update;
+connection node_1;
+
+Test phase 3 to make sure natural deadlock is not treated as BF abort
+
+TRUNCATE t1;
+INSERT INTO t1 VALUES (1, 'a'), (2, 'a');
+connection node_1a;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+connection node_1;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+connection node_1a;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+connection node_1;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 1;
+connection node_1a;
+COMMIT;
+wsrep__bf_aborts
+0
+connection node_1;
+ROLLBACK;
+
+Test phase 4 to make sure natural deadlock inside SP execution
+is not treated as BF abort
+
+connection node_1a;
+TRUNCATE t1;
+INSERT INTO t1 VALUES (1, 'a'), (2, 'a');
+CREATE PROCEDURE proc_update_1()
+BEGIN
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT SLEEP(5);
+UPDATE t1 SET f2 = 'b' WHERE f1 = 2;
+COMMIT;
+END|
+CREATE PROCEDURE proc_update_2()
+BEGIN
+START TRANSACTION;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+SELECT SLEEP(5);
+UPDATE t1 SET f2 = 'c' WHERE f1 = 1;
+COMMIT;
+END|
+connection node_1;
+CALL proc_update_1;
+connection node_1a;
+CALL proc_update_2;
+SLEEP(5)
+0
+wsrep__bf_aborts
+0
+connection node_1;
+SLEEP(5)
+0
+DROP PROCEDURE proc_update_1;
+DROP PROCEDURE proc_update_2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-20793.result b/mysql-test/suite/galera/r/MDEV-20793.result
new file mode 100644
index 00000000..feb068f2
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-20793.result
@@ -0,0 +1,44 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT);
+INSERT INTO t1 VALUES (1, 0), (5, 0);
+connection node_1_ctrl;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_slave_threads = 2;
+connection node_1;
+SET SESSION wsrep_retry_autocommit = 0;
+START TRANSACTION;
+UPDATE t1 SET f2 = 1;
+connection node_1_ctrl;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 2);
+connection node_1_ctrl;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_slave_enter_sync';
+connection node_2;
+UPDATE t1 SET f2 = 2 WHERE f1 = 5;
+connection node_1_ctrl;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+SET SESSION debug_sync = "wsrep_before_replay SIGNAL reached WAIT_FOR continue";
+COMMIT;
+connection node_1_ctrl;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION debug_sync = "now WAIT_FOR reached";
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET SESSION debug_sync = "now SIGNAL continue";
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET debug_sync = "RESET";
+DROP TABLE t1;
+SET GLOBAL wsrep_slave_threads = 1;
diff --git a/mysql-test/suite/galera/r/MDEV-21479.result b/mysql-test/suite/galera/r/MDEV-21479.result
new file mode 100644
index 00000000..7d1220a0
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-21479.result
@@ -0,0 +1,95 @@
+connection node_2;
+connection node_1;
+# Lets first see that we can access wsrep schema tables
+# Node1
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_1 from mysql.wsrep_cluster;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
+EXPECT_2
+2
+connection node_2;
+# Node2
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
+EXPECT_2
+2
+connection node_1;
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+SET GLOBAL wsrep_provider_options = 'pc.weight=2';
+connection node_2;
+# Desync and disconnect node_2
+SET @@global.wsrep_desync = 1;
+SET SESSION wsrep_dirty_reads=1;
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE
+non-Primary
+connection node_1;
+# Waiting until node_2 is not part of cluster anymore
+# Verify that we can access wsrep schema tables
+# Node1
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster_members;
+EXPECT_1
+1
+connection node_2;
+# Node2
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
+EXPECT_2
+2
+connection node_2;
+# Reconnect node_2 back to cluster
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+SET wsrep_dirty_reads=0;
+SHOW STATUS LIKE 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 0
+SET @@global.wsrep_desync = 0;
+CALL mtr.add_suppression("WSREP: Protocol violation. JOIN message sender (.*) is not in state transfer \\(SYNCED\\). Message ignored.");
+connection node_1;
+# Wait until both nodes are back to cluster
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false';
+SET GLOBAL wsrep_provider_options = 'pc.weight=1';
+# Verify that we can access wsrep schema tables
+# Node1
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
+EXPECT_2
+2
+connection node_2;
+# Node2
+SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
+EXPECT_2
+2
diff --git a/mysql-test/suite/galera/r/MDEV-22021.result b/mysql-test/suite/galera/r/MDEV-22021.result
new file mode 100644
index 00000000..a217e66e
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-22021.result
@@ -0,0 +1,57 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SAVEPOINT sp1;
+INSERT INTO t1 VALUES (2);
+ROLLBACK TO SAVEPOINT sp1;
+COMMIT;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+DELETE FROM t1;
+START TRANSACTION;
+SAVEPOINT sp1;
+INSERT INTO t1 VALUES (1);
+SAVEPOINT sp2;
+INSERT INTO t1 VALUES (2);
+ROLLBACK TO SAVEPOINT sp2;
+ROLLBACK TO SAVEPOINT sp1;
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+DELETE FROM t1;
+START TRANSACTION;
+SAVEPOINT sp1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+SAVEPOINT sp2;
+INSERT INTO t1 VALUES (5);
+ROLLBACK TO SAVEPOINT sp2;
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+ROLLBACK TO SAVEPOINT sp1;
+INSERT INTO t1 VALUES (8);
+COMMIT;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-22051.result b/mysql-test/suite/galera/r/MDEV-22051.result
new file mode 100644
index 00000000..229e26fd
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-22051.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+FLUSH TABLES WITH READ LOCK;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+ERROR 08S01: Aborting TOI: Replication paused on node for FTWRL/BACKUP STAGE.
+SET wsrep_OSU_method=RSU;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+ERROR 08S01: Aborting TOI: Replication paused on node for FTWRL/BACKUP STAGE.
+SET wsrep_OSU_method=TOI;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+ERROR 08S01: Aborting TOI: Replication paused on node for FTWRL/BACKUP STAGE.
+connection node_1;
+UNLOCK TABLES;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+FLUSH TABLES WITH READ LOCK;
+INSERT INTO t1 VALUES (1);
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+UNLOCK TABLES;
+DROP TABLE t1;
+CALL mtr.add_suppression("CREATE TABLE isolation failure");
diff --git a/mysql-test/suite/galera/r/MDEV-22055.result b/mysql-test/suite/galera/r/MDEV-22055.result
new file mode 100644
index 00000000..651f8501
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-22055.result
@@ -0,0 +1,18 @@
+connection node_2;
+connection node_1;
+ROLLBACK AND CHAIN;
+CREATE TABLE t1(a int not null primary key) engine=innodb;
+INSERT INTO t1 values (1);
+BEGIN;
+INSERT INTO t1 values (2);
+ROLLBACK AND CHAIN;
+SELECT * FROM t1;
+a
+1
+connection node_2;
+SET SESSION wsrep_sync_wait=15;
+SELECT * FROM t1;
+a
+1
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-22227.result b/mysql-test/suite/galera/r/MDEV-22227.result
new file mode 100644
index 00000000..d5afc974
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-22227.result
@@ -0,0 +1,16 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+LOCK TABLE t1 WRITE CONCURRENT;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET lock_wait_timeout= 1;
+CREATE VIEW v1 AS SELECT * FROM t1;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1b;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+UNLOCK TABLES;
+connection node_1a;
+DROP VIEW v1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-22421.result b/mysql-test/suite/galera/r/MDEV-22421.result
new file mode 100644
index 00000000..33dc3e44
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-22421.result
@@ -0,0 +1,7 @@
+connection node_2;
+connection node_1;
+SET @@local.sql_mode='no_field_options';
+CREATE TABLE t1 (f1 INT, ROW_START BIGINT UNSIGNED AS ROW START INVISIBLE, ROW_END BIGINT UNSIGNED AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME(ROW_START, ROW_END)) WITH SYSTEM VERSIONING ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+UPDATE t1 SET f1 = 1 WHERE f1 = 1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-22458.result b/mysql-test/suite/galera/r/MDEV-22458.result
new file mode 100644
index 00000000..7c853735
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-22458.result
@@ -0,0 +1,10 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (a INT);
+connect con1,localhost,root,,test;
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+SHOW EXPLAIN FOR $con1;
+ERROR HY000: Target is not executing an operation with a query plan
+connection con1;
+INSERT INTO t1 VALUES (5),(6),(7),(8);
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-22708.result b/mysql-test/suite/galera/r/MDEV-22708.result
new file mode 100644
index 00000000..a672ed7b
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-22708.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+SET @wsrep_forced_binlog_format_saved = @@GLOBAL.wsrep_forced_binlog_format;
+SET @@GLOBAL.wsrep_forced_binlog_format = STATEMENT;
+CREATE TABLE t1(c INT PRIMARY KEY) ENGINE = MyISAM;
+INSERT DELAYED INTO t1 VALUES (1),(2),(3);
+SELECT SLEEP(1);
+SLEEP(1)
+0
+DROP TABLE t1;
+SET @@GLOBAL.wsrep_forced_binlog_format = @wsrep_forced_binlog_format_saved;
diff --git a/mysql-test/suite/galera/r/MDEV-24063.result b/mysql-test/suite/galera/r/MDEV-24063.result
new file mode 100644
index 00000000..d7eda917
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-24063.result
@@ -0,0 +1,10 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+connection node_2;
+SET GLOBAL wsrep_on=OFF;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-24143.result b/mysql-test/suite/galera/r/MDEV-24143.result
new file mode 100644
index 00000000..860d8a35
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-24143.result
@@ -0,0 +1,23 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 BINARY (10), c3 DATETIME);
+SELECT get_lock ('test2', 0);
+get_lock ('test2', 0)
+1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+SET SESSION wsrep_trx_fragment_size=10;
+SET SESSION autocommit=0;
+SELECT * FROM t1 WHERE c1 <=0 ORDER BY c1 DESC;
+c1
+INSERT INTO t1 VALUES (4),(3),(1),(2);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=SEQUENCE;
+ERROR 42S01: Table 't1' already exists
+ALTER TABLE t1 DROP COLUMN c2;
+ERROR 42000: Can't DROP COLUMN `c2`; check that it exists
+SELECT get_lock ('test', 1.5);
+get_lock ('test', 1.5)
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-24327.result b/mysql-test/suite/galera/r/MDEV-24327.result
new file mode 100644
index 00000000..d309749e
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-24327.result
@@ -0,0 +1,35 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'f');
+INSERT INTO t1 VALUES (2, 'g');
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = '1' WHERE f1 = 1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait=0;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_2;
+UPDATE t1 SET f2 = '2' WHERE f1 = 2;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+SELECT * FROM t1;
+f1 f2
+1 1
+2 2
+"node 1 is complete now"
+connection node_2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-25389.result b/mysql-test/suite/galera/r/MDEV-25389.result
new file mode 100644
index 00000000..f369fe4d
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-25389.result
@@ -0,0 +1,17 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+call mtr.add_suppression("WSREP: Failed to create/initialize system thread");
+SET GLOBAL debug_dbug='+d,wsrep_simulate_failed_connection_1';
+SET GLOBAL wsrep_slave_threads=2;
+ERROR HY000: Incorrect arguments to SET
+SELECT @@wsrep_slave_threads;
+@@wsrep_slave_threads
+1
+SET GLOBAL debug_dbug='';
+SET GLOBAL wsrep_slave_threads=1;
+SELECT @@wsrep_slave_threads;
+@@wsrep_slave_threads
+1
diff --git a/mysql-test/suite/galera/r/MDEV-25494.result b/mysql-test/suite/galera/r/MDEV-25494.result
new file mode 100644
index 00000000..e4d477ca
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-25494.result
@@ -0,0 +1,14 @@
+connection node_2;
+connection node_1;
+SET SESSION binlog_format=STATEMENT;
+Warnings:
+Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
+CREATE TEMPORARY TABLE t (i INT) UNION=(t);
+ALTER TABLE t ADD extrac CHAR(1);
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TEMPORARY TABLE `t` (
+ `i` int(11) DEFAULT NULL,
+ `extrac` char(1) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/r/MDEV-25562.result b/mysql-test/suite/galera/r/MDEV-25562.result
new file mode 100644
index 00000000..ab8340af
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-25562.result
@@ -0,0 +1,6 @@
+connection node_2;
+connection node_1;
+SET SESSION WSREP_ON=0;
+FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT;
+SET SESSION WSREP_ON=1;
+UNLOCK TABLES;
diff --git a/mysql-test/suite/galera/r/MDEV-25740.result b/mysql-test/suite/galera/r/MDEV-25740.result
new file mode 100644
index 00000000..5a4318a7
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-25740.result
@@ -0,0 +1,9 @@
+connection node_2;
+connection node_1;
+SET AUTOCOMMIT = OFF;
+SET completion_type = CHAIN;
+CREATE TABLE t1(f1 INT) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+ROLLBACK;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-26575.result b/mysql-test/suite/galera/r/MDEV-26575.result
new file mode 100644
index 00000000..5b447e1a
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-26575.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+connection node_2;
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*");
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+SET SESSION wsrep_on = OFF;
+XA START 'xatest';
+ERROR 42000: This version of MariaDB doesn't yet support 'XA transactions with Galera replication'
diff --git a/mysql-test/suite/galera/r/MDEV-26597.result b/mysql-test/suite/galera/r/MDEV-26597.result
new file mode 100644
index 00000000..15e33446
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-26597.result
@@ -0,0 +1,19 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 FLOAT(3,2));
+SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512';
+SET @@autocommit=0;
+INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
+CREATE TABLE t1 ( pk int primary key) ENGINE=INNODB;
+ERROR HY000: Maximum writeset size exceeded
+SHOW WARNINGS;
+Level Code Message
+Error 1105 Maximum writeset size exceeded
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+DROP TABLE t3;
diff --git a/mysql-test/suite/galera/r/MDEV-27001.result b/mysql-test/suite/galera/r/MDEV-27001.result
new file mode 100644
index 00000000..f2dc6a9a
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-27001.result
@@ -0,0 +1,6 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t3 (c INT) PARTITION BY RANGE (c) (PARTITION p1 VALUES LESS THAN (1000));
+CREATE TABLE tp2 (c INT);
+ALTER TABLE t3 CONVERT TABLE tp2 TO PARTITION p2 VALUES LESS THAN (2000);
+DROP TABLE t3;
diff --git a/mysql-test/suite/galera/r/MDEV-27123.result b/mysql-test/suite/galera/r/MDEV-27123.result
new file mode 100644
index 00000000..98377162
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-27123.result
@@ -0,0 +1,17 @@
+connection node_2;
+connection node_1;
+show variables like 'auto_increment%';
+Variable_name Value
+auto_increment_increment 3
+auto_increment_offset 3
+create table t4 (c1 int primary key auto_increment) engine=innodb;
+show variables like 'auto_increment%';
+Variable_name Value
+auto_increment_increment 3
+auto_increment_offset 3
+alter table t4 add (c2 varchar(50));
+show variables like 'auto_increment%';
+Variable_name Value
+auto_increment_increment 3
+auto_increment_offset 3
+DROP TABLE t4;
diff --git a/mysql-test/suite/galera/r/MDEV-27276.result b/mysql-test/suite/galera/r/MDEV-27276.result
new file mode 100644
index 00000000..7e5b29fa
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-27276.result
@@ -0,0 +1,36 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+CREATE TABLE p (id INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+INSERT INTO p VALUES(1,0);
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+CREATE TABLE c(id INT NOT NULL PRIMARY KEY, p_id INT, FOREIGN KEY (p_id) REFERENCES p(id) ON DELETE CASCADE) ENGINE=InnoDB;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p;
+id f2
+SELECT * FROM c;
+id p_id
+DROP TABLE c;
+DROP TABLE p;
diff --git a/mysql-test/suite/galera/r/MDEV-27862.result b/mysql-test/suite/galera/r/MDEV-27862.result
new file mode 100644
index 00000000..d1aa9e2c
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-27862.result
@@ -0,0 +1,49 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE SEQUENCE seq NOCACHE ENGINE=InnoDB;
+SELECT NEXTVAL(seq) = 1;
+NEXTVAL(seq) = 1
+1
+connection node_2;
+SELECT NEXTVAL(seq) = 2;
+NEXTVAL(seq) = 2
+1
+connection node_1;
+SELECT NEXTVAL(seq) = 3;
+NEXTVAL(seq) = 3
+1
+SELECT SETVAL(seq, 100);
+SETVAL(seq, 100)
+100
+connection node_2;
+SELECT NEXTVAL(seq) = 101;
+NEXTVAL(seq) = 101
+1
+connection node_1;
+SELECT NEXTVAL(seq) = 102;
+NEXTVAL(seq) = 102
+1
+DROP SEQUENCE seq;
+CREATE TABLE t1(f1 INT);
+CREATE SEQUENCE seq_transaction NOCACHE ENGINE=InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (0);
+SELECT NEXTVAL(seq_transaction);
+NEXTVAL(seq_transaction)
+1
+INSERT INTO t1 VALUES (NEXTVAL(seq_transaction));
+COMMIT;
+connection node_2;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT NEXTVAL(seq_transaction) = 3;
+NEXTVAL(seq_transaction) = 3
+1
+connection node_1;
+SELECT NEXTVAL(seq_transaction) = 4;
+NEXTVAL(seq_transaction) = 4
+1
+DROP SEQUENCE seq_transaction;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-28053.result b/mysql-test/suite/galera/r/MDEV-28053.result
new file mode 100644
index 00000000..b3f93688
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-28053.result
@@ -0,0 +1,14 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+connection node_2;
+connection node_3;
+DROP TABLE t1;
+connection node_2;
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
+connection node_3;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/MDEV-29142.result b/mysql-test/suite/galera/r/MDEV-29142.result
new file mode 100644
index 00000000..2528520e
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-29142.result
@@ -0,0 +1,45 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: Event .* Write_rows_v1 apply failed:.*");
+call mtr.add_suppression("WSREP: Failed to apply write set:.*");
+call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on.*");
+connection node_2;
+call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing");
+call mtr.add_suppression("WSREP: Failed to open SR table for write");
+call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0");
+call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on.*");
+SET @@global.tx_read_only = ON;
+SET default_storage_engine = SEQUENCE;
+create table t1 (c1 int);
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by the engine")
+CREATE TABLE t1(c1 VARCHAR(20)) engine=innodb;
+INSERT INTO t1 VALUES(0xA9B8);
+create TABLE t1 (c1 int) engine=innodb;
+ERROR 42S01: Table 't1' already exists
+create TABLE t1 (c1 int) engine=innodb;
+ERROR 42S01: Table 't1' already exists
+SET GLOBAL wsrep_on=OFF;
+SET GLOBAL wsrep_cluster_address='gcomm://';
+INSERT INTO t1 VALUES (1);
+SELECT 1;
+1
+1
+SELECT 1;
+1
+1
+COMMIT;
+# Killing cluster because we have messed with wsrep_cluster_address
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+connection node_2;
+call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing");
+call mtr.add_suppression("WSREP: Failed to open SR table for write");
+call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0");
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/galera/r/MDEV-29293.result b/mysql-test/suite/galera/r/MDEV-29293.result
new file mode 100644
index 00000000..70c0cc84
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-29293.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+set wsrep_sync_wait = 0;
+CREATE TABLE t1(a int not null primary key auto_increment, b int) engine=InnoDB;
+INSERT INTO t1 VALUES (1,2);
+connection node_1a;
+BEGIN;
+UPDATE t1 SET b=3 WHERE a=1;
+connection node_1;
+set debug_sync='wsrep_kill_before_awake_no_mutex SIGNAL before_kill WAIT_FOR continue';
+connection node_1b;
+set debug_sync= 'now WAIT_FOR before_kill';
+connection node_2;
+UPDATE t1 SET b=7 WHERE a=1;
+connection node_1b;
+set debug_sync= 'now SIGNAL continue';
+connection node_1;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/suite/galera/r/MDEV-29512.result b/mysql-test/suite/galera/r/MDEV-29512.result
new file mode 100644
index 00000000..aaf24df9
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-29512.result
@@ -0,0 +1,40 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 varchar(2000));
+INSERT INTO t1 VALUES (1, 0, REPEAT('1234567890', 200));
+INSERT INTO t1 VALUES (3, 3, REPEAT('1234567890', 200));
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait=0;
+connection node_1;
+begin;
+select f1,f2 from t1;
+f1 f2
+1 0
+3 3
+connection node_2;
+UPDATE t1 SET f2=2 WHERE f1=3;
+connection node_1a;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_1;
+UPDATE t1 SET f2=1 WHERE f1=3;
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = NULL;
+SET debug_sync='RESET';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+select f1,f2 from t1;
+f1 f2
+1 0
+3 2
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-30804.result b/mysql-test/suite/galera/r/MDEV-30804.result
new file mode 100644
index 00000000..2bf323d1
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-30804.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t (a INT) ENGINE=Aria;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+START TRANSACTION;
+INSERT INTO t VALUES ('1');
+INSERT INTO t1 VALUES ('1');
+COMMIT;
+ERROR HY000: Transactional commit not supported by involved engine(s)
+DROP TABLE t;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MDEV-30955.result b/mysql-test/suite/galera/r/MDEV-30955.result
new file mode 100644
index 00000000..2a090cb5
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-30955.result
@@ -0,0 +1,26 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t (a CHAR(1) KEY);
+START TRANSACTION;
+HANDLER t OPEN;
+disconnect node_1;
+connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+DROP TABLE t;
+BACKUP STAGE START;
+START TRANSACTION;
+disconnect node_1;
+connect node_1, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY);
+START TRANSACTION;
+INSERT INTO t1 VALUES(1);
+HANDLER t2 OPEN;
+connection node_2;
+INSERT INTO t1 VALUES(1);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1,t2;
diff --git a/mysql-test/suite/galera/r/MDEV-6860.result b/mysql-test/suite/galera/r/MDEV-6860.result
new file mode 100644
index 00000000..72a74353
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-6860.result
@@ -0,0 +1,14 @@
+connection node_2;
+connection node_1;
+connection node_2;
+START SLAVE;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+CREATE TABLE t1 (f1 int, f2 int) ENGINE=InnoDB;
+connection node_2;
+connection node_1;
+connection node_3;
+DROP TABLE t1;
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/MENT-1047.result b/mysql-test/suite/galera/r/MENT-1047.result
new file mode 100644
index 00000000..76d58f6d
--- /dev/null
+++ b/mysql-test/suite/galera/r/MENT-1047.result
@@ -0,0 +1,4 @@
+connection node_2;
+connection node_1;
+XA START 'trx';
+ERROR 42000: This version of MariaDB doesn't yet support 'XA transactions with Galera replication'
diff --git a/mysql-test/suite/galera/r/MW-252.result b/mysql-test/suite/galera/r/MW-252.result
new file mode 100644
index 00000000..4d458802
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-252.result
@@ -0,0 +1,12 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+FLUSH TABLES WITH READ LOCK;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+connection node_2;
+connection node_1;
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MW-258.result b/mysql-test/suite/galera/r/MW-258.result
new file mode 100644
index 00000000..22963557
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-258.result
@@ -0,0 +1,45 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+LOCK TABLE t1 WRITE;
+value prior to RSU:
+SHOW STATUS LIKE 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 0
+SHOW VARIABLES LIKE 'wsrep_desync';
+Variable_name Value
+wsrep_desync OFF
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_osu_method = RSU;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1b;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_osu_method = RSU;
+ALTER TABLE t1 ADD COLUMN f3 INTEGER;;
+connection node_1;
+value during RSU:
+SHOW STATUS LIKE 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 2
+SHOW VARIABLES LIKE 'wsrep_desync';
+Variable_name Value
+wsrep_desync OFF
+UNLOCK TABLES;
+connection node_1a;
+connection node_1b;
+connection node_1;
+value after RSU:
+SHOW STATUS LIKE 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 0
+SHOW VARIABLES LIKE 'wsrep_desync';
+Variable_name Value
+wsrep_desync OFF
+SET GLOBAL wsrep_desync=0;
+Warnings:
+Warning 1231 'wsrep_desync' is already OFF.
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MW-259.result b/mysql-test/suite/galera/r/MW-259.result
new file mode 100644
index 00000000..9a0f2ccf
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-259.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+SET GLOBAL wsrep_desync=0;
+Warnings:
+Warning 1231 'wsrep_desync' is already OFF.
+SET wsrep_OSU_method=RSU;
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+connection node_1a;
+SET GLOBAL wsrep_desync=1;;
+connection node_1b;
+SET DEBUG_SYNC= 'now SIGNAL continue';
+DROP TABLE t1;
+SET GLOBAL wsrep_desync=0;
+connection node_1;
+connection node_1a;
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/suite/galera/r/MW-284.result b/mysql-test/suite/galera/r/MW-284.result
new file mode 100644
index 00000000..6ca1f16d
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-284.result
@@ -0,0 +1,32 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+call mtr.add_suppression("\\[ERROR\\] Error reading packet from server: WSREP has not yet prepared node for application use .*");
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
+SET SESSION wsrep_on = OFF;
+SET SESSION wsrep_on = ON;
+SET global wsrep_sync_wait=0;
+connection node_3;
+SELECT @@wsrep_on;
+@@wsrep_on
+0
+call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use (server_errno=1047)");
+START SLAVE;
+include/wait_for_slave_param.inc [Slave_IO_Running]
+connection node_1;
+SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
+connection node_3;
+include/wait_for_slave_to_start.inc
+connection node_1;
+INSERT INTO t1 VALUES (1);
+connection node_3;
+connection node_1;
+DROP TABLE t1;
+SET global wsrep_sync_wait=15;
+connection node_3;
+STOP SLAVE;
+RESET SLAVE ALL;
+CALL mtr.add_suppression('failed registering on master');
diff --git a/mysql-test/suite/galera/r/MW-285.result b/mysql-test/suite/galera/r/MW-285.result
new file mode 100644
index 00000000..762f22d5
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-285.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+CREATE TABLE parent1 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB;
+CREATE TABLE parent2 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT PRIMARY KEY,
+parent1_id INT,
+parent2_id INT,
+FOREIGN KEY (parent1_id) REFERENCES parent1(id),
+FOREIGN KEY (parent1_id) REFERENCES parent2(id)
+) ENGINE=InnoDB;
+INSERT INTO parent1 VALUES (1);
+INSERT INTO parent2 VALUES (1);
+INSERT INTO child VALUES (1,1,1);
+INSERT INTO child VALUES (2,1,1);
+SET foreign_key_checks=OFF;
+DROP TABLE parent1;
+UPDATE child SET parent1_id=2 WHERE id=1;
+DROP TABLE child;
+DROP TABLE parent2;
+SET foreign_key_checks=ON;
diff --git a/mysql-test/suite/galera/r/MW-286.result b/mysql-test/suite/galera/r/MW-286.result
new file mode 100644
index 00000000..b3accb1c
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-286.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t1 (f1) VALUES (1), (2), (3);
+connection node_2;
+SET GLOBAL wsrep_desync = TRUE;
+SET wsrep_on = FALSE;
+SET SESSION debug_sync = "alter_table_inplace_after_lock_upgrade SIGNAL mdl_locked WAIT_FOR mdl_continue";
+ALTER TABLE t1 ADD PRIMARY KEY (f1);;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+SET SESSION debug_sync = "now WAIT_FOR mdl_locked";
+connection node_1;
+INSERT INTO t1(f1) VALUES (11);
+connection node_2a;
+SET debug_sync = "now SIGNAL mdl_continue";
+SET debug_sync='RESET';
+connection node_2;
+ERROR 70100: Query execution was interrupted
+SET wsrep_on = TRUE;
+SET GLOBAL wsrep_desync = FALSE;
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MW-292.result b/mysql-test/suite/galera/r/MW-292.result
new file mode 100644
index 00000000..81e5a316
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-292.result
@@ -0,0 +1,50 @@
+connection node_2;
+connection node_1;
+CREATE TABLE rand_table (f1 FLOAT);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+f1 f2
+2 a
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+connection node_1;
+SELECT TIMEDIFF(SYSDATE(), NOW()) < 2;
+TIMEDIFF(SYSDATE(), NOW()) < 2
+1
+INSERT INTO rand_table VALUES (RAND()),(RAND()),(RAND()),(RAND()),(RAND());
+INSERT INTO rand_table VALUES (RAND()),(RAND()),(RAND()),(RAND()),(RAND());
+SELECT COUNT(DISTINCT f1) = 10 FROM rand_table;
+COUNT(DISTINCT f1) = 10
+1
+wsrep_local_replays
+1
+connection node_2;
+DROP TABLE t1;
+DROP TABLE rand_table;
diff --git a/mysql-test/suite/galera/r/MW-309.result b/mysql-test/suite/galera/r/MW-309.result
new file mode 100644
index 00000000..0169b56e
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-309.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+SET GLOBAL wsrep_max_ws_rows = 2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SHOW STATUS LIKE '%wsrep%';
+SET GLOBAL wsrep_max_ws_rows = 0;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MW-313.result b/mysql-test/suite/galera/r/MW-313.result
new file mode 100644
index 00000000..909caf77
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-313.result
@@ -0,0 +1,34 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+SET GLOBAL wsrep_max_ws_rows = 2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SHOW STATUS LIKE '%wsrep%';
+INSERT INTO t1 SELECT * FROM t1;
+ERROR HY000: wsrep_max_ws_rows exceeded
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES (1);
+INSERT INTO t1 (f1) VALUES (2),(3),(4);
+ERROR HY000: wsrep_max_ws_rows exceeded
+ROLLBACK;
+START TRANSACTION;
+DELETE FROM t1;
+ERROR HY000: wsrep_max_ws_rows exceeded
+DROP TABLE t1;
+SET GLOBAL wsrep_max_ws_rows = 0;
diff --git a/mysql-test/suite/galera/r/MW-329.result b/mysql-test/suite/galera/r/MW-329.result
new file mode 100644
index 00000000..54d55eea
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-329.result
@@ -0,0 +1,23 @@
+connection node_2;
+connection node_1;
+CALL mtr.add_suppression("WSREP: .*conflict state . after post commit .*");
+CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES (1),(65535);
+CREATE PROCEDURE proc_insert ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f1) VALUES (FLOOR( 1 + RAND( ) * 65535 ));
+SELECT SLEEP(0.1);
+END WHILE;
+END|
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1b;
+connection node_1;
+connection node_1b;
+connection node_1;
+DROP PROCEDURE proc_insert;
+DROP TABLE t1;
+CALL mtr.add_suppression("conflict state 3 after post commit");
+set global innodb_status_output=Default;
diff --git a/mysql-test/suite/galera/r/MW-336.result b/mysql-test/suite/galera/r/MW-336.result
new file mode 100644
index 00000000..8996b85c
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-336.result
@@ -0,0 +1,83 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+SET GLOBAL wsrep_slave_threads = 10;
+# Set slave threads to 10 step 1
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_10
+10
+SET GLOBAL wsrep_slave_threads = 1;
+connection node_2;
+INSERT INTO t1 VALUES (1);
+connection node_1;
+# Wait until one of the appliers has exited
+SELECT VARIABLE_VALUE AS EXPECT_9 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_9
+9
+SET GLOBAL wsrep_slave_threads = 10;
+# Set slave threads to 10 step 2
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_10
+10
+SET GLOBAL wsrep_slave_threads = 20;
+# Set slave threads to 20
+SELECT VARIABLE_VALUE AS EXPECT_20 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_20
+20
+SET GLOBAL wsrep_slave_threads = 1;
+connection node_2;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+INSERT INTO t1 VALUES (11);
+INSERT INTO t1 VALUES (12);
+INSERT INTO t1 VALUES (13);
+INSERT INTO t1 VALUES (14);
+INSERT INTO t1 VALUES (16);
+INSERT INTO t1 VALUES (17);
+INSERT INTO t1 VALUES (18);
+INSERT INTO t1 VALUES (19);
+INSERT INTO t1 VALUES (20);
+connection node_1;
+# Wait until 19 of the appliers has exited
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_1
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+20
+SET GLOBAL wsrep_slave_threads = 10;
+# Set slave threads to 10 step 3
+SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_10
+10
+connection node_1;
+SET GLOBAL wsrep_slave_threads = 1;
+connection node_2;
+INSERT INTO t1 VALUES (21);
+INSERT INTO t1 VALUES (22);
+INSERT INTO t1 VALUES (23);
+INSERT INTO t1 VALUES (24);
+INSERT INTO t1 VALUES (25);
+INSERT INTO t1 VALUES (26);
+INSERT INTO t1 VALUES (27);
+INSERT INTO t1 VALUES (28);
+INSERT INTO t1 VALUES (29);
+INSERT INTO t1 VALUES (30);
+connection node_1;
+# Wait until slave threads back to 1
+SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
+EXPECT_1
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+30
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MW-357.result b/mysql-test/suite/galera/r/MW-357.result
new file mode 100644
index 00000000..dc391be4
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-357.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET GLOBAL wsrep_slave_threads = 0;
+Warnings:
+Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MW-369.result b/mysql-test/suite/galera/r/MW-369.result
new file mode 100644
index 00000000..9f0a77ed
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-369.result
@@ -0,0 +1,284 @@
+connection node_2;
+connection node_1;
+CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1)) ;
+INSERT INTO p VALUES (1, 0);
+INSERT INTO p VALUES (2, 0);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+DELETE FROM p WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO c VALUES (1, 1);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p;
+f1 f2
+1 0
+2 0
+SELECT * FROM c;
+f1 p_id
+1 1
+DROP TABLE c;
+DROP TABLE p;
+connection node_1;
+CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER,
+f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1)) ;
+INSERT INTO p VALUES (1, 0);
+INSERT INTO p VALUES (2, 0);
+INSERT INTO c VALUES (1, 1, 0);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE p SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+UPDATE c SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+connection node_2;
+SELECT * FROM p;
+f1 f2
+1 1
+2 0
+SELECT * FROM c;
+f1 p_id f2
+1 1 1
+DROP TABLE c;
+DROP TABLE p;
+connection node_1;
+CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1)) ;
+INSERT INTO p VALUES (1, 0);
+INSERT INTO p VALUES (2, 0);
+INSERT INTO c VALUES (1, 1);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE p SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+DELETE FROM c WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+connection node_2;
+SELECT * FROM p;
+f1 f2
+1 1
+2 0
+SELECT * FROM c;
+f1 p_id
+DROP TABLE c;
+DROP TABLE p;
+CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER UNIQUE KEY) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f2)) ;
+INSERT INTO p VALUES (1, 0);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE p SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO c VALUES (1, 0);;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p;
+f1 f2
+1 0
+SELECT * FROM c;
+f1 p_id
+1 0
+DROP TABLE c;
+DROP TABLE p;
+CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER, f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1)
+ON DELETE CASCADE) ;
+INSERT INTO p VALUES (1, 0);
+INSERT INTO p VALUES (2, 0);
+INSERT INTO c VALUES (1, 1, 0);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+DELETE FROM p WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+UPDATE c SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p;
+f1 f2
+1 0
+2 0
+SELECT * FROM c;
+f1 p_id f2
+1 1 1
+DROP TABLE c;
+DROP TABLE p;
+#
+# Start of 10.4 tests
+#
+connection node_1;
+CREATE TABLE pf (f1 INTEGER PRIMARY KEY) ENGINE=INNODB;
+CREATE TABLE cf (
+f1 INTEGER PRIMARY KEY,
+p_id INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES pf (f1)
+);
+INSERT INTO pf VALUES (1);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+INSERT INTO cf (f1, p_id) VALUES (10, 1);
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO cf (f1, p_id) VALUES (20, 1);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+connection node_2;
+SELECT * FROM pf;
+f1
+1
+SELECT * FROM cf;
+f1 p_id
+10 1
+20 1
+DROP TABLE cf;
+DROP TABLE pf;
+connection node_1;
+CREATE TABLE pg (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE cg (f1 INTEGER PRIMARY KEY, p_id INTEGER,
+f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES pg (f1)) ;
+INSERT INTO pg VALUES (1, 0);
+INSERT INTO pg VALUES (2, 0);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE pg SET f2 = 1 WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO cg VALUES (1, 1, 0);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+connection node_2;
+SELECT * FROM pg;
+f1 f2
+1 1
+2 0
+SELECT * FROM cg;
+f1 p_id f2
+1 1 0
+DROP TABLE cg;
+DROP TABLE pg;
diff --git a/mysql-test/suite/galera/r/MW-388.result b/mysql-test/suite/galera/r/MW-388.result
new file mode 100644
index 00000000..b16addc5
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-388.result
@@ -0,0 +1,50 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
+CREATE PROCEDURE insert_proc ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
+BEGIN
+GET DIAGNOSTICS CONDITION 1 @errno = MYSQL_ERRNO;
+END;
+INSERT INTO t1 VALUES (1, 'node 1'),(2, 'node 1');
+INSERT INTO t1 VALUES (3, 'node 1');
+END|
+SET GLOBAL wsrep_slave_threads = 2;
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
+connection node_2;
+INSERT INTO t1 VALUES (1, 'node 2');;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+CALL insert_proc ();;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2;
+connection node_1;
+SELECT @errno = 1213;
+@errno = 1213
+1
+SELECT * FROM t1;
+f1 f2
+1 node 2
+3 node 1
+connection node_2;
+SELECT * FROM t1;
+f1 f2
+1 node 2
+3 node 1
+connection node_1;
+SET GLOBAL wsrep_slave_threads = DEFAULT;
+DROP TABLE t1;
+DROP PROCEDURE insert_proc;
+SET GLOBAL debug_dbug = NULL;
+SET debug_sync='RESET';
+SELECT @@debug_sync;
+@@debug_sync
+ON - current signal: ''
diff --git a/mysql-test/suite/galera/r/MW-402.result b/mysql-test/suite/galera/r/MW-402.result
new file mode 100644
index 00000000..f692c90d
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-402.result
@@ -0,0 +1,252 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER, f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1) ON DELETE CASCADE);
+INSERT INTO p VALUES (1, 0);
+INSERT INTO p VALUES (2, 0);
+INSERT INTO c VALUES (1, 1, 0);
+connection node_1a;
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE c SET f2=1 where f1=1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+DELETE FROM p WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p;
+f1 f2
+2 0
+SELECT * FROM c;
+f1 p_id f2
+DROP TABLE c;
+DROP TABLE p;
+connection node_1;
+CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER, f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1) ON UPDATE CASCADE);
+INSERT INTO p VALUES (1, 0);
+INSERT INTO p VALUES (2, 0);
+INSERT INTO c VALUES (1, 1, 0);
+connection node_1a;
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE c SET f2=2 where f1=1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+UPDATE p set f1=11 WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p;
+f1 f2
+2 0
+11 0
+SELECT * FROM c;
+f1 p_id f2
+1 11 0
+DROP TABLE c;
+DROP TABLE p;
+connection node_1;
+CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER, f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p_id) REFERENCES p (f1) ON UPDATE CASCADE);
+INSERT INTO p VALUES (1, 0);
+INSERT INTO p VALUES (2, 0);
+INSERT INTO c VALUES (1, 1, 0);
+connection node_1a;
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE c SET p_id=2 where f1=1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+UPDATE p set f1=11 WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p;
+f1 f2
+2 0
+11 0
+SELECT * FROM c;
+f1 p_id f2
+1 11 0
+connection node_1a;
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE p set f1=21 WHERE f1 = 11;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+UPDATE c SET p_id=2 where f1=1;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p;
+f1 f2
+2 0
+11 0
+SELECT * FROM c;
+f1 p_id f2
+1 2 0
+DROP TABLE c;
+DROP TABLE p;
+connection node_1;
+CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
+ON DELETE CASCADE,
+CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1));
+INSERT INTO p1 VALUES (1, 0);
+INSERT INTO p2 VALUES (1, 0);
+INSERT INTO c VALUES (1, 1, 1, 0);
+connection node_1a;
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE p2 SET f2=2 where f1=1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+DELETE FROM p1 WHERE f1 = 1;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+connection node_2;
+SELECT * FROM p1;
+f1 f2
+SELECT * FROM p2;
+f1 f2
+1 2
+SELECT * FROM c;
+f1 p1_id p2_id f2
+DROP TABLE c;
+DROP TABLE p1;
+DROP TABLE p2;
+connection node_1;
+CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
+ON DELETE CASCADE,
+CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
+ON DELETE CASCADE);
+INSERT INTO p1 VALUES (1, 0);
+INSERT INTO p2 VALUES (1, 0);
+INSERT INTO c VALUES (1, 1, 1, 0);
+connection node_1a;
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+DELETE FROM p2 WHERE f1=1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+DELETE FROM p1 WHERE f1=1;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p1;
+f1 f2
+SELECT * FROM p2;
+f1 f2
+1 0
+SELECT * FROM c;
+f1 p1_id p2_id f2
+DROP TABLE c,p1,p2;
diff --git a/mysql-test/suite/galera/r/MW-416.result b/mysql-test/suite/galera/r/MW-416.result
new file mode 100644
index 00000000..98a72c8d
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-416.result
@@ -0,0 +1,102 @@
+connection node_2;
+connection node_1;
+CREATE USER 'userMW416'@'localhost';
+GRANT SELECT, INSERT, UPDATE ON test.* TO 'userMW416'@'localhost';
+connect userMW416, localhost, userMW416,, test, $NODE_MYPORT_1;
+connection userMW416;
+ALTER DATABASE db CHARACTER SET = utf8;
+ERROR 42000: Access denied for user 'userMW416'@'localhost' to database 'db'
+ALTER EVENT ev1 RENAME TO ev2;
+ERROR 42000: Access denied for user 'userMW416'@'localhost' to database 'test'
+ALTER FUNCTION fun1 COMMENT 'foo';
+ERROR 42000: alter routine command denied to user 'userMW416'@'localhost' for routine 'test.fun1'
+ALTER PROCEDURE proc1 COMMENT 'foo';
+Got one of the listed errors
+ALTER SERVER srv OPTIONS (USER 'sally');
+Got one of the listed errors
+ALTER TABLE tbl DROP COLUMN col;
+Got one of the listed errors
+ALTER VIEW vw AS SELECT 1;
+Got one of the listed errors
+CREATE DATABASE db;
+Got one of the listed errors
+CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1;
+Got one of the listed errors
+CREATE FUNCTION fun1() RETURNS int RETURN(1);
+Got one of the listed errors
+CREATE FUNCTION fun1 RETURNS STRING SONAME 'funlib.so';
+Got one of the listed errors
+CREATE PROCEDURE proc1() BEGIN END;
+Got one of the listed errors
+CREATE INDEX idx ON tbl(id);
+Got one of the listed errors
+CREATE SERVER srv FOREIGN DATA WRAPPER 'fdw' OPTIONS (USER 'user');
+Got one of the listed errors
+CREATE TABLE t (i int);
+Got one of the listed errors
+CREATE TRIGGER trg BEFORE UPDATE ON t FOR EACH ROW BEGIN END;
+Got one of the listed errors
+CREATE VIEW vw AS SELECT 1;
+Got one of the listed errors
+DROP DATABASE db;
+Got one of the listed errors
+DROP EVENT ev;
+Got one of the listed errors
+DROP FUNCTION fun1;
+Got one of the listed errors
+DROP INDEX idx ON t0;
+Got one of the listed errors
+DROP PROCEDURE proc1;
+Got one of the listed errors
+DROP SERVEr srv;
+Got one of the listed errors
+DROP TABLE t0;
+Got one of the listed errors
+DROP TRIGGER trg;
+Got one of the listed errors
+DROP VIEW vw;
+Got one of the listed errors
+RENAME TABLE t0 TO t1;
+Got one of the listed errors
+TRUNCATE TABLE t0;
+Got one of the listed errors
+ALTER USER myuser PASSWORD EXPIRE;
+Got one of the listed errors
+CREATE USER myuser IDENTIFIED BY 'pass';
+Got one of the listed errors
+DROP USER myuser;
+Got one of the listed errors
+GRANT ALL ON *.* TO 'myuser';
+Got one of the listed errors
+RENAME USER myuser TO mariauser;
+Got one of the listed errors
+REVOKE SELECT ON test FROM myuser;
+Got one of the listed errors
+REVOKE ALL, GRANT OPTION FROM myuser;
+Got one of the listed errors
+REVOKE PROXY ON myuser FROM myuser;
+Got one of the listed errors
+ANALYZE TABLE db.tbl;
+Got one of the listed errors
+CHECK TABLE db.tbl;
+Got one of the listed errors
+CHECKSUM TABLE db.tbl;
+Got one of the listed errors
+OPTIMIZE TABLE db.tbl;
+Got one of the listed errors
+REPAIR TABLE db.tbl;
+Got one of the listed errors
+INSTALL PLUGIN plg SONAME 'plg.so';
+Got one of the listed errors
+UNINSTALL PLUGIN plg;
+Got one of the listed errors
+connection node_1;
+DROP USER 'userMW416'@'localhost';
+SHOW DATABASES;
+Database
+information_schema
+mtr
+mysql
+performance_schema
+sys
+test
diff --git a/mysql-test/suite/galera/r/MW-44.result b/mysql-test/suite/galera/r/MW-44.result
new file mode 100644
index 00000000..604bd139
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-44.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+connection node_1;
+TRUNCATE TABLE mysql.general_log;
+connection node_2;
+connection node_1;
+SET SESSION wsrep_osu_method=TOI;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_osu_method=RSU;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SET SESSION wsrep_osu_method=TOI;
+connection node_2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/MW-86-wait1.result b/mysql-test/suite/galera/r/MW-86-wait1.result
new file mode 100644
index 00000000..8ad9c8bf
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-86-wait1.result
@@ -0,0 +1,48 @@
+connection node_2;
+connection node_1;
+SET @orig_debug=@@debug_dbug;
+connection node_2;
+SELECT @@debug_sync;
+@@debug_sync
+ON - current signal: ''
+set debug_sync='RESET';
+SET SESSION wsrep_sync_wait = 1;
+SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
+connection node_1;
+CREATE TABLE t_wait1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t_wait1 VALUES (1);
+connection node_2;
+SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SHOW BINARY LOGS;
+SHOW BINLOG EVENTS;
+SHOW COLUMNS FROM t1;
+SHOW CREATE EVENT e1;
+SHOW CREATE FUNCTION f1;
+SHOW CREATE PROCEDURE p1;
+SHOW CREATE TABLE t1;
+SHOW CREATE TRIGGER tr1;
+SHOW CREATE VIEW v1;
+SHOW DATABASES;
+SHOW ENGINE InnoDB STATUS;
+SHOW FUNCTION CODE f1;
+SHOW FUNCTION STATUS;
+SHOW GRANTS FOR 'root'@'localhost';
+SHOW INDEX FROM t1;
+SHOW OPEN TABLES;
+SHOW PROCEDURE CODE p1;
+SHOW PROCEDURE STATUS;
+SHOW PRIVILEGES;
+SHOW STATUS LIKE 'wsrep_cluster_size';
+SHOW TABLE STATUS;
+SHOW TABLES;
+SHOW TRIGGERS;
+SHOW GLOBAL VARIABLES LIKE 'foo_bar';
+SHOW WARNINGS;
+SET GLOBAL debug_dbug = @orig_debug;
+SET SESSION debug_sync = "now SIGNAL signal.wsrep_apply_cb";
+SET debug_sync='RESET';
+SET SESSION wsrep_sync_wait = default;
+DROP TABLE t_wait1;
+SELECT @@debug_sync;
+@@debug_sync
+ON - current signal: ''
diff --git a/mysql-test/suite/galera/r/MW-86-wait8.result b/mysql-test/suite/galera/r/MW-86-wait8.result
new file mode 100644
index 00000000..07e59ebb
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-86-wait8.result
@@ -0,0 +1,49 @@
+connection node_2;
+connection node_1;
+SET @orig_debug=@@debug_dbug;
+connection node_2;
+SELECT @@debug_sync;
+@@debug_sync
+ON - current signal: ''
+SET SESSION wsrep_sync_wait = 8;
+SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
+connection node_1;
+CREATE TABLE t_wait8 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t_wait8 VALUES (1);
+connection node_2;
+SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT0.1S";
+SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SHOW BINARY LOGS;
+SHOW BINLOG EVENTS;
+SHOW COLUMNS FROM t1;
+SHOW CREATE DATABASE db1;
+SHOW CREATE EVENT e1;
+SHOW CREATE FUNCTION f1;
+SHOW CREATE PROCEDURE p1;
+SHOW CREATE TABLE t1;
+SHOW CREATE TRIGGER tr1;
+SHOW CREATE VIEW v1;
+SHOW DATABASES;
+SHOW ENGINE InnoDB STATUS;
+SHOW FUNCTION CODE f1;
+SHOW FUNCTION STATUS;
+SHOW GRANTS FOR 'root'@'localhost';
+SHOW INDEX FROM t1;
+SHOW OPEN TABLES;
+SHOW PROCEDURE CODE p1;
+SHOW PROCEDURE STATUS;
+SHOW PRIVILEGES;
+SHOW STATUS LIKE 'wsrep_cluster_size';
+SHOW TABLE STATUS;
+SHOW TABLES;
+SHOW TRIGGERS;
+SHOW GLOBAL VARIABLES LIKE 'foo_bar';
+SHOW WARNINGS;
+SET GLOBAL debug_dbug = @orig_debug;
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET debug_sync='RESET';
+SET SESSION wsrep_sync_wait = default;
+DROP TABLE t_wait8;
+SELECT @@debug_sync;
+@@debug_sync
+ON - current signal: ''
diff --git a/mysql-test/suite/galera/r/basic.result b/mysql-test/suite/galera/r/basic.result
new file mode 100644
index 00000000..10f180e7
--- /dev/null
+++ b/mysql-test/suite/galera/r/basic.result
@@ -0,0 +1,36 @@
+connection node_2;
+connection node_1;
+USE test;
+CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+SELECT * FROM t1;
+c1
+1
+2
+3
+4
+5
+
+# On node_1
+connection node_1;
+SELECT * FROM test.t1;
+c1
+1
+2
+3
+4
+5
+
+# On node_2
+connection node_2;
+SELECT * FROM test.t1;
+c1
+1
+2
+3
+4
+5
+DROP TABLE t1;
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/binlog_checksum.result b/mysql-test/suite/galera/r/binlog_checksum.result
new file mode 100644
index 00000000..4106354e
--- /dev/null
+++ b/mysql-test/suite/galera/r/binlog_checksum.result
@@ -0,0 +1,45 @@
+connection node_2;
+connection node_1;
+# On node_1
+connection node_1;
+SET @binlog_checksum_saved= @@GLOBAL.BINLOG_CHECKSUM;
+SET @@GLOBAL.BINLOG_CHECKSUM=CRC32;
+# On node_2
+connection node_2;
+SET @binlog_checksum_saved= @@GLOBAL.BINLOG_CHECKSUM;
+SET @@GLOBAL.BINLOG_CHECKSUM=CRC32;
+USE test;
+CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
+SELECT * FROM t1;
+c1
+1
+2
+3
+4
+5
+SELECT * FROM test.t1;
+c1
+1
+2
+3
+4
+5
+
+# On node_2
+connection node_2;
+SELECT * FROM test.t1;
+c1
+1
+2
+3
+4
+5
+DROP TABLE t1;
+connection node_1;
+SET @@GLOBAL.BINLOG_CHECKSUM = @binlog_checksum_saved;
+connection node_2;
+SET @@GLOBAL.BINLOG_CHECKSUM = @binlog_checksum_saved;
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/create.result b/mysql-test/suite/galera/r/create.result
new file mode 100644
index 00000000..16ae684a
--- /dev/null
+++ b/mysql-test/suite/galera/r/create.result
@@ -0,0 +1,98 @@
+connection node_2;
+connection node_1;
+#
+# MDEV-6924 : Server crashed on CREATE TABLE ... SELECT
+#
+SET @wsrep_forced_binlog_format_saved=@@GLOBAL.wsrep_forced_binlog_format;
+SET @@GLOBAL.wsrep_forced_binlog_format=STATEMENT;
+SHOW VARIABLES LIKE '%log%bin%';
+Variable_name Value
+log_bin OFF
+log_bin_basename
+log_bin_compress OFF
+log_bin_compress_min_len 256
+log_bin_index
+log_bin_trust_function_creators ON
+sql_log_bin ON
+USE test;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+CREATE TEMPORARY TABLE `t1_temp` AS SELECT * FROM `t1` WHERE i = 1;
+Warnings:
+Warning 1105 Galera does not support wsrep_forced_binlog_format = STMT in CREATE TABLE AS SELECT
+SELECT * FROM t1;
+i
+1
+SELECT * FROM t1_temp;
+i
+1
+DROP TABLE t1;
+SET @@GLOBAL.wsrep_forced_binlog_format=@wsrep_forced_binlog_format_saved;
+#
+# MDEV-7673: CREATE TABLE SELECT fails on Galera cluster
+#
+connection node_1;
+CREATE TABLE t1 (i INT) ENGINE=INNODB DEFAULT CHARSET=utf8 SELECT 1 as i;
+SELECT * FROM t1;
+i
+1
+connection node_2;
+SELECT * FROM t1;
+i
+1
+DROP TABLE t1;
+#
+# MDEV-8166 : Adding index on new table from select crashes Galera
+# cluster
+#
+connection node_1;
+CREATE TABLE t1(i int(11) NOT NULL DEFAULT '0') ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1(i) VALUES (1), (2), (3);
+CREATE TABLE t2 (i INT) SELECT i FROM t1;
+ALTER TABLE t2 ADD INDEX idx(i);
+SELECT * FROM t2;
+i
+1
+2
+3
+connection node_2;
+SELECT * FROM t2;
+i
+1
+2
+3
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `i` int(11) DEFAULT NULL,
+ KEY `idx` (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1, t2;
+#
+# MDEV-9853: WSREP says it cannot get fake InnoDB transaction ID
+# followed by segmentation fault
+#
+CREATE TABLE `t1`(`c1` INT) ENGINE=INNODB;
+SET autocommit=0;
+CREATE TABLE `t2` (`c1` INT) ENGINE=INNODB SELECT * FROM t1;
+COMMIT;
+SET autocommit=1;
+DROP TABLE t1, t2;
+#
+# MDEV-10235: Deadlock in CREATE TABLE ... AS SELECT .. if result set
+# is empty in Galera
+#
+connection node_1;
+CREATE TABLE t1(c1 INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+CREATE TABLE t2 AS SELECT * FROM t1 WHERE c1=2;
+connection node_2;
+SELECT * FROM t1;
+c1
+1
+SELECT * FROM t2;
+c1
+DROP TABLE t1, t2;
+disconnect node_2;
+disconnect node_1;
+# End of tests
diff --git a/mysql-test/suite/galera/r/enforce_storage_engine.result b/mysql-test/suite/galera/r/enforce_storage_engine.result
new file mode 100644
index 00000000..1a453241
--- /dev/null
+++ b/mysql-test/suite/galera/r/enforce_storage_engine.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+#
+# MDEV-8831 : enforce_storage_engine doesn't block table creation on
+# other nodes (galera cluster)
+#
+connection node_1;
+SET @@enforce_storage_engine=INNODB;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+CREATE TABLE t2(i INT) ENGINE=MYISAM;
+ERROR 42000: Unknown storage engine 'MyISAM'
+INSERT INTO t1 VALUES(1);
+connection node_2;
+SHOW TABLES;
+Tables_in_test
+t1
+SELECT COUNT(*)=1 FROM t1;
+COUNT(*)=1
+1
+CREATE TABLE t2(i INT) ENGINE=MYISAM;
+connection node_1;
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+DROP TABLE t1, t2;
+# End of tests
diff --git a/mysql-test/suite/galera/r/enforce_storage_engine2.result b/mysql-test/suite/galera/r/enforce_storage_engine2.result
new file mode 100644
index 00000000..b652eacd
--- /dev/null
+++ b/mysql-test/suite/galera/r/enforce_storage_engine2.result
@@ -0,0 +1,29 @@
+connection node_2;
+connection node_1;
+#
+# MDEV-9312: storage engine not enforced during galera cluster
+# replication
+#
+connection node_1;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+CREATE TABLE t2(i INT) ENGINE=MYISAM;
+Warnings:
+Note 1266 Using storage engine InnoDB for table 't2'
+Note 1266 Using storage engine InnoDB for table 't2'
+connection node_2;
+SHOW TABLES;
+Tables_in_test
+t1
+t2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1, t2;
+# End of tests
diff --git a/mysql-test/suite/galera/r/ev51914.result b/mysql-test/suite/galera/r/ev51914.result
new file mode 100644
index 00000000..b9d8a82b
--- /dev/null
+++ b/mysql-test/suite/galera/r/ev51914.result
@@ -0,0 +1,175 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SAVEPOINT in a stored function should be forbidden
+CREATE FUNCTION f1 () RETURNS INT BEGIN
+SAVEPOINT s;
+RETURN 1;
+END|
+SELECT f1();
+f1()
+1
+DROP FUNCTION f1;
+ROLLBACK TO SAVEPOINT in a stored function should be forbidden
+CREATE FUNCTION f2 () RETURNS INT BEGIN
+ROLLBACK TO SAVEPOINT s;
+RETURN 1;
+END|
+BEGIN;
+SAVEPOINT s;
+SELECT f2();
+ERROR 42000: SAVEPOINT s does not exist
+COMMIT;
+DROP FUNCTION f2;
+BEGIN;
+SAVEPOINT S;
+ROLLBACK TO SAVEPOINT S;
+COMMIT;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 values (110), (111), (112), (113), (114);
+Direct SAVEPOINT in a trigger should be forbidden
+connection node_2;
+CREATE TRIGGER i1_t1 BEFORE INSERT ON t1 FOR EACH ROW SAVEPOINT s;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+DROP TRIGGER i1_t1;
+CREATE TRIGGER i2_t1 AFTER INSERT ON t1 FOR EACH ROW SAVEPOINT s;
+INSERT INTO t1 VALUES (2);
+DROP TRIGGER i2_t1;
+INSERT INTO t1 VALUES (3);
+CREATE TRIGGER u1_t1 BEFORE UPDATE ON t1 FOR EACH ROW SAVEPOINT s;
+UPDATE t1 SET a=4 WHERE a=3;
+DROP TRIGGER u1_t1;
+CREATE TRIGGER u2_t1 AFTER UPDATE ON t1 FOR EACH ROW SAVEPOINT s;
+UPDATE t1 SET a=4 WHERE a=3;
+DROP TRIGGER u2_t1;
+CREATE TRIGGER d1_t1 BEFORE DELETE ON t1 FOR EACH ROW SAVEPOINT s;
+DELETE FROM t1;
+DROP TRIGGER d1_t1;
+CREATE TRIGGER d1_t1 AFTER DELETE ON t1 FOR EACH ROW SAVEPOINT s;
+DELETE FROM t1;
+DROP TRIGGER d1_t1;
+SAVEPOINT in a compound statement in a trigger should be forbidden
+CREATE TRIGGER i3_t1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN
+SAVEPOINT s;
+END|
+INSERT INTO t1 VALUES (5);
+DROP TRIGGER i3_t1;
+SAVEPOINT in a PS call in a trigger should be forbidden
+CREATE TRIGGER i4_t1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN
+PREPARE set_savepoint FROM "SAVEPOINT s";
+EXECUTE set_savepoint;
+DEALLOCATE PREPARE set_savepoint;
+END|
+ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
+connection node_2;
+SAVEPOINT in SP called from a trigger should be forbidden
+CREATE PROCEDURE p1() BEGIN
+SAVEPOINT s;
+END|
+connection node_1;
+CREATE TRIGGER i5_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p1;
+INSERT INTO t1 VALUES (6);
+DROP TRIGGER i5_t1;
+SAVEPOINT in a SP called from a PS called from a trigger be forbidden
+PREPARE call_p1 FROM "CALL p1";
+CREATE TRIGGER i6_t1 BEFORE INSERT ON t1 FOR EACH ROW EXECUTE call_p1;
+ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
+SAVEPOINT in a function called from a trigger should be forbidden
+CREATE FUNCTION f1 () RETURNS INT BEGIN
+SAVEPOINT s;
+RETURN 1;
+END|
+CREATE TRIGGER i7_t1 BEFORE INSERT ON t1 FOR EACH ROW SET @foo = f1();
+INSERT INTO t1 VALUES (7);
+DROP TRIGGER i7_t1;
+SAVEPOINT in a SP called from a SP called from a trigger should be forbidden
+CREATE PROCEDURE p2() BEGIN
+CALL p1();
+END|
+CREATE TRIGGER i8_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p2;
+INSERT INTO t1 VALUES (8);
+DROP TRIGGER i8_t1;
+SAVEPOINT in a SP called from a trigger called from a SP should be forbidden
+CREATE TRIGGER i9_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p1;
+CREATE PROCEDURE p3() BEGIN
+INSERT INTO t1 VALUES (9);
+END|
+CALL p3();
+DROP TRIGGER i9_t1;
+ROLLBACK TO SAVEPOINT in trigger as a trivial statement should be forbidden
+CREATE TRIGGER i4_t1 BEFORE INSERT ON t1 FOR EACH ROW ROLLBACK TO SAVEPOINT s;
+BEGIN;
+SAVEPOINT s;
+INSERT INTO t1 VALUES (5);
+ERROR 42000: SAVEPOINT s does not exist
+COMMIT;
+DROP TRIGGER i4_t1;
+ROLLBACK TO SAVEPOINT in a trigger in a SP call should be forbidden
+CREATE PROCEDURE p4() BEGIN
+ROLLBACK TO SAVEPOINT s;
+END|
+CREATE TRIGGER i5_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p4;
+BEGIN;
+SAVEPOINT s;
+INSERT INTO t1 VALUES (6);
+ERROR 42000: SAVEPOINT s does not exist
+COMMIT;
+DROP TRIGGER i5_t1;
+SAVEPOINT in a SP next to a trigger should work
+CREATE TRIGGER i6_t1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a = NEW.a + 1;
+CREATE PROCEDURE p5() BEGIN
+SAVEPOINT s;
+INSERT INTO t1 VALUES (10);
+ROLLBACK TO SAVEPOINT s;
+END|
+BEGIN;
+CALL p5();
+COMMIT;
+DROP TRIGGER i6_t1;
+connection node_2;
+create trigger t1 before insert on t1 for each row
+begin
+insert into t2 values (NULL);
+end|
+connection node_1;
+INSERT INTO t1 VALUES (201), (202), (203);
+connection node_1;
+SELECT * FROM t1;
+a
+5
+6
+7
+8
+9
+201
+202
+203
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+3
+connection node_2;
+SELECT * FROM t1;
+a
+5
+6
+7
+8
+9
+201
+202
+203
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+3
+connection node_1;
+DEALLOCATE PREPARE call_p1;
+connection node_2;
+DROP TABLE t1, t2;
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP PROCEDURE p3;
+DROP PROCEDURE p4;
+DROP PROCEDURE p5;
+DROP FUNCTION f1;
diff --git a/mysql-test/suite/galera/r/fk.result b/mysql-test/suite/galera/r/fk.result
new file mode 100644
index 00000000..17fc99a9
--- /dev/null
+++ b/mysql-test/suite/galera/r/fk.result
@@ -0,0 +1,105 @@
+connection node_2;
+connection node_1;
+USE test;
+
+# On node_1
+connection node_1;
+CREATE TABLE networks (
+`tenant_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+`id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
+`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+`status` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL,
+`admin_state_up` tinyint(1) DEFAULT NULL,
+`shared` tinyint(1) DEFAULT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+CREATE TABLE ports (
+`tenant_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+`id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
+`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+`network_id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
+`mac_address` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
+`admin_state_up` tinyint(1) NOT NULL,
+`status` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
+`device_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+`device_owner` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+PRIMARY KEY (`id`),
+KEY `network_id` (`network_id`),
+CONSTRAINT `ports_ibfk_1` FOREIGN KEY (`network_id`) REFERENCES networks (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+CREATE TABLE subnets (
+`tenant_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+`id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
+`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
+`network_id` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
+`ip_version` int(11) NOT NULL,
+`cidr` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
+`gateway_ip` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
+`enable_dhcp` tinyint(1) DEFAULT NULL,
+`shared` tinyint(1) DEFAULT NULL,
+`ipv6_ra_mode` enum('slaac','dhcpv6-stateful','dhcpv6-stateless') COLLATE utf8_unicode_ci DEFAULT NULL,
+`ipv6_address_mode` enum('slaac','dhcpv6-stateful','dhcpv6-stateless') COLLATE utf8_unicode_ci DEFAULT NULL,
+PRIMARY KEY (`id`),
+KEY `network_id` (`network_id`),
+CONSTRAINT `subnets_ibfk_1` FOREIGN KEY (`network_id`) REFERENCES networks (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+CREATE TABLE `ipallocations` (
+`port_id` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
+`ip_address` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
+`subnet_id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
+`network_id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
+PRIMARY KEY (`ip_address`,`subnet_id`,`network_id`),
+KEY `port_id` (`port_id`),
+KEY `subnet_id` (`subnet_id`),
+KEY `network_id` (`network_id`),
+CONSTRAINT `ipallocations_ibfk_1` FOREIGN KEY (`port_id`) REFERENCES `ports` (`id`) ON DELETE CASCADE,
+CONSTRAINT `ipallocations_ibfk_2` FOREIGN KEY (`subnet_id`) REFERENCES `subnets` (`id`) ON DELETE CASCADE,
+CONSTRAINT `ipallocations_ibfk_3` FOREIGN KEY (`network_id`) REFERENCES `networks` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+INSERT INTO networks VALUES ('f37aa3fe-ab99-4d0f-a566-6cd3169d7516','f37aa3fe-ab99-4d0f-a566-6cd3169d7516','MyNet','ACTIVE',0,0);
+INSERT INTO ports VALUES ('','f37aa3fe-ab99-4d0f-a566-6cd3169d7516','','f37aa3fe-ab99-4d0f-a566-6cd3169d7516','fa:16:3e:e3:cc:bb',1,'DOWN','f37aa3fe-ab99-4d0f-a566-6cd3169d7516','network:router_gateway');
+INSERT INTO subnets VALUES ('f37aa3fe-ab99-4d0f-a566-6cd3169d7516','f37aa3fe-ab99-4d0f-a566-6cd3169d7516','ext-subnet','f37aa3fe-ab99-4d0f-a566-6cd3169d7516',4,'10.25.0.0/24','10.25.0.4',0,1,NULL,NULL);
+INSERT INTO ipallocations VALUES ('f37aa3fe-ab99-4d0f-a566-6cd3169d7516','10.25.0.17','f37aa3fe-ab99-4d0f-a566-6cd3169d7516','f37aa3fe-ab99-4d0f-a566-6cd3169d7516');
+select * from ports where ports.id = 'f37aa3fe-ab99-4d0f-a566-6cd3169d7516';
+tenant_id id name network_id mac_address admin_state_up status device_id device_owner
+ f37aa3fe-ab99-4d0f-a566-6cd3169d7516 f37aa3fe-ab99-4d0f-a566-6cd3169d7516 fa:16:3e:e3:cc:bb 1 DOWN f37aa3fe-ab99-4d0f-a566-6cd3169d7516 network:router_gateway
+connection node_2;
+select * from ports where ports.id = 'f37aa3fe-ab99-4d0f-a566-6cd3169d7516';
+tenant_id id name network_id mac_address admin_state_up status device_id device_owner
+ f37aa3fe-ab99-4d0f-a566-6cd3169d7516 f37aa3fe-ab99-4d0f-a566-6cd3169d7516 fa:16:3e:e3:cc:bb 1 DOWN f37aa3fe-ab99-4d0f-a566-6cd3169d7516 network:router_gateway
+connection node_1;
+DELETE FROM ports WHERE ports.id = 'f37aa3fe-ab99-4d0f-a566-6cd3169d7516';
+select * from networks;
+tenant_id id name status admin_state_up shared
+f37aa3fe-ab99-4d0f-a566-6cd3169d7516 f37aa3fe-ab99-4d0f-a566-6cd3169d7516 MyNet ACTIVE 0 0
+select * from ports;
+tenant_id id name network_id mac_address admin_state_up status device_id device_owner
+select * from subnets;
+tenant_id id name network_id ip_version cidr gateway_ip enable_dhcp shared ipv6_ra_mode ipv6_address_mode
+f37aa3fe-ab99-4d0f-a566-6cd3169d7516 f37aa3fe-ab99-4d0f-a566-6cd3169d7516 ext-subnet f37aa3fe-ab99-4d0f-a566-6cd3169d7516 4 10.25.0.0/24 10.25.0.4 0 1 NULL NULL
+select * from ipallocations;
+port_id ip_address subnet_id network_id
+select * from ports;
+tenant_id id name network_id mac_address admin_state_up status device_id device_owner
+
+# On node_2
+connection node_2;
+select * from networks;
+tenant_id id name status admin_state_up shared
+f37aa3fe-ab99-4d0f-a566-6cd3169d7516 f37aa3fe-ab99-4d0f-a566-6cd3169d7516 MyNet ACTIVE 0 0
+select * from ports;
+tenant_id id name network_id mac_address admin_state_up status device_id device_owner
+select * from subnets;
+tenant_id id name network_id ip_version cidr gateway_ip enable_dhcp shared ipv6_ra_mode ipv6_address_mode
+f37aa3fe-ab99-4d0f-a566-6cd3169d7516 f37aa3fe-ab99-4d0f-a566-6cd3169d7516 ext-subnet f37aa3fe-ab99-4d0f-a566-6cd3169d7516 4 10.25.0.0/24 10.25.0.4 0 1 NULL NULL
+select * from ipallocations;
+port_id ip_address subnet_id network_id
+select * from ports;
+tenant_id id name network_id mac_address admin_state_up status device_id device_owner
+connection node_1;
+drop table ipallocations;
+drop table subnets;
+drop table ports;
+drop table networks;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera#414.result b/mysql-test/suite/galera/r/galera#414.result
new file mode 100644
index 00000000..2c1dccfd
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera#414.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_on = OFF;
+connection node_2;
+connection node_1;
+SET SESSION wsrep_on = ON;
+connection node_1;
+CALL mtr.add_suppression("Failed to set packet size");
+connection node_2;
+CALL mtr.add_suppression("Failed to set packet size");
diff --git a/mysql-test/suite/galera/r/galera#500.result b/mysql-test/suite/galera/r/galera#500.result
new file mode 100644
index 00000000..a5ab0b19
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera#500.result
@@ -0,0 +1,18 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options="gmcast.isolate=2";
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status non-Primary
+SET SESSION wsrep_sync_wait = default;
+SET GLOBAL wsrep_provider_options="pc.bootstrap=1";
+connection node_2;
+SET SESSION wsrep_on=0;
+connection node_2;
+CALL mtr.add_suppression("WSREP: exception from gcomm, backend must be restarted: Gcomm backend termination was requested by setting gmcast.isolate=2.");
diff --git a/mysql-test/suite/galera/r/galera#505.result b/mysql-test/suite/galera/r/galera#505.result
new file mode 100644
index 00000000..d5e78c57
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera#505.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+# Correct Galera library found
+SET SESSION wsrep_sync_wait=DEFAULT;
+SET GLOBAL wsrep_provider_options = 'pc.weight=3';
+SHOW GLOBAL VARIABLES LIKE 'wsrep_provider_options';
+Variable_name Value
+wsrep_provider_options pc.weight = 3
+SET GLOBAL wsrep_provider_options = 'pc.weight=1';
diff --git a/mysql-test/suite/galera/r/galera-features#117.result b/mysql-test/suite/galera/r/galera-features#117.result
new file mode 100644
index 00000000..21d810ca
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera-features#117.result
@@ -0,0 +1,40 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+SET SESSION wsrep_on=OFF;
+CREATE TABLE test.t1 (f2 INTEGER);
+SET SESSION wsrep_on=ON;
+CREATE TABLE test.t1 (f1 INTEGER);
+ERROR 42S01: Table 't1' already exists
+connection node_1;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Primary
+DROP TABLE test.t1;
+connection node_2;
+SET SESSION wsrep_sync_wait=0;
+SHOW CREATE TABLE test.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f2` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Disconnected
+CREATE TABLE test.t2 (f1 INTEGER);
+ERROR 08S01: WSREP has not yet prepared node for application use
+SHOW TABLES IN test;
+Tables_in_test
+t1
+Killing server ...
+CALL mtr.add_suppression("Inconsistent by consensus.");
+CALL mtr.add_suppression("WSREP: Failed to execute TOI action");
+CALL mtr.add_suppression("WSREP: TO isolation end failed");
+connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result b/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result
new file mode 100644
index 00000000..b40c57c5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_FK_duplicate_client_insert.result
@@ -0,0 +1,382 @@
+connection node_2;
+connection node_1;
+CREATE TABLE user(id int primary key, j int) ENGINE=InnoDB;
+CREATE TABLE user_session(id int primary key, fk1 int, fk2 int) ENGINE=InnoDB;
+alter table user_session add foreign key (fk1) references user(id);
+INSERT INTO user values (1,0), (2,0), (3,0), (4,0);
+INSERT INTO user_session values (1,1,1);
+connect node_1_u, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1_i, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_2_i, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+"Phase 1: plain SQL statements"
+connection node_1;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+update user set j = j + 1 WHERE id > 0;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+insert into user_session(id,fk1,fk2) values (2, 2, 2);
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+insert into user_session(id,fk1,fk2) values (2, 2, 3);
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+"Phase 2: prepared statements"
+connection node_1_u;
+prepare upd from 'update user set j = j + 1 WHERE id > 0';
+connection node_1_i;
+prepare ins1 from 'insert into user_session(id,fk1,fk2) values (2, 2, 2)';
+connection node_2_i;
+prepare ins2 from 'insert into user_session(id,fk1,fk2) values (2, 2, 3)';
+connection node_1;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1_u;
+begin;
+execute upd;
+connection node_1_i;
+set debug_sync='lock_wait_start SIGNAL ins_waiting WAIT_FOR cont_ins';
+execute ins1;
+connection node_1;
+set debug_sync='now WAIT_FOR ins_waiting';
+connection node_2_i;
+execute ins2;
+connection node_1;
+set debug_sync='now SIGNAL cont_ins';
+connection node_1_i;
+connection node_1_u;
+commit;
+connection node_1;
+truncate user_session;
+set debug_sync = reset;
+connection node_1;
+drop table user_session,user;
diff --git a/mysql-test/suite/galera/r/galera_MDEV-29512.result b/mysql-test/suite/galera/r/galera_MDEV-29512.result
new file mode 100644
index 00000000..aaf24df9
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_MDEV-29512.result
@@ -0,0 +1,40 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 varchar(2000));
+INSERT INTO t1 VALUES (1, 0, REPEAT('1234567890', 200));
+INSERT INTO t1 VALUES (3, 3, REPEAT('1234567890', 200));
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait=0;
+connection node_1;
+begin;
+select f1,f2 from t1;
+f1 f2
+1 0
+3 3
+connection node_2;
+UPDATE t1 SET f2=2 WHERE f1=3;
+connection node_1a;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_1;
+UPDATE t1 SET f2=1 WHERE f1=3;
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = NULL;
+SET debug_sync='RESET';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+select f1,f2 from t1;
+f1 f2
+1 0
+3 2
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_UK_conflict.result b/mysql-test/suite/galera/r/galera_UK_conflict.result
new file mode 100644
index 00000000..b0420d58
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_UK_conflict.result
@@ -0,0 +1,181 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 int, unique key keyj (f2));
+INSERT INTO t1 VALUES (1, 1, 0);
+INSERT INTO t1 VALUES (3, 3, 0);
+INSERT INTO t1 VALUES (10, 10, 0);
+SET GLOBAL wsrep_slave_threads = 3;
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+START TRANSACTION;
+DELETE FROM t1 WHERE f2 = 3;
+INSERT INTO t1 VALUES (3, 3, 1);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait=0;
+connection node_2;
+INSERT INTO t1 VALUES (5, 5, 2);
+connection node_1a;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (4, 4, 2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = NULL;
+SET debug_sync='RESET';
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = NULL;
+SET debug_sync='RESET';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+SELECT * FROM t1;
+f1 f2 f3
+1 1 0
+3 3 1
+4 4 2
+5 5 2
+10 10 0
+SET GLOBAL wsrep_slave_threads = DEFAULT;
+connection node_2;
+SELECT * FROM t1;
+f1 f2 f3
+1 1 0
+3 3 1
+4 4 2
+5 5 2
+10 10 0
+INSERT INTO t1 VALUES (7,7,7);
+INSERT INTO t1 VALUES (8,8,8);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+7
+SELECT * FROM t1;
+f1 f2 f3
+1 1 0
+3 3 1
+4 4 2
+5 5 2
+7 7 7
+8 8 8
+10 10 0
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+7
+SELECT * FROM t1;
+f1 f2 f3
+1 1 0
+3 3 1
+4 4 2
+5 5 2
+7 7 7
+8 8 8
+10 10 0
+DROP TABLE t1;
+test scenario 2
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 int, unique key keyj (f2));
+INSERT INTO t1 VALUES (1, 1, 0);
+INSERT INTO t1 VALUES (3, 3, 0);
+INSERT INTO t1 VALUES (10, 10, 0);
+SET GLOBAL wsrep_slave_threads = 3;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+START TRANSACTION;
+DELETE FROM t1 WHERE f2 = 3;
+INSERT INTO t1 VALUES (3, 3, 1);
+connection node_1a;
+SET SESSION wsrep_sync_wait=0;
+connection node_2;
+INSERT INTO t1 VALUES (5, 5, 2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_replay_cb";
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_replay_cb_reached";
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (4, 4, 2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_replay_cb";
+SET GLOBAL debug_dbug = NULL;
+SET debug_sync='RESET';
+connection node_1;
+SET GLOBAL wsrep_slave_threads = DEFAULT;
+connection node_2;
+SELECT * FROM t1;
+f1 f2 f3
+1 1 0
+3 3 1
+4 4 2
+5 5 2
+10 10 0
+INSERT INTO t1 VALUES (7,7,7);
+INSERT INTO t1 VALUES (8,8,8);
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+7
+SELECT * FROM t1;
+f1 f2 f3
+1 1 0
+3 3 1
+4 4 2
+5 5 2
+7 7 7
+8 8 8
+10 10 0
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+7
+SELECT * FROM t1;
+f1 f2 f3
+1 1 0
+3 3 1
+4 4 2
+5 5 2
+7 7 7
+8 8 8
+10 10 0
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_admin.result b/mysql-test/suite/galera/r/galera_admin.result
new file mode 100644
index 00000000..f733b7b6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_admin.result
@@ -0,0 +1,117 @@
+connection node_2;
+connection node_1;
+DROP TABLE IF EXISTS t1, t2;
+DROP TABLE IF EXISTS x1, x2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
+SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
+CREATE TABLE x1 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE x2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO x1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO t2 (f2) SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4;
+INSERT INTO x2 (f2) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+connection node_2;
+# ANALYZE test
+connection node_2;
+connection node_1;
+ANALYZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+connection node_2;
+# OPTIMIZE test
+connection node_2;
+connection node_1;
+OPTIMIZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t2 optimize status OK
+connection node_2;
+# REPAIR test
+connection node_2;
+connection node_1;
+REPAIR TABLE x1, x2;
+Table Op Msg_type Msg_text
+test.x1 repair status OK
+test.x2 repair status OK
+connection node_2;
+connection node_2;
+SELECT COUNT(*) = 10 FROM t1;
+COUNT(*) = 10
+1
+SELECT COUNT(*) = 10 FROM x1;
+COUNT(*) = 10
+1
+SELECT COUNT(*) = 10000 FROM t2;
+COUNT(*) = 10000
+1
+SELECT COUNT(*) = 10 FROM x2;
+COUNT(*) = 10
+1
+connection node_1;
+DROP TABLE t1, t2;
+DROP TABLE x1, x2;
+#
+# ARIA
+#
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
+SET GLOBAL wsrep_mode = REPLICATE_ARIA;
+CREATE TABLE x1 (f1 INTEGER) ENGINE=ARIA;
+CREATE TABLE x2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=ARIA;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO x1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO t2 (f2) SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4;
+INSERT INTO x2 (f2) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+connection node_2;
+# ANALYZE test
+connection node_2;
+connection node_1;
+ANALYZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+connection node_2;
+# OPTIMIZE test
+connection node_2;
+connection node_1;
+OPTIMIZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t2 optimize status OK
+connection node_2;
+# REPAIR test
+connection node_2;
+connection node_1;
+REPAIR TABLE x1, x2;
+Table Op Msg_type Msg_text
+test.x1 repair status OK
+test.x2 repair status OK
+connection node_2;
+connection node_2;
+SELECT COUNT(*) = 10 FROM t1;
+COUNT(*) = 10
+1
+SELECT COUNT(*) = 10 FROM x1;
+COUNT(*) = 10
+1
+SELECT COUNT(*) = 10000 FROM t2;
+COUNT(*) = 10000
+1
+SELECT COUNT(*) = 10 FROM x2;
+COUNT(*) = 10
+1
+connection node_1;
+DROP TABLE t1, t2;
+DROP TABLE x1, x2;
diff --git a/mysql-test/suite/galera/r/galera_alter_engine_innodb.result b/mysql-test/suite/galera/r/galera_alter_engine_innodb.result
new file mode 100644
index 00000000..dfa30441
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_alter_engine_innodb.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ENGINE=InnoDB;
+connection node_2;
+SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+ENGINE = 'InnoDB'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_alter_engine_myisam.result b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result
new file mode 100644
index 00000000..f29c83ca
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result
@@ -0,0 +1,28 @@
+connection node_2;
+connection node_1;
+SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ENGINE=InnoDB;
+connection node_2;
+SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+ENGINE = 'InnoDB'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+connection node_1;
+SET GLOBAL wsrep_mode = REPLICATE_ARIA;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=ARIA;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 ENGINE=InnoDB;
+connection node_2;
+SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+ENGINE = 'InnoDB'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_alter_table_force.result b/mysql-test/suite/galera/r/galera_alter_table_force.result
new file mode 100644
index 00000000..27179642
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_alter_table_force.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+ALTER TABLE t1 FORCE;
+connection node_2;
+SELECT ENGINE = 'InnoDB' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+ENGINE = 'InnoDB'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_applier_ftwrl_table.result b/mysql-test/suite/galera/r/galera_applier_ftwrl_table.result
new file mode 100644
index 00000000..11fda5d8
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_applier_ftwrl_table.result
@@ -0,0 +1,22 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+FLUSH TABLE t1 WITH READ LOCK;
+connection node_2;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+UNLOCK TABLES;
+SET SESSION wsrep_sync_wait = 15;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result
new file mode 100644
index 00000000..451b2c80
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION lock_wait_timeout = 60;
+SET SESSION innodb_lock_wait_timeout=60;
+SET SESSION wait_timeout=60;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+FLUSH TABLE t1 WITH READ LOCK;
+connection node_2;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_1;
+SELECT 1 FROM DUAL;
+1
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock';
+COUNT(*) = 1
+1
+UNLOCK TABLES;
+SET SESSION wsrep_sync_wait = 15;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ `f2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock';
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_as_master.result b/mysql-test/suite/galera/r/galera_as_master.result
new file mode 100644
index 00000000..4aca328b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_master.result
@@ -0,0 +1,61 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+START SLAVE;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+# Disable binary logging for current session
+SET SQL_LOG_BIN=OFF;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(1);
+INSERT INTO t1 VALUES(2);
+CREATE TABLE test.t3 AS SELECT * from t1;
+SET SQL_LOG_BIN=ON;
+INSERT INTO t1 VALUES(3);
+CREATE TABLE test.t4 AS SELECT * from t1;
+connection node_2;
+SELECT * FROM t1;
+f1
+1
+2
+3
+SELECT * FROM t2;
+f1
+1
+SELECT * FROM t3;
+f1
+1
+2
+SELECT * FROM t4;
+f1
+1
+2
+3
+connection node_3;
+SHOW TABLES;
+Tables_in_test
+t1
+t4
+SELECT * FROM t1;
+f1
+1
+3
+SELECT * FROM t4;
+f1
+1
+2
+3
+# Cleanup
+connection node_1;
+DROP TABLE t1, t4;
+SET SQL_LOG_BIN=OFF;
+DROP TABLE t2, t3;
+connection node_3;
+STOP SLAVE;
+RESET SLAVE ALL;
+CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
+connection node_1;
+set global wsrep_on=OFF;
+RESET MASTER;
+set global wsrep_on=ON;
diff --git a/mysql-test/suite/galera/r/galera_as_master_large.result b/mysql-test/suite/galera/r/galera_as_master_large.result
new file mode 100644
index 00000000..826d2f32
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_master_large.result
@@ -0,0 +1,38 @@
+#
+# MDEV-9044 : Getting binlog corruption on my Galera cluster (10.1.8)
+# making it impossible to async slave.
+#
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+START SLAVE;
+connection node_1;
+SELECT @@GLOBAL.BINLOG_CACHE_SIZE;
+@@GLOBAL.BINLOG_CACHE_SIZE
+8192
+CREATE TABLE t1 (c1 INTEGER PRIMARY KEY, c2 VARCHAR(12000)) ENGINE=INNODB;
+CREATE TABLE t2 (c1 INTEGER PRIMARY KEY) ENGINE=INNODB;
+START TRANSACTION;
+INSERT INTO t1 VALUES(1, REPEAT('-', 10000));
+COMMIT;
+INSERT INTO t2 VALUES(1);
+connection node_2;
+SELECT c1, LENGTH(c2) FROM t1;
+c1 LENGTH(c2)
+1 10000
+SELECT * FROM t2;
+c1
+1
+connection node_3;
+SELECT c1, LENGTH(c2) FROM t1;
+c1 LENGTH(c2)
+1 10000
+SELECT * FROM t2;
+c1
+1
+# Cleanup
+connection node_1;
+DROP TABLE t1, t2;
+connection node_3;
+STOP SLAVE;
+RESET SLAVE ALL;
diff --git a/mysql-test/suite/galera/r/galera_as_slave.result b/mysql-test/suite/galera/r/galera_as_slave.result
new file mode 100644
index 00000000..1035fe1e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave.result
@@ -0,0 +1,32 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
+START SLAVE;
+connection node_3;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+connection node_2;
+INSERT INTO t1 VALUES (2);
+connection node_1;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+INSERT INTO t1 VALUES (3);
+connection node_2;
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+connection node_3;
+SET @@session.binlog_alter_two_phase = 1;
+ALTER TABLE t1 ADD COLUMN f2 INT;
+INSERT INTO t1 VALUES (4,1);
+connection node_1;
+connection node_2;
+connection node_3;
+DROP TABLE t1;
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
+connection node_3;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_autoinc.result b/mysql-test/suite/galera/r/galera_as_slave_autoinc.result
new file mode 100644
index 00000000..ffaa62c0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_autoinc.result
@@ -0,0 +1,100 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
+START SLAVE;
+connection node_3;
+SET SESSION binlog_format='STATEMENT';
+CREATE TABLE t1 (
+i int(11) NOT NULL AUTO_INCREMENT,
+c char(32) DEFAULT 'dummy_text',
+PRIMARY KEY (i)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+insert into t1(i) values(null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+select * from t1;
+i c
+1 dummy_text
+insert into t1(i) values(null), (null), (null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+select * from t1;
+i c
+1 dummy_text
+2 dummy_text
+3 dummy_text
+4 dummy_text
+SET SESSION auto_increment_increment=7;
+insert into t1(i) values(null), (null), (null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+SET SESSION auto_increment_offset=5;
+insert into t1(i) values(null), (null), (null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+select * from t1;
+i c
+1 dummy_text
+2 dummy_text
+3 dummy_text
+4 dummy_text
+8 dummy_text
+15 dummy_text
+22 dummy_text
+33 dummy_text
+40 dummy_text
+47 dummy_text
+show variables like 'binlog_format';
+Variable_name Value
+binlog_format STATEMENT
+show variables like 'auto_increment_increment';
+Variable_name Value
+auto_increment_increment 7
+connection node_2;
+select * from t1;
+i c
+1 dummy_text
+2 dummy_text
+3 dummy_text
+4 dummy_text
+8 dummy_text
+15 dummy_text
+22 dummy_text
+33 dummy_text
+40 dummy_text
+47 dummy_text
+show variables like 'binlog_format';
+Variable_name Value
+binlog_format ROW
+show variables like 'auto_increment_increment';
+Variable_name Value
+auto_increment_increment 2
+connection node_1;
+select * from t1;
+i c
+1 dummy_text
+2 dummy_text
+3 dummy_text
+4 dummy_text
+8 dummy_text
+15 dummy_text
+22 dummy_text
+33 dummy_text
+40 dummy_text
+47 dummy_text
+show variables like 'binlog_format';
+Variable_name Value
+binlog_format ROW
+show variables like 'auto_increment_increment';
+Variable_name Value
+auto_increment_increment 2
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format");
+connection node_3;
+DROP TABLE t1;
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format");
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
+connection node_3;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_ctas.result b/mysql-test/suite/galera/r/galera_as_slave_ctas.result
new file mode 100644
index 00000000..a3d28ce4
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_ctas.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+SELECT @@wsrep_on;
+@@wsrep_on
+0
+connection node_1;
+START SLAVE;
+connection node_3;
+SHOW VARIABLES LIKE 'binlog_format';
+Variable_name Value
+binlog_format ROW
+CREATE TABLE source (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE target AS SELECT * FROM source;
+connection node_1;
+connection node_2;
+connection node_3;
+DROP TABLE target;
+INSERT INTO source VALUES(1);
+CREATE TABLE target AS SELECT * FROM source;
+connection node_1;
+connection node_2;
+connection node_3;
+DROP TABLE source;
+DROP TABLE target;
+connection node_2;
+connection node_1;
+STOP SLAVE;
+RESET SLAVE ALL;
+connection node_3;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid.result b/mysql-test/suite/galera/r/galera_as_slave_gtid.result
new file mode 100644
index 00000000..41d9085c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_gtid.result
@@ -0,0 +1,38 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
+START SLAVE;
+connection node_3;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+SELECT LENGTH(@@global.gtid_binlog_state) > 1;
+LENGTH(@@global.gtid_binlog_state) > 1
+1
+connection node_1;
+connection node_2;
+gtid_binlog_state_equal
+1
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+gtid_binlog_state_equal
+1
+connection node_3;
+DROP TABLE t1;
+connection node_1;
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
+#cleanup
+connection node_1;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_2;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_3;
+reset master;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid_auto_engine.result b/mysql-test/suite/galera/r/galera_as_slave_gtid_auto_engine.result
new file mode 100644
index 00000000..cff5bb0a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_gtid_auto_engine.result
@@ -0,0 +1,41 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
+START SLAVE;
+connection node_3;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+SELECT LENGTH(@@global.gtid_binlog_state) > 1;
+LENGTH(@@global.gtid_binlog_state) > 1
+1
+connection node_1;
+connection node_2;
+gtid_binlog_state_equal
+1
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+gtid_binlog_state_equal
+1
+connection node_3;
+DROP TABLE t1;
+connection node_1;
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
+#cleanup
+connection node_1;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_2;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_3;
+reset master;
+connection node_2;
+DROP TABLE mysql.gtid_slave_pos_InnoDB;
+CALL mtr.add_suppression("The automatically created table");
diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
new file mode 100644
index 00000000..6559c782
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
@@ -0,0 +1,49 @@
+connection node_2;
+connection node_1;
+SELECT @@WSREP_ON;
+@@WSREP_ON
+1
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+SELECT @@wsrep_on;
+@@wsrep_on
+0
+connection node_1;
+ALTER TABLE mysql.gtid_slave_pos engine = InnoDB;
+START SLAVE;
+connection node_3;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(1);
+SELECT LENGTH(@@global.gtid_binlog_state) > 1;
+LENGTH(@@global.gtid_binlog_state) > 1
+1
+connection node_1;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
+1
+gtid_binlog_state_equal
+0
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
+1
+gtid_binlog_state_equal
+0
+#cleanup
+connection node_3;
+DROP TABLE t1;
+connection node_1;
+connection node_2;
+connection node_3;
+RESET MASTER;
+connection node_1;
+STOP SLAVE;
+RESET SLAVE ALL;
+SET GLOBAL WSREP_ON=OFF;
+reset master;
+SET GLOBAL WSREP_ON=ON;
+connection node_2;
+SET GLOBAL WSREP_ON=OFF;
+reset master;
+SET GLOBAL WSREP_ON=ON;
+connection node_3;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_nonprim.result b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result
new file mode 100644
index 00000000..fefc988d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result
@@ -0,0 +1,34 @@
+connection node_2;
+connection node_1;
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_2;
+START SLAVE;
+SET SESSION wsrep_sync_wait = 0;
+connection node_4;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+connection node_1;
+connection node_4;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+connection node_2;
+connection node_1;
+expected_error
+1
+connection node_2;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
+connection node_1;
+connection node_2;
+START SLAVE;
+connection node_4;
+DROP TABLE t1;
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query");
+CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047");
+CALL mtr.add_suppression("Transport endpoint is not connected");
+CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213");
+CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047");
+connection node_4;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_replay.result b/mysql-test/suite/galera/r/galera_as_slave_replay.result
new file mode 100644
index 00000000..0425bd2b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_replay.result
@@ -0,0 +1,73 @@
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+connection node_2;
+connection node_1;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+RESET MASTER;
+connection node_2a;
+START SLAVE;
+connection node_3;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+set binlog_format=STATEMENT;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+SELECT * FROM t1 FOR UPDATE;
+f1 f2
+1 a
+3 a
+UPDATE t1 SET f2 = 'c' WHERE f1 > 1;
+connection node_2a;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_1;
+INSERT INTO test.t1 VALUES (2, 'b');
+connection node_3;
+COMMIT;
+connection node_2a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+connection node_3;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1 f2
+1 a
+3 c
+connection node_2a;
+set session wsrep_sync_wait=15;
+set session wsrep_sync_wait=0;
+wsrep_local_replays
+1
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+SET DEBUG_SYNC = "RESET";
+connection node_2a;
+STOP SLAVE;
+RESET SLAVE;
+DROP TABLE t1;
+connection node_3;
+DROP TABLE t1;
+RESET MASTER;
+connection node_1;
+disconnect node_2a;
+disconnect node_3;
diff --git a/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result b/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result
new file mode 100644
index 00000000..0ba26955
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result
@@ -0,0 +1,48 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+Killing server ...
+connection node_1;
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+connection node_2a;
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+132
+connection node_2a;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+132
+connection node_1;
+DROP TABLE t1;
+CALL mtr.add_suppression("gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)");
+CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0");
+disconnect node_1a;
+disconnect node_2a;
diff --git a/mysql-test/suite/galera/r/galera_backup_stage.result b/mysql-test/suite/galera/r/galera_backup_stage.result
new file mode 100644
index 00000000..6fb7d164
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_backup_stage.result
@@ -0,0 +1,78 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 varchar(10)) ENGINE=InnoDB;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+BACKUP STAGE END;
+BACKUP STAGE START;
+BACKUP STAGE FLUSH;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait=0;
+SET SESSION wsrep_retry_autocommit=0;
+INSERT INTO t1 (f1) values ("node1_1");
+ALTER TABLE t1 ADD COLUMN (f2 int(10));
+connection node_2;
+INSERT INTO t1 (f1) values ("node2_1");
+ALTER TABLE t1 ADD COLUMN (f3 int(10));
+connection node_1;
+BACKUP STAGE BLOCK_DDL;
+connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1c;
+SET SESSION wsrep_sync_wait=0;
+connection node_2;
+INSERT INTO t1 (f1) values("node2_2");
+ALTER TABLE t1 ADD COLUMN (f5 int(10));
+connection node_1a;
+ALTER TABLE t1 ADD COLUMN (f4 int(10));
+ERROR 08S01: Aborting TOI: Replication paused on node for FTWRL/BACKUP STAGE.
+INSERT INTO t1 (f1) values("node1a");;
+connection node_1c;
+connection node_1;
+BACKUP STAGE BLOCK_COMMIT;
+connection node_1c;
+SELECT variable_value="Donor/Desynced" FROM information_schema.global_status WHERE variable_name="wsrep_local_state_comment";
+variable_value="Donor/Desynced"
+1
+connection node_2;
+INSERT INTO t1 (f1) values("node2_3");
+ALTER TABLE t1 ADD COLUMN (f6 int(10));
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1b;
+SET SESSION wsrep_sync_wait=0;
+SET SESSION wsrep_retry_autocommit=0;
+ALTER TABLE t1 ADD COLUMN (f4 int(10));
+ERROR 08S01: Aborting TOI: Replication paused on node for FTWRL/BACKUP STAGE.
+INSERT INTO t1 (f1) values("node1b");;
+connection node_1c;
+SELECT COUNT(*)=2 FROM t1;
+COUNT(*)=2
+1
+SELECT COUNT(*)=3 FROM information_schema.columns WHERE table_name = 't1';
+COUNT(*)=3
+1
+connection node_1;
+BACKUP STAGE END;
+connection node_1a;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1b;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1;
+SELECT COUNT(*)=4 FROM t1;
+COUNT(*)=4
+1
+SELECT COUNT(*)=5 FROM information_schema.columns WHERE table_name = 't1';
+COUNT(*)=5
+1
+connection node_2;
+SELECT COUNT(*)=4 FROM t1;
+COUNT(*)=4
+1
+SELECT COUNT(*)=5 FROM information_schema.columns WHERE table_name = 't1';
+COUNT(*)=5
+1
+connection node_1;
+DROP TABLE t1;
+call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
+call mtr.add_suppression("greater than drain seqno");
diff --git a/mysql-test/suite/galera/r/galera_backup_start.result b/mysql-test/suite/galera/r/galera_backup_start.result
new file mode 100644
index 00000000..253a0ce7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_backup_start.result
@@ -0,0 +1,6 @@
+connection node_2;
+connection node_1;
+BACKUP STAGE START;
+START TRANSACTION;
+COMMIT;
+BACKUP STAGE END;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort.result b/mysql-test/suite/galera/r/galera_bf_abort.result
new file mode 100644
index 00000000..cb4a27c8
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort.result
@@ -0,0 +1,17 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(6)) ENGINE=InnoDB;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node_2');
+connection node_1;
+INSERT INTO t1 VALUES (1,'node_1');
+connection node_2a;
+connection node_2;
+INSERT INTO t1 VALUES (2, 'node_2');
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_at_after_statement.result b/mysql-test/suite/galera/r/galera_bf_abort_at_after_statement.result
new file mode 100644
index 00000000..71eeb686
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_at_after_statement.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY, val INT);
+INSERT INTO t1 VALUES (1, 1);
+connection node_2;
+SET DEBUG_SYNC = 'RESET';
+START TRANSACTION;
+SET DEBUG_SYNC = 'wsrep_after_statement_enter SIGNAL blocked WAIT_FOR continue';
+UPDATE t1 SET val=2 WHERE id=1;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+SET DEBUG_SYNC = 'now WAIT_FOR blocked';
+connection node_1;
+UPDATE t1 SET val=3 WHERE id=1;
+connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+set session wsrep_sync_wait=0;
+connection node_2a;
+SET DEBUG_SYNC = 'now SIGNAL continue';
+connection node_2;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+SET DEBUG_SYNC = 'RESET';
+connection node_1;
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1;
+disconnect node_2a;
+disconnect node_2b;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result b/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result
new file mode 100644
index 00000000..1150a9ff
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result
@@ -0,0 +1,20 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+FLUSH TABLES t1 FOR EXPORT;
+connection node_1;
+INSERT INTO t1 VALUES (2);
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+UNLOCK TABLES;
+COMMIT;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait = 15;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_for_update.result b/mysql-test/suite/galera/r/galera_bf_abort_for_update.result
new file mode 100644
index 00000000..7dd3053b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_for_update.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 10);
+connection node_1;
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
+f1 f2
+1 10
+connection node_2;
+UPDATE t1 SET f1 = 2;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_bf_aborts_diff
+1
+connection node_1;
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
+f1 f2
+2 10
+connection node_2;
+UPDATE t1 SET f2 = 20;
+connection node_1a;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_bf_aborts_diff
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result b/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result
new file mode 100644
index 00000000..43ca6089
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_ftwrl.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+FLUSH TABLES WITH READ LOCK;;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+UNLOCK TABLES;
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result
new file mode 100644
index 00000000..0ef2a1a7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result
@@ -0,0 +1,18 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2a;
+SELECT GET_LOCK("foo", 1000);
+GET_LOCK("foo", 1000)
+1
+connection node_2;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT GET_LOCK("foo", 1000);;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result b/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result
new file mode 100644
index 00000000..2a2ddd51
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result
@@ -0,0 +1,685 @@
+SET SESSION wsrep_sync_wait = 0;
+galera_sr_bf_abort_at_commit = 0
+after_replicate_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+INSERT INTO t1 VALUES (3);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+local_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+INSERT INTO t1 VALUES (3);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+apply_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync';
+INSERT INTO t1 VALUES (3);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync';
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+commit_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+INSERT INTO t1 VALUES (3);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+galera_sr_bf_abort_at_commit = 1
+after_replicate_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+local_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+apply_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+commit_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 1;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+galera_sr_bf_abort_at_commit = 1
+after_replicate_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 0;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+local_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 0;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+apply_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 0;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+commit_monitor_master_enter_sync
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_trx_fragment_size = 0;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 FOR UPDATE;
+f1
+1
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+SET AUTOCOMMIT=ON;
+INSERT INTO t1 VALUES (2);
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+COMMIT;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+ROLLBACK;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1
+1
+2
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_trx_fragment_size = 0;
+DELETE FROM t1;
+DROP TABLE t1;
+CALL mtr.add_suppression("WSREP: fragment replication failed: 1");
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result b/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result
new file mode 100644
index 00000000..e7882e43
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_lock_table.result
@@ -0,0 +1,17 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+LOCK TABLE t1 WRITE;
+connection node_1;
+INSERT INTO t1 VALUES (2);
+connection node_2;
+UNLOCK TABLES;
+COMMIT;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result b/mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result
new file mode 100644
index 00000000..88c200ee
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result
@@ -0,0 +1,58 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+# Case 1 : MariaBackup SST
+connection node_1;
+CREATE TABLE t(i INT NOT NULL PRIMARY KEY) ENGINE INNODB;
+INSERT INTO t VALUES(1);
+# Restart node_2, force SST.
+connection node_2;
+connection node_1;
+connection node_2;
+Starting server ...
+connection node_1;
+# Both should return FOUND 2 as we have bootstrap and SST
+FOUND 2 /Desyncing and pausing the provider/ in mysqld.1.err
+FOUND 2 /Resuming and resyncing the provider/ in mysqld.1.err
+connection node_1;
+SET GLOBAL wsrep_mode = "BF_ABORT_MARIABACKUP";
+# Restart node_2, force SST.
+connection node_2;
+connection node_1;
+INSERT INTO t VALUES(2);
+connection node_2;
+Starting server ...
+connection node_2;
+connection node_1;
+# Both should return FOUND 3 as we have 1 new SST
+FOUND 3 /Desyncing and pausing the provider/ in mysqld.1.err
+FOUND 3 /Resuming and resyncing the provider/ in mysqld.1.err
+SET GLOBAL wsrep_mode = "";
+DROP TABLE t;
+# Case 2: MariaBackup backup from node_2
+connection node_1;
+CREATE TABLE t(i INT NOT NULL PRIMARY KEY) ENGINE INNODB;
+INSERT INTO t VALUES(1),(2),(3),(4),(5);
+connection node_2;
+SET GLOBAL wsrep_mode = "";
+SELECT @@wsrep_mode;
+@@wsrep_mode
+
+# Both should return FOUND 1 as we have backup
+FOUND 1 /Desyncing and pausing the provider/ in mysqld.2.err
+FOUND 1 /Resuming and resyncing the provider/ in mysqld.2.err
+SET GLOBAL wsrep_mode = "BF_ABORT_MARIABACKUP";
+SELECT @@wsrep_mode;
+@@wsrep_mode
+BF_ABORT_MARIABACKUP
+# Both should return FOUND 1 as node should not desync
+FOUND 1 /Desyncing and pausing the provider/ in mysqld.2.err
+FOUND 1 /Resuming and resyncing the provider/ in mysqld.2.err
+# Should return FOUND 1 because only last backup does not desync
+FOUND 1 /Server not desynched from group because WSREP_MODE_BF_MARIABACKUP used./ in mysqld.2.err
+SET GLOBAL wsrep_mode = "";
+connection node_1;
+DROP TABLE t;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_ps.result b/mysql-test/suite/galera/r/galera_bf_abort_ps.result
new file mode 100644
index 00000000..42292cb2
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_ps.result
@@ -0,0 +1,16 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(6)) ENGINE=InnoDB;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node_2');
+connection node_1;
+INSERT INTO t1 VALUES (1,'node_1');
+connection node_2a;
+connection node_2;
+INSERT INTO t1 VALUES (2, 'node_2');
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_ps_bind.result b/mysql-test/suite/galera/r/galera_bf_abort_ps_bind.result
new file mode 100644
index 00000000..02f4dd25
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_ps_bind.result
@@ -0,0 +1,38 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t (i int primary key auto_increment, j varchar(20) character set utf8);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+insert into t values (1, 'first');
+PS_prepare INSERT INTO t(j) VALUES (?);;
+PS_bind node1;
+PS_execute;
+PS_execute;
+select * from t;
+i j
+1 first
+3 node1
+5 node1
+PS_close;
+PS_prepare INSERT INTO t(j) VALUES (?);;
+PS_bind node1;
+begin;
+update t set j='node1' where i=1;
+connection node_2;
+update t set j='node2' where i=1;
+connection node_1a;
+connection node_1;
+PS_execute;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+PS_execute;
+commit;
+PS_close;
+select * from t;
+i j
+1 node2
+3 node1
+5 node1
+7 node1
+drop table t;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_ps_threadpool.result b/mysql-test/suite/galera/r/galera_bf_abort_ps_threadpool.result
new file mode 100644
index 00000000..7482e767
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_ps_threadpool.result
@@ -0,0 +1,22 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(6)) ENGINE=InnoDB;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node_2');
+connection node_2a;
+SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
+connection node_1;
+INSERT INTO t1 VALUES (1,'node_1');
+connection node_2a;
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_2;
+SET DEBUG_SYNC = "wsrep_before_before_command SIGNAL signal.wsrep_apply_cb WAIT_FOR bf_abort";
+INSERT INTO t1 VALUES (2, 'node_2');
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_aborts_increment
+1
+SET DEBUG_SYNC = 'RESET';
+SET GLOBAL debug_dbug = DEFAULT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result b/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result
new file mode 100644
index 00000000..5233ea6c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_shutdown.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+connection node_2;
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*");
+SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR continue';
+INSERT INTO t1 VALUES (1);
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_1;
+connection node_2a;
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_sleep.result b/mysql-test/suite/galera/r/galera_bf_abort_sleep.result
new file mode 100644
index 00000000..00d6600d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_abort_sleep.result
@@ -0,0 +1,14 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (1);
+SELECT SLEEP(1000);;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_background_statistics.result b/mysql-test/suite/galera/r/galera_bf_background_statistics.result
new file mode 100644
index 00000000..a8c8842b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_background_statistics.result
@@ -0,0 +1,35 @@
+connection node_2;
+connection node_1;
+SELECT @@innodb_stats_persistent;
+@@innodb_stats_persistent
+1
+CREATE TABLE t1 (f1 INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, f2 INTEGER DEFAULT 1) ENGINE=InnoDB;
+INSERT INTO t1(f1) values (NULL);
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+INSERT INTO t1(f1) select NULL from t1;
+SELECT count(1) from t1;
+count(1)
+16384
+connection node_2;
+SET AUTOCOMMIT=OFF;
+INSERT INTO t1 VALUES (9999999,NULL);
+SELECT SLEEP(1000);;
+connection node_1;
+ALTER TABLE t1 CHANGE f2 f2 INTEGER NOT NULL DEFAULT 1;
+connection node_2;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_aborts_increment
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_kill.result b/mysql-test/suite/galera/r/galera_bf_kill.result
new file mode 100644
index 00000000..3738e8c9
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_kill.result
@@ -0,0 +1,73 @@
+connection node_2;
+connection node_1;
+connection node_2;
+CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB;
+insert into t1 values (NULL,1);
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+begin;
+update t1 set a = 5;
+connection node_2;
+select * from t1;
+a b
+2 1
+disconnect node_2a;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+begin;
+update t1 set a =5;
+connection node_2;
+select * from t1;
+a b
+2 1
+disconnect node_2a;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+begin;
+update t1 set a =5, b=2;
+connection node_2;
+ALTER TABLE t1 ADD UNIQUE KEY b1(b);
+ALTER TABLE t1 DROP KEY b1;
+select * from t1;
+a b
+2 1
+disconnect node_2a;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+begin;
+update t1 set a =5, b=2;
+connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2b;
+begin;
+update t1 set a =6, b=7;
+connection node_2;
+ALTER TABLE t1 ADD UNIQUE KEY b2(b);
+ALTER TABLE t1 DROP KEY b2;
+select * from t1;
+a b
+2 1
+disconnect node_2a;
+disconnect node_2b;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+SET SESSION wsrep_on=OFF;
+begin;
+update t1 set a =5, b=2;
+connection node_2;
+ALTER TABLE t1 ADD UNIQUE KEY b3(b);
+select * from t1;
+a b
+2 1
+disconnect node_2a;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+SET SESSION wsrep_on=OFF;
+begin;
+update t1 set a =5, b=2;
+connection node_2;
+select * from t1;
+a b
+2 1
+disconnect node_2a;
+connection node_1;
+drop table t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_kill_debug.result b/mysql-test/suite/galera/r/galera_bf_kill_debug.result
new file mode 100644
index 00000000..c3eae243
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_kill_debug.result
@@ -0,0 +1,54 @@
+connection node_2;
+connection node_1;
+connection node_2;
+CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB;
+insert into t1 values (NULL,1);
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+truncate t1;
+insert into t1 values (1,0);
+begin;
+update t1 set b=2 where a=1;
+connection node_2;
+set session wsrep_sync_wait=0;
+connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2b;
+SET GLOBAL debug_dbug = "d,sync.before_wsrep_thd_abort";
+connection node_1;
+select * from t1;
+a b
+1 0
+update t1 set b= 1 where a=1;
+connection node_2b;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.before_wsrep_thd_abort_reached";
+connection node_2;
+SET DEBUG_SYNC= 'before_awake_no_mutex SIGNAL awake_reached WAIT_FOR continue_kill';
+connection node_2b;
+SET DEBUG_SYNC='now WAIT_FOR awake_reached';
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.before_wsrep_thd_abort";
+SET DEBUG_SYNC = "now SIGNAL continue_kill";
+connection node_2;
+connection node_2a;
+select * from t1;
+connection node_2;
+SET DEBUG_SYNC = "RESET";
+drop table t1;
+disconnect node_2a;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+CREATE TABLE t1 (i int primary key);
+SET DEBUG_SYNC = "before_wsrep_ordered_commit SIGNAL bwoc_reached WAIT_FOR bwoc_continue";
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached";
+SET DEBUG_SYNC = "now SIGNAL bwoc_continue";
+SET DEBUG_SYNC='RESET';
+connection node_2a;
+connection node_2;
+select * from t1;
+i
+1
+disconnect node_2a;
+connection node_1;
+drop table t1;
diff --git a/mysql-test/suite/galera/r/galera_bf_lock_wait.result b/mysql-test/suite/galera/r/galera_bf_lock_wait.result
new file mode 100644
index 00000000..757fbf50
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_bf_lock_wait.result
@@ -0,0 +1,46 @@
+connection node_2;
+connection node_1;
+connection node_2;
+call mtr.add_suppression("WSREP: Trying to continue unpaused monitor");
+connection node_1;
+call mtr.add_suppression("WSREP: Trying to continue unpaused monitor");
+CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2;
+ALTER TABLE t1 add primary key(a);
+CREATE PROCEDURE p1(repeat_count INT)
+BEGIN
+DECLARE current_num int;
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION rollback;
+SET current_num = 0;
+WHILE current_num < repeat_count DO
+start transaction;
+update t1 set b=connection_id() where a=1;
+commit;
+SET current_num = current_num + 1;
+END WHILE;
+END|
+connection node_2;
+connect node_1_p1, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
+connect node_1_p2, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
+connect node_2_p1, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
+connect node_2_p2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
+connection node_1;
+checking error log for 'BF lock wait long' message for 10 times every 10 seconds ...
+connection node_1_p1;
+connection node_1_p2;
+connection node_2_p1;
+connection node_2_p2;
+connection node_1;
+drop table t1;
+drop procedure p1;
+disconnect node_1_p1;
+disconnect node_1_p2;
+disconnect node_2_p1;
+disconnect node_2_p2;
diff --git a/mysql-test/suite/galera/r/galera_binlog_cache_size.result b/mysql-test/suite/galera/r/galera_binlog_cache_size.result
new file mode 100644
index 00000000..a92e548a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_cache_size.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 VARCHAR(767)) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+SET GLOBAL binlog_cache_size=4096;
+SET GLOBAL max_binlog_cache_size=4096;
+connection node_1a;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten;
+INSERT INTO t1 SELECT REPEAT('a', 767) FROM ten;
+ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_binlog_checksum.result b/mysql-test/suite/galera/r/galera_binlog_checksum.result
new file mode 100644
index 00000000..3bd0bf42
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_checksum.result
@@ -0,0 +1,30 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+#
+# MDEV-11149: wsrep_replicate_mysaim: DML fails when binlog checksum
+# enabled
+#
+connection node_1;
+SET @@global.wsrep_mode = REPLICATE_MYISAM;
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=MYISAM;
+INSERT INTO t1 VALUES(1);
+connection node_2;
+SELECT * FROM t1;
+i
+1
+connection node_1;
+DROP TABLE t1;
+# End of tests.
diff --git a/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result b/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result
new file mode 100644
index 00000000..b513c491
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_event_max_size_max.result
@@ -0,0 +1,12 @@
+connection node_2;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 VARCHAR(1000));
+INSERT INTO t1 SELECT REPEAT('x', 1000) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+connection node_2;
+SELECT COUNT(*) = 10000 FROM t1;
+COUNT(*) = 10000
+1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result b/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result
new file mode 100644
index 00000000..6c2279be
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_event_max_size_min.result
@@ -0,0 +1,9 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 VARCHAR(1000));
+INSERT INTO t1 VALUES (REPEAT('x', 1000));
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('x', 1000);
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_binlog_row_image.result b/mysql-test/suite/galera/r/galera_binlog_row_image.result
new file mode 100644
index 00000000..20e6bd9f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_row_image.result
@@ -0,0 +1,95 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET SESSION binlog_row_image=minimal;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER NOT NULL UNIQUE) ENGINE=InnoDB;
+CREATE TABLE t3 (f1 VARCHAR(1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t3 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 1;
+COUNT(*) = 1
+1
+connection node_1;
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+UPDATE t2 SET f1 = 2 WHERE f1 = 1;
+UPDATE t3 SET f1 = 2 WHERE f1 = 1;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t3 WHERE f1 = 2;
+COUNT(*) = 1
+1
+connection node_1;
+DELETE FROM t1;
+DELETE FROM t2;
+DELETE FROM t3;
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t3;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+connection node_1;
+SET SESSION binlog_row_image=noblob;
+CREATE TABLE t1 (f1 BLOB, f2 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('abc', 1);
+INSERT INTO t2 VALUES ('abc');
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'abc';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'abc';
+COUNT(*) = 1
+1
+connection node_1;
+UPDATE t1 SET f1 = 'xyz';
+UPDATE t2 SET f1 = 'xyz';
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 'xyz';
+COUNT(*) = 1
+1
+connection node_1;
+UPDATE t1 SET f2 = 2 WHERE f2 = 1;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'xyz';
+COUNT(*) = 1
+1
+connection node_1;
+DELETE FROM t1;
+DELETE FROM t2;
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result
new file mode 100644
index 00000000..4fe33674
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result
@@ -0,0 +1,205 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET GLOBAL auto_increment_offset=1;
+connection node_2;
+SET GLOBAL auto_increment_offset=2;
+connection node_1;
+connection node_2;
+connection node_2;
+SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
+connection node_1;
+SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
+CREATE TABLE t1 (
+i int(11) NOT NULL primary key AUTO_INCREMENT,
+c char(32) DEFAULT 'dummy_text'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+show variables like 'auto_increment%';
+Variable_name Value
+auto_increment_increment 2
+auto_increment_offset 1
+insert into t1(i) values(null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+select * from t1 order by i;
+i c
+1 dummy_text
+insert into t1(i) values(null), (null), (null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+select * from t1 order by i;
+i c
+1 dummy_text
+3 dummy_text
+5 dummy_text
+7 dummy_text
+connection node_2;
+show variables like 'auto_increment%';
+Variable_name Value
+auto_increment_increment 2
+auto_increment_offset 2
+select * from t1 order by i;
+i c
+1 dummy_text
+3 dummy_text
+5 dummy_text
+7 dummy_text
+SET GLOBAL wsrep_forced_binlog_format='none';
+connection node_1;
+SET GLOBAL wsrep_forced_binlog_format='none';
+drop table t1;
+SET SESSION binlog_format='STATEMENT';
+show variables like 'binlog_format';
+Variable_name Value
+binlog_format STATEMENT
+SET GLOBAL wsrep_auto_increment_control='OFF';
+SET SESSION auto_increment_increment = 3;
+SET SESSION auto_increment_offset = 1;
+CREATE TABLE t1 (
+i int(11) NOT NULL primary key AUTO_INCREMENT,
+c char(32) DEFAULT 'dummy_text'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+show variables like 'auto_increment%';
+Variable_name Value
+auto_increment_increment 3
+auto_increment_offset 1
+insert into t1(i) values(null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+select * from t1 order by i;
+i c
+1 dummy_text
+insert into t1(i) values(null), (null), (null);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+select * from t1 order by i;
+i c
+1 dummy_text
+4 dummy_text
+7 dummy_text
+10 dummy_text
+connection node_2;
+show variables like 'auto_increment%';
+Variable_name Value
+auto_increment_increment 2
+auto_increment_offset 2
+select * from t1 order by i;
+i c
+1 dummy_text
+4 dummy_text
+7 dummy_text
+10 dummy_text
+connection node_1;
+SET GLOBAL wsrep_auto_increment_control='ON';
+SET SESSION binlog_format='ROW';
+connection node_1;
+show variables like 'binlog_format';
+Variable_name Value
+binlog_format ROW
+show variables like '%auto_increment%';
+Variable_name Value
+auto_increment_increment 2
+auto_increment_offset 1
+wsrep_auto_increment_control ON
+SET GLOBAL wsrep_auto_increment_control='OFF';
+show variables like '%auto_increment%';
+Variable_name Value
+auto_increment_increment 3
+auto_increment_offset 1
+wsrep_auto_increment_control OFF
+SET GLOBAL wsrep_auto_increment_control='ON';
+connection node_1;
+drop table t1;
+connection node_2;
+SET GLOBAL wsrep_forced_binlog_format='ROW';
+connection node_1;
+SET GLOBAL wsrep_forced_binlog_format='ROW';
+CREATE TABLE t1 (
+i int(11) NOT NULL primary key AUTO_INCREMENT,
+c char(32) DEFAULT 'dummy_text'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+show variables like 'auto_increment%';
+Variable_name Value
+auto_increment_increment 2
+auto_increment_offset 1
+insert into t1(i) values(null);
+select * from t1 order by i;
+i c
+1 dummy_text
+insert into t1(i) values(null), (null), (null);
+select * from t1 order by i;
+i c
+1 dummy_text
+3 dummy_text
+5 dummy_text
+7 dummy_text
+connection node_2;
+show variables like 'auto_increment%';
+Variable_name Value
+auto_increment_increment 2
+auto_increment_offset 2
+select * from t1 order by i;
+i c
+1 dummy_text
+3 dummy_text
+5 dummy_text
+7 dummy_text
+SET GLOBAL wsrep_forced_binlog_format='none';
+connection node_1;
+SET GLOBAL wsrep_forced_binlog_format='none';
+drop table t1;
+SET SESSION binlog_format='ROW';
+show variables like 'binlog_format';
+Variable_name Value
+binlog_format ROW
+SET GLOBAL wsrep_auto_increment_control='OFF';
+SET SESSION auto_increment_increment = 3;
+SET SESSION auto_increment_offset = 1;
+CREATE TABLE t1 (
+i int(11) NOT NULL primary key AUTO_INCREMENT,
+c char(32) DEFAULT 'dummy_text'
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+show variables like 'auto_increment%';
+Variable_name Value
+auto_increment_increment 3
+auto_increment_offset 1
+insert into t1(i) values(null);
+select * from t1 order by i;
+i c
+1 dummy_text
+insert into t1(i) values(null), (null), (null);
+select * from t1 order by i;
+i c
+1 dummy_text
+4 dummy_text
+7 dummy_text
+10 dummy_text
+connection node_2;
+show variables like 'auto_increment%';
+Variable_name Value
+auto_increment_increment 2
+auto_increment_offset 2
+select * from t1 order by i;
+i c
+1 dummy_text
+4 dummy_text
+7 dummy_text
+10 dummy_text
+connection node_1;
+SET GLOBAL wsrep_auto_increment_control='ON';
+show variables like 'binlog_format';
+Variable_name Value
+binlog_format ROW
+show variables like '%auto_increment%';
+Variable_name Value
+auto_increment_increment 2
+auto_increment_offset 2
+wsrep_auto_increment_control ON
+SET GLOBAL wsrep_auto_increment_control='OFF';
+show variables like '%auto_increment%';
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 2
+wsrep_auto_increment_control OFF
+SET GLOBAL wsrep_auto_increment_control='ON';
+drop table t1;
diff --git a/mysql-test/suite/galera/r/galera_cache_index.result b/mysql-test/suite/galera/r/galera_cache_index.result
new file mode 100644
index 00000000..d8172e6b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_cache_index.result
@@ -0,0 +1,49 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=innodb;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+CREATE TABLE t2 (c1 int);
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2) INSERT_METHOD=LAST;
+CACHE INDEX t1,t2 IN default;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache Error Table 't1' is differently defined or of non-MyISAM type or doesn't exist
+test.t1 assign_to_keycache error Corrupt
+test.t2 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+LOAD INDEX INTO CACHE t1,t2;
+Table Op Msg_type Msg_text
+test.t1 preload_keys Error Table 't1' is differently defined or of non-MyISAM type or doesn't exist
+test.t1 preload_keys error Corrupt
+test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
+DROP TEMPORARY TABLE t1;
+DROP TABLE t1,t2;
+CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+CREATE TABLE t2 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2) INSERT_METHOD=LAST;
+CACHE INDEX t1,t2 IN default;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache Error Table 't1' is differently defined or of non-MyISAM type or doesn't exist
+test.t1 assign_to_keycache error Corrupt
+test.t2 assign_to_keycache status OK
+LOAD INDEX INTO CACHE t1,t2;
+Table Op Msg_type Msg_text
+test.t1 preload_keys Error Table 't1' is differently defined or of non-MyISAM type or doesn't exist
+test.t1 preload_keys error Corrupt
+test.t2 preload_keys status OK
+DROP TEMPORARY TABLE t1;
+DROP TABLE t1,t2;
+CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+CREATE TABLE t2 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CACHE INDEX t1,t2 IN default;
+Table Op Msg_type Msg_text
+test.t1 assign_to_keycache status OK
+test.t2 assign_to_keycache status OK
+LOAD INDEX INTO CACHE t1,t2;
+Table Op Msg_type Msg_text
+test.t1 preload_keys status OK
+test.t2 preload_keys status OK
+DROP TABLE t1,t2;
diff --git a/mysql-test/suite/galera/r/galera_can_run_toi.result b/mysql-test/suite/galera/r/galera_can_run_toi.result
new file mode 100644
index 00000000..69dea0c1
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_can_run_toi.result
@@ -0,0 +1,37 @@
+connection node_2;
+connection node_1;
+SET sql_mode='';
+CREATE TABLE t3 (c1 VARCHAR(10));
+ALTER TABLE t3 ENGINE=NonExistentEngine;
+Warnings:
+Warning 1286 Unknown storage engine 'NonExistentEngine'
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `c1` varchar(10) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t3 values (1);
+SET sql_mode=default;
+ALTER TABLE t3 engine=innodbCLUSTER;
+ERROR 42000: Unknown storage engine 'innodbCLUSTER'
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `c1` varchar(10) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t3;
+SET sql_mode='';
+SET SESSION default_storage_engine=MyISAM;
+SELECT @@default_storage_engine;
+@@default_storage_engine
+MyISAM
+SET GLOBAL wsrep_mode=STRICT_REPLICATION;
+CREATE TABLE t3 (c1 VARCHAR(10)) ENGINE=InnoDB;
+ALTER TABLE t3 ENGINE=NonExistentEngine;
+ERROR HY000: Galera replication not supported
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `c1` varchar(10) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t3;
diff --git a/mysql-test/suite/galera/r/galera_change_user.result b/mysql-test/suite/galera/r/galera_change_user.result
new file mode 100644
index 00000000..3be9c956
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_change_user.result
@@ -0,0 +1,14 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE USER user1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+connect node_1a, 127.0.0.1, root, , test, $MYPORT_NODE_1;
+disconnect node_1a;
+connect node_1a, 127.0.0.1, root, , test, $MYPORT_NODE_1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+disconnect node_1a;
+connection node_1;
+DROP TABLE t1;
+DROP USER user1;
diff --git a/mysql-test/suite/galera/r/galera_commit_empty.result b/mysql-test/suite/galera/r/galera_commit_empty.result
new file mode 100644
index 00000000..75b94c54
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_commit_empty.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+START TRANSACTION;
+COMMIT;
+START TRANSACTION;
+COMMIT;
+START TRANSACTION READ ONLY;
+COMMIT;
+START TRANSACTION;
+COMMIT;
+START TRANSACTION;
+START TRANSACTION;
+COMMIT;
+wsrep_last_committed_diff
+1
diff --git a/mysql-test/suite/galera/r/galera_concurrent_ctas.result b/mysql-test/suite/galera/r/galera_concurrent_ctas.result
new file mode 100644
index 00000000..933f1d2a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_concurrent_ctas.result
@@ -0,0 +1,30 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_1;
+SET DEBUG_SYNC = 'wsrep_create_table_as_select WAIT_FOR continue';
+CREATE table t1 as SELECT SLEEP(0.1);;
+connection node_1a;
+# Wait until CTAS is on debug sync point
+connection node_1b;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL debug_dbug = '+d,sync.wsrep_apply_cb';
+connection node_2;
+CREATE table t1 as SELECT SLEEP(0.2);;
+connection node_1b;
+SET SESSION debug_sync = 'now WAIT_FOR sync.wsrep_apply_cb_reached';
+# Signal first CTAS to continue and wait until CTAS has executed
+SET DEBUG_SYNC= 'now SIGNAL continue';
+SET GLOBAL debug_dbug= '';
+SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb';
+connection node_2a;
+connection node_1b;
+SET DEBUG_SYNC= 'RESET';
+connection node_2;
+connection node_1;
+DROP TABLE t1;
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/galera_create_function.result b/mysql-test/suite/galera/r/galera_create_function.result
new file mode 100644
index 00000000..e8766eba
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_function.result
@@ -0,0 +1,66 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE USER 'user1';
+CREATE
+DEFINER = 'user1'
+FUNCTION f1 (param INTEGER)
+RETURNS VARCHAR(200)
+COMMENT 'f1_comment'
+LANGUAGE SQL
+NOT DETERMINISTIC
+MODIFIES SQL DATA
+SQL SECURITY DEFINER
+RETURN 'abc';
+GRANT EXECUTE ON FUNCTION f1 TO user1;
+CREATE
+DEFINER = CURRENT_USER
+FUNCTION f2 (param VARCHAR(100))
+RETURNS INTEGER
+DETERMINISTIC
+NO SQL
+SQL SECURITY INVOKER
+RETURN 123;
+connection node_1;
+SHOW CREATE FUNCTION f1;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET latin1 COLLATE latin1_swedish_ci
+ MODIFIES SQL DATA
+ COMMENT 'f1_comment'
+RETURN 'abc' latin1 latin1_swedish_ci latin1_swedish_ci
+connection node_2;
+SELECT 1 FROM DUAL;
+1
+1
+SHOW CREATE FUNCTION f1;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` FUNCTION `f1`(param INTEGER) RETURNS varchar(200) CHARSET latin1 COLLATE latin1_swedish_ci
+ MODIFIES SQL DATA
+ COMMENT 'f1_comment'
+RETURN 'abc' latin1 latin1_swedish_ci latin1_swedish_ci
+connection node_1;
+SHOW CREATE FUNCTION f2;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f2 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(param VARCHAR(100)) RETURNS int(11)
+ NO SQL
+ DETERMINISTIC
+ SQL SECURITY INVOKER
+RETURN 123 latin1 latin1_swedish_ci latin1_swedish_ci
+connection node_2;
+SHOW CREATE FUNCTION f2;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f2 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f2`(param VARCHAR(100)) RETURNS int(11)
+ NO SQL
+ DETERMINISTIC
+ SQL SECURITY INVOKER
+RETURN 123 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT f1(1) = 'abc';
+f1(1) = 'abc'
+1
+SELECT f2('abc') = 123;
+f2('abc') = 123
+1
+connection node_1;
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP USER 'user1';
diff --git a/mysql-test/suite/galera/r/galera_create_procedure.result b/mysql-test/suite/galera/r/galera_create_procedure.result
new file mode 100644
index 00000000..27bdf19f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_procedure.result
@@ -0,0 +1,62 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE USER 'user1';
+GRANT ALL ON test.* to 'user1';
+CREATE TABLE t1 (f1 INTEGER);
+CREATE
+DEFINER = 'user1'
+PROCEDURE p1 (IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER)
+COMMENT 'p1_comment'
+LANGUAGE SQL
+NOT DETERMINISTIC
+MODIFIES SQL DATA
+SQL SECURITY DEFINER
+INSERT INTO t1 VALUES (1);
+GRANT EXECUTE ON PROCEDURE p1 TO user1;
+CREATE
+DEFINER = CURRENT_USER
+PROCEDURE p2 (param VARCHAR(100))
+DETERMINISTIC
+NO SQL
+SQL SECURITY INVOKER BEGIN END ;
+connection node_1;
+SHOW CREATE PROCEDURE p1;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` PROCEDURE `p1`(IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER)
+ MODIFIES SQL DATA
+ COMMENT 'p1_comment'
+INSERT INTO t1 VALUES (1) latin1 latin1_swedish_ci latin1_swedish_ci
+connection node_2;
+SELECT 1 FROM DUAL;
+1
+1
+SHOW CREATE PROCEDURE p1;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`user1`@`%` PROCEDURE `p1`(IN param1 INTEGER, OUT param2 INTEGER, INOUT param3 INTEGER)
+ MODIFIES SQL DATA
+ COMMENT 'p1_comment'
+INSERT INTO t1 VALUES (1) latin1 latin1_swedish_ci latin1_swedish_ci
+connection node_1;
+SHOW CREATE PROCEDURE p2;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p2 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(param VARCHAR(100))
+ NO SQL
+ DETERMINISTIC
+ SQL SECURITY INVOKER
+BEGIN END latin1 latin1_swedish_ci latin1_swedish_ci
+connection node_2;
+SHOW CREATE PROCEDURE p2;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p2 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(param VARCHAR(100))
+ NO SQL
+ DETERMINISTIC
+ SQL SECURITY INVOKER
+BEGIN END latin1 latin1_swedish_ci latin1_swedish_ci
+CALL p1(@a, @b, @c);
+CALL p2('abc');
+connection node_1;
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+DROP USER 'user1';
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_create_table_as_select.result b/mysql-test/suite/galera/r/galera_create_table_as_select.result
new file mode 100644
index 00000000..beda5f30
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_table_as_select.result
@@ -0,0 +1,104 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET SESSION default_storage_engine=InnoDB;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 AS SELECT * FROM t2;
+ERROR 42S01: Table 't1' already exists
+DROP TABLE t1,t2;
+CREATE TABLE t1 AS SELECT * FROM t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+CREATE TABLE t1 AS SELECT 1 FROM DUAL;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t1 AS SELECT * FROM t2;
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+DROP TABLE t1,t2;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TABLE t1 AS SELECT * FROM t2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_1;
+DROP TABLE t1,t2;
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TABLE t1 AS SELECT MAX(f1) AS f1 FROM t2;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT f1 = 5 FROM t1;
+f1 = 5
+1
+connection node_1;
+DROP TABLE t1,t2;
+connection node_1;
+CREATE PROCEDURE sp1 ()
+BEGIN
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TABLE t1 AS SELECT * FROM t2;
+END|
+CALL sp1();
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_2;
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+connection node_1;
+DROP TABLE t1, t2;
+DROP PROCEDURE sp1;
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT * FROM t2';
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1, t2;
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+LOCK TABLE t2 WRITE;
+connection node_1;
+CREATE TABLE t1 AS SELECT * FROM t2;;
+connection node_1a;
+connection node_2;
+SELECT COUNT(*) = 5 FROM t2;
+COUNT(*) = 5
+1
+CREATE TABLE t1 AS SELECT * FROM t2;
+connection node_1a;
+UNLOCK TABLES;
+connection node_1;
+Got one of the listed errors
+DROP TABLE t1, t2;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
+CREATE TEMPORARY TABLE t1 AS SELECT * FROM t2;
+connection node_2;
+SELECT * FROM t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test.t1'' on query");
+connection node_1;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera/r/galera_create_table_like.result b/mysql-test/suite/galera/r/galera_create_table_like.result
new file mode 100644
index 00000000..d1633077
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_table_like.result
@@ -0,0 +1,56 @@
+connection node_2;
+connection node_1;
+CREATE SCHEMA schema1;
+CREATE SCHEMA schema2;
+USE schema1;
+CREATE TABLE real_table (f1 INTEGER) ENGINE=InnoDB;
+CREATE TEMPORARY TABLE temp_table (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE myisam_table (f1 INTEGER) ENGINE=MyISAM;
+USE schema2;
+CREATE TABLE real_table1 LIKE schema1.real_table;
+CREATE TABLE real_table2 LIKE schema1.temp_table;
+CREATE TABLE real_table3 LIKE schema1.myisam_table;
+CREATE TEMPORARY TABLE temp_table1 LIKE schema1.real_table;
+CREATE TEMPORARY TABLE temp_table2 LIKE schema1.temp_table;
+CREATE TEMPORARY TABLE temp_table3 LIKE schema1.myisam_table;
+connection node_2;
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table' AND TABLE_SCHEMA = 'schema1';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'myisam_table' AND TABLE_SCHEMA = 'schema1';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table' AND TABLE_SCHEMA = 'schema1';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table1' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table2' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'real_table3' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table1' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table2' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'temp_table3' AND TABLE_SCHEMA = 'schema2';
+COUNT(*) = 0
+1
+connection node_1;
+DROP TABLE schema1.real_table;
+DROP TABLE schema1.myisam_table;
+DROP TABLE schema2.real_table1;
+DROP TABLE schema2.real_table2;
+DROP TABLE schema2.real_table3;
+DROP SCHEMA schema1;
+DROP SCHEMA schema2;
+use test;
+CREATE TEMPORARY TABLE t (c INT) ENGINE=mrg_myisam UNION=(t,t2) insert_method=FIRST;
+CREATE TABLE t2 LIKE t;
+ERROR HY000: Table 't' is differently defined or of non-MyISAM type or doesn't exist
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/r/galera_create_trigger.result b/mysql-test/suite/galera/r/galera_create_trigger.result
new file mode 100644
index 00000000..4244e4c8
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_trigger.result
@@ -0,0 +1,47 @@
+connection node_2;
+connection node_1;
+CREATE TABLE definer_root (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+CREATE TABLE definer_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+CREATE TABLE definer_current_user (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+CREATE TABLE definer_default (f1 INTEGER, trigger_user VARCHAR(100)) ENGINE=InnoDB;
+CREATE USER 'user1';
+GRANT ALL ON test.* to 'user1';
+CREATE DEFINER=root@localhost TRIGGER definer_root BEFORE INSERT ON definer_root FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+CREATE DEFINER=user1 TRIGGER definer_user BEFORE INSERT ON definer_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+CREATE DEFINER=current_user TRIGGER definer_current_user BEFORE INSERT ON definer_current_user FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+CREATE TRIGGER definer_default BEFORE INSERT ON definer_default FOR EACH ROW SET NEW.trigger_user = CURRENT_USER();
+connection node_2;
+INSERT INTO definer_root (f1) VALUES (1);
+SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_root';
+DEFINER = 'root@localhost'
+1
+SELECT trigger_user = 'root@localhost' FROM definer_root;
+trigger_user = 'root@localhost'
+1
+INSERT INTO definer_user (f1) VALUES (1);
+SELECT DEFINER = 'user1@%' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_user';
+DEFINER = 'user1@%'
+1
+SELECT trigger_user = 'user1@%' FROM definer_user;
+trigger_user = 'user1@%'
+1
+INSERT INTO definer_current_user (f1) VALUES (1);
+SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_current_user';
+DEFINER = 'root@localhost'
+1
+SELECT trigger_user = 'root@localhost' FROM definer_current_user;
+trigger_user = 'root@localhost'
+1
+INSERT INTO definer_default (f1) VALUES (1);
+SELECT DEFINER = 'root@localhost' FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME = 'definer_default';
+DEFINER = 'root@localhost'
+1
+SELECT trigger_user = 'root@localhost' FROM definer_default;
+trigger_user = 'root@localhost'
+1
+connection node_1;
+DROP TABLE definer_current_user;
+DROP TABLE definer_user;
+DROP TABLE definer_root;
+DROP TABLE definer_default;
+DROP USER 'user1';
diff --git a/mysql-test/suite/galera/r/galera_create_view.result b/mysql-test/suite/galera/r/galera_create_view.result
new file mode 100644
index 00000000..19cc1abd
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_create_view.result
@@ -0,0 +1,4 @@
+connection node_2;
+connection node_1;
+CREATE OR REPLACE VIEW v AS WITH cte AS ( SELECT 1 ) SELECT * FROM cte;
+DROP VIEW v;
diff --git a/mysql-test/suite/galera/r/galera_ctas.result b/mysql-test/suite/galera/r/galera_ctas.result
new file mode 100644
index 00000000..ae8b611e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ctas.result
@@ -0,0 +1,88 @@
+connection node_2;
+connection node_1;
+connection node_1;
+create table t1_Aria(a int, count int, b int, key(b)) engine=Aria;
+INSERT INTO t1_Aria values (1,1,1);
+create table t1_MyISAM(a int, count int, b int, key(b)) engine=MyISAM;
+INSERT INTO t1_MyISAM values (1,1,1);
+create table t1_InnoDB(a int, count int, b int, key(b)) engine=InnoDB;
+INSERT INTO t1_InnoDB values (1,1,1);
+SET SESSION default_storage_engine=MyISAM;
+CREATE TABLE t2 AS SELECT * FROM t1_Aria;
+CREATE TABLE t3 AS SELECT * FROM t1_MyISAM;
+CREATE TABLE t4 AS SELECT * FROM t1_InnoDB;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2, t3,t4;
+SET SESSION default_storage_engine=Aria;
+CREATE TABLE t2 AS SELECT * FROM t1_Aria;
+CREATE TABLE t3 AS SELECT * FROM t1_MyISAM;
+CREATE TABLE t4 AS SELECT * FROM t1_InnoDB;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+SHOW CREATE TABLE t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+DROP TABLE t2, t3,t4;
+SET SESSION default_storage_engine=InnoDB;
+CREATE TABLE t2 AS SELECT * FROM t1_Aria;
+CREATE TABLE t3 AS SELECT * FROM t1_MyISAM;
+CREATE TABLE t4 AS SELECT * FROM t1_InnoDB;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t2, t3,t4;
+DROP TABLE t1_MyISAM, t1_Aria,t1_InnoDB;
diff --git a/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result b/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result
new file mode 100644
index 00000000..03e84f9f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result
@@ -0,0 +1,274 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait=0;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1b;
+SET SESSION wsrep_sync_wait=0;
+######################################################################
+# Test for ALTER ENGINE=INNODB
+######################################################################
+######################################################################
+#
+# Scenario #1: DML working on FK parent table BF aborted by DDL
+# over child table
+#
+######################################################################
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30));
+INSERT INTO p1 VALUES (1, 'INITIAL VALUE');
+CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30));
+INSERT INTO p2 VALUES (1, 'INITIAL VALUE');
+INSERT INTO p2 VALUES (2, 'INITIAL VALUE');
+CREATE TABLE c1 (pk INTEGER PRIMARY KEY, fk INTEGER, FOREIGN KEY (fk) REFERENCES p1(pk));
+INSERT INTO c1 VALUES (1,1);
+CREATE TABLE c2 (pk INTEGER PRIMARY KEY, fk1 INTEGER, fk2 INTEGER, FOREIGN KEY (fk1) REFERENCES p1(pk), FOREIGN KEY (fk2) REFERENCES p2(pk));
+INSERT INTO c2 VALUES (1,1,1), (2,1,2);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
+connection node_2;
+SET SESSION wsrep_sync_wait=0;
+ALTER TABLE c1 ENGINE=INNODB;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+######################################################################
+#
+# Scenario #2: DML working on FK parent table tries to replicate, but
+# fails in certification for earlier DDL on child table
+#
+######################################################################
+connection node_1;
+BEGIN;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+ALTER TABLE c1 ENGINE=INNODB;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
+COMMIT;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT 'I deadlocked';
+I deadlocked
+I deadlocked
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+######################################################################
+#
+# Scenario #3: 2 DMLs working on two FK parent tables try to replicate,
+# but fails in certification for earlier DDL on child table
+# which is child to both FK parents
+#
+######################################################################
+connection node_1;
+BEGIN;
+connection node_1b;
+BEGIN;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+ALTER TABLE c2 ENGINE=INNODB;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
+COMMIT;
+connection node_1b;
+UPDATE p2 SET f2 = 'TO DEADLOCK' WHERE pk = 2;
+COMMIT;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT 'I deadlocked';
+I deadlocked
+I deadlocked
+connection node_1b;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT 'I deadlocked';
+I deadlocked
+I deadlocked
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+DROP TABLE c1, c2;
+DROP TABLE p1, p2;
+######################################################################
+# Test for TRUNCATE
+######################################################################
+######################################################################
+#
+# Scenario #1: DML working on FK parent table BF aborted by DDL
+# over child table
+#
+######################################################################
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30));
+INSERT INTO p1 VALUES (1, 'INITIAL VALUE');
+CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30));
+INSERT INTO p2 VALUES (1, 'INITIAL VALUE');
+INSERT INTO p2 VALUES (2, 'INITIAL VALUE');
+CREATE TABLE c1 (pk INTEGER PRIMARY KEY, fk INTEGER, FOREIGN KEY (fk) REFERENCES p1(pk));
+INSERT INTO c1 VALUES (1,1);
+CREATE TABLE c2 (pk INTEGER PRIMARY KEY, fk1 INTEGER, fk2 INTEGER, FOREIGN KEY (fk1) REFERENCES p1(pk), FOREIGN KEY (fk2) REFERENCES p2(pk));
+INSERT INTO c2 VALUES (1,1,1), (2,1,2);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
+connection node_2;
+SET SESSION wsrep_sync_wait=0;
+TRUNCATE TABLE c1 ;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+######################################################################
+#
+# Scenario #2: DML working on FK parent table tries to replicate, but
+# fails in certification for earlier DDL on child table
+#
+######################################################################
+connection node_1;
+BEGIN;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+TRUNCATE TABLE c1 ;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
+COMMIT;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT 'I deadlocked';
+I deadlocked
+I deadlocked
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+######################################################################
+#
+# Scenario #3: 2 DMLs working on two FK parent tables try to replicate,
+# but fails in certification for earlier DDL on child table
+# which is child to both FK parents
+#
+######################################################################
+connection node_1;
+BEGIN;
+connection node_1b;
+BEGIN;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+TRUNCATE TABLE c2 ;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+UPDATE p1 SET f2 = 'TO DEADLOCK' WHERE pk = 1;
+COMMIT;
+connection node_1b;
+UPDATE p2 SET f2 = 'TO DEADLOCK' WHERE pk = 2;
+COMMIT;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT 'I deadlocked';
+I deadlocked
+I deadlocked
+connection node_1b;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT 'I deadlocked';
+I deadlocked
+I deadlocked
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM p1 WHERE f2 = 'INITIAL VALUE';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM p2 WHERE f2 = 'INITIAL VALUE';
+EXPECT_2
+2
+DROP TABLE c1, c2;
+DROP TABLE p1, p2;
diff --git a/mysql-test/suite/galera/r/galera_ddl_fk_no_conflict.result b/mysql-test/suite/galera/r/galera_ddl_fk_no_conflict.result
new file mode 100644
index 00000000..43046922
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ddl_fk_no_conflict.result
@@ -0,0 +1,330 @@
+connection node_2;
+connection node_1;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) );
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+OPTIMIZE TABLE child;;
+Table Op Msg_type Msg_text
+test.child optimize note Table does not support optimize, doing recreate + analyze instead
+test.child optimize status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+OPTIMIZE TABLE child;;
+Table Op Msg_type Msg_text
+test.child optimize note Table does not support optimize, doing recreate + analyze instead
+test.child optimize status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON DELETE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+OPTIMIZE TABLE child;;
+Table Op Msg_type Msg_text
+test.child optimize note Table does not support optimize, doing recreate + analyze instead
+test.child optimize status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE ON DELETE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+OPTIMIZE TABLE child;;
+Table Op Msg_type Msg_text
+test.child optimize note Table does not support optimize, doing recreate + analyze instead
+test.child optimize status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) );
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+REPAIR TABLE child;;
+Table Op Msg_type Msg_text
+test.child repair note The storage engine for the table doesn't support repair
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+REPAIR TABLE child;;
+Table Op Msg_type Msg_text
+test.child repair note The storage engine for the table doesn't support repair
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON DELETE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+REPAIR TABLE child;;
+Table Op Msg_type Msg_text
+test.child repair note The storage engine for the table doesn't support repair
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE ON DELETE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+REPAIR TABLE child;;
+Table Op Msg_type Msg_text
+test.child repair note The storage engine for the table doesn't support repair
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) );
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+CHECK TABLE child;;
+Table Op Msg_type Msg_text
+test.child check status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+CHECK TABLE child;;
+Table Op Msg_type Msg_text
+test.child check status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON DELETE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+CHECK TABLE child;;
+Table Op Msg_type Msg_text
+test.child check status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE ON DELETE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+CHECK TABLE child;;
+Table Op Msg_type Msg_text
+test.child check status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) );
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ANALYZE TABLE child;;
+Table Op Msg_type Msg_text
+test.child analyze status Engine-independent statistics collected
+test.child analyze status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ANALYZE TABLE child;;
+Table Op Msg_type Msg_text
+test.child analyze status Engine-independent statistics collected
+test.child analyze status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON DELETE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ANALYZE TABLE child;;
+Table Op Msg_type Msg_text
+test.child analyze status Engine-independent statistics collected
+test.child analyze status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
+CREATE TABLE parent (pk INTEGER PRIMARY KEY);
+CREATE TABLE child (pk INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY(parent_id) REFERENCES parent(pk) ON UPDATE CASCADE ON DELETE CASCADE);
+INSERT INTO parent VALUES (1), (2), (3), (4);
+INSERT INTO child VALUES (1,1), (2,2), (3,3), (4,4);
+connection node_1;
+START TRANSACTION;
+SELECT * FROM parent FOR UPDATE;
+pk
+1
+2
+3
+4
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+ANALYZE TABLE child;;
+Table Op Msg_type Msg_text
+test.child analyze status Engine-independent statistics collected
+test.child analyze status OK
+connection node_1;
+COMMIT;
+DROP TABLE child, parent;
+disconnect node_1a;
diff --git a/mysql-test/suite/galera/r/galera_ddl_multiline.result b/mysql-test/suite/galera/r/galera_ddl_multiline.result
new file mode 100644
index 00000000..9a5ccabd
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ddl_multiline.result
@@ -0,0 +1,91 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_1;
+CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE t4 (f1 INTEGER) ENGINE=InnoDB;;
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_2;
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW CREATE TABLE t4;
+Table Create Table
+t4 CREATE TABLE `t4` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_1;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t5 (f1 INTEGER) ENGINE=InnoDB;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SHOW CREATE TABLE t5;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SHOW CREATE TABLE t5;
+Table Create Table
+t5 CREATE TABLE `t5` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_1;
+CREATE TABLE t6 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t2 VALUES (1);;
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+SHOW CREATE TABLE t6;
+Table Create Table
+t6 CREATE TABLE `t6` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_2;
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+SHOW CREATE TABLE t6;
+Table Create Table
+t6 CREATE TABLE `t6` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+include/diff_servers.inc [servers=1 2]
+connection node_1;
+DROP TABLE t1, t2, t3, t4, t5, t6;
diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result
new file mode 100644
index 00000000..84dd7829
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_defaults.result
@@ -0,0 +1,61 @@
+connection node_2;
+connection node_1;
+# Correct Galera library found
+SELECT VARIABLE_NAME, VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME LIKE 'wsrep_%'
+AND VARIABLE_NAME NOT IN (
+'WSREP_PROVIDER_OPTIONS',
+'WSREP_SST_RECEIVE_ADDRESS',
+'WSREP_NODE_ADDRESS',
+'WSREP_NODE_NAME',
+'WSREP_PROVIDER',
+'WSREP_DATA_HOME_DIR',
+'WSREP_NODE_INCOMING_ADDRESS',
+'WSREP_START_POSITION',
+'WSREP_PATCH_VERSION'
+)
+ORDER BY VARIABLE_NAME;
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_ALLOWLIST
+WSREP_AUTO_INCREMENT_CONTROL ON
+WSREP_CAUSAL_READS ON
+WSREP_CERTIFICATION_RULES strict
+WSREP_CERTIFY_NONPK ON
+WSREP_CLUSTER_ADDRESS gcomm://
+WSREP_CLUSTER_NAME my_wsrep_cluster
+WSREP_CONVERT_LOCK_TO_TRX OFF
+WSREP_DBUG_OPTION
+WSREP_DEBUG NONE
+WSREP_DESYNC OFF
+WSREP_DIRTY_READS OFF
+WSREP_DRUPAL_282555_WORKAROUND OFF
+WSREP_FORCED_BINLOG_FORMAT NONE
+WSREP_GTID_DOMAIN_ID 0
+WSREP_GTID_MODE OFF
+WSREP_IGNORE_APPLY_ERRORS 7
+WSREP_LOAD_DATA_SPLITTING OFF
+WSREP_LOG_CONFLICTS OFF
+WSREP_MAX_WS_ROWS 0
+WSREP_MAX_WS_SIZE 2147483647
+WSREP_MODE
+WSREP_MYSQL_REPLICATION_BUNDLE 0
+WSREP_NOTIFY_CMD
+WSREP_ON ON
+WSREP_OSU_METHOD TOI
+WSREP_RECOVER OFF
+WSREP_REJECT_QUERIES NONE
+WSREP_RESTART_SLAVE OFF
+WSREP_RETRY_AUTOCOMMIT 1
+WSREP_SLAVE_FK_CHECKS ON
+WSREP_SLAVE_THREADS 1
+WSREP_SLAVE_UK_CHECKS OFF
+WSREP_SR_STORE table
+WSREP_SST_AUTH
+WSREP_SST_DONOR
+WSREP_SST_DONOR_REJECTS_QUERIES OFF
+WSREP_SST_METHOD rsync
+WSREP_STATUS_FILE
+WSREP_SYNC_WAIT 15
+WSREP_TRX_FRAGMENT_SIZE 0
+WSREP_TRX_FRAGMENT_UNIT bytes
diff --git a/mysql-test/suite/galera/r/galera_delete_limit.result b/mysql-test/suite/galera/r/galera_delete_limit.result
new file mode 100644
index 00000000..9898bfcf
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_delete_limit.result
@@ -0,0 +1,26 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 SELECT f1 FROM ten ORDER BY RAND();
+connection node_2;
+DELETE FROM t1 ORDER BY RAND() LIMIT 5;
+connection node_1;
+sum_matches
+1
+max_matches
+1
+DROP TABLE t1;
+CREATE TABLE t2 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t2 SELECT f1 FROM ten ORDER BY RAND();
+connection node_2;
+DELETE FROM t2 ORDER BY RAND() LIMIT 5;
+connection node_1;
+sum_matches
+1
+max_matches
+1
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_desync_overlapped.result b/mysql-test/suite/galera/r/galera_desync_overlapped.result
new file mode 100644
index 00000000..e3f40d44
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_desync_overlapped.result
@@ -0,0 +1,52 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+CREATE TABLE t1 (f1 INTEGER, PRIMARY KEY (f1)) Engine=InnoDB;
+CREATE TABLE t2 (f1 INTEGER, PRIMARY KEY (f1)) Engine=InnoDB;
+SET GLOBAL wsrep_desync = 1;
+show status like 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 1
+SET DEBUG_SYNC='before_execute_sql_command SIGNAL alter1 WAIT_FOR alter2';
+INSERT INTO t1 (f1) SELECT 0000 + (100 * a1.f1) + (10 * a2.f1) + a3.f1 FROM ten AS a1, ten AS a2, ten AS a3;
+connection node_1a;
+SET GLOBAL wsrep_desync = 1;
+Warnings:
+Warning 1231 'wsrep_desync' is already ON.
+show status like 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 1
+SET DEBUG_SYNC='now WAIT_FOR alter1';
+SET DEBUG_SYNC='before_execute_sql_command SIGNAL alter2';
+INSERT INTO t2 (f1) SELECT 0000 + (100 * a1.f1) + (10 * a2.f1) + a3.f1 FROM ten AS a1, ten AS a2, ten AS a3;
+connection node_1;
+connection node_1a;
+connection node_1;
+SET DEBUG_SYNC='RESET';
+SET GLOBAL wsrep_desync = 0;
+show status like 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 0
+SET GLOBAL wsrep_desync = 0;
+Warnings:
+Warning 1231 'wsrep_desync' is already OFF.
+show status like 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 0
+show status like 'wsrep_desync_count';
+Variable_name Value
+wsrep_desync_count 0
+SET GLOBAL wsrep_desync = 0;
+Warnings:
+Warning 1231 'wsrep_desync' is already OFF.
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1000
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+1000
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_disallow_local_gtid.result b/mysql-test/suite/galera/r/galera_disallow_local_gtid.result
new file mode 100644
index 00000000..0ec0d714
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_disallow_local_gtid.result
@@ -0,0 +1,99 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
+connection node_1;
+CREATE TABLE tab(a int not null primary key) engine=InnoDB;
+CREATE TABLE tab1(a int not null primary key) engine=MyISAM;
+CREATE TABLE tab2(a int not null primary key) engine=Aria;
+CREATE TABLE tab3(a int not null primary key) engine=MEMORY;
+SET GLOBAL wsrep_mode = DISALLOW_LOCAL_GTID;
+SET SESSION wsrep_OSU_method='RSU';
+ALTER TABLE tab FORCE;
+ERROR HY000: Galera replication not supported
+SET SESSiON sql_log_bin=0;
+ALTER TABLE tab FORCE;
+SET SESSION wsrep_OSU_method='TOI';
+SET SESSION sql_log_bin=1;
+SET SESSION wsrep_on=OFF;
+INSERT INTO tab VALUES (1);
+ERROR HY000: Galera replication not supported
+SET SESSiON sql_log_bin=0;
+INSERT INTO tab VALUES (1);
+SET SESSiON sql_log_bin=1;
+SET SESSION wsrep_on=ON;
+INSERT INTO tab VALUES (2);
+SELECT * FROM tab;
+a
+1
+2
+connection node_2;
+SELECT * FROM tab;
+a
+2
+connection node_1;
+INSERT INTO tab1 VALUES(1);
+ERROR HY000: Galera replication not supported
+INSERT INTO tab2 VALUES(1);
+ERROR HY000: Galera replication not supported
+INSERT INTO tab3 VALUES(1);
+ERROR HY000: Galera replication not supported
+SET GLOBAL wsrep_mode = "DISALLOW_LOCAL_GTID,REPLICATE_MYISAM,REPLICATE_ARIA";
+INSERT INTO tab1 VALUES(2);
+INSERT INTO tab2 VALUES(2);
+INSERT INTO tab3 VALUES(2);
+ERROR HY000: Galera replication not supported
+SET SESSiON sql_log_bin=0;
+INSERT INTO tab1 VALUES(3);
+INSERT INTO tab2 VALUES(3);
+INSERT INTO tab3 VALUES(3);
+SET SESSION sql_log_bin=1;
+SET SESSION wsrep_on=OFF;
+INSERT INTO tab1 VALUES(4);
+ERROR HY000: Galera replication not supported
+INSERT INTO tab2 VALUES(4);
+ERROR HY000: Galera replication not supported
+INSERT INTO tab3 VALUES(4);
+ERROR HY000: Galera replication not supported
+SET SESSiON sql_log_bin=0;
+INSERT INTO tab1 VALUES(5);
+INSERT INTO tab2 VALUES(5);
+INSERT INTO tab3 VALUES(5);
+SET SESSION wsrep_on=ON;
+INSERT INTO tab1 VALUES(6);
+INSERT INTO tab2 VALUES(6);
+INSERT INTO tab3 VALUES(6);
+SELECT * FROM tab1;
+a
+2
+3
+5
+6
+SELECT * FROM tab2;
+a
+2
+3
+5
+6
+SELECT * FROM tab3;
+a
+3
+5
+6
+connection node_2;
+SELECT * FROM tab1;
+a
+2
+3
+6
+SELECT * FROM tab2;
+a
+2
+3
+6
+SELECT * FROM tab3;
+a
+connection node_1;
+DROP TABLE tab;
+DROP TABLE tab1;
+DROP TABLE tab2;
+DROP TABLE tab3;
diff --git a/mysql-test/suite/galera/r/galera_drop_database.result b/mysql-test/suite/galera/r/galera_drop_database.result
new file mode 100644
index 00000000..03b55136
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_drop_database.result
@@ -0,0 +1,53 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+CREATE DATABASE fts;
+USE fts;
+CREATE TABLE fts_t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB;
+CREATE TABLE fts_t2 (f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+INSERT INTO fts_t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
+INSERT INTO fts_t2 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
+DROP TABLE ten;
+UPDATE fts_t1 SET f2 = 'abcd';
+UPDATE fts_t2 SET f2 = 'efjh';
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1 where f2 = 'abcd';
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2 where f2 = 'efjh';
+EXPECT_1000
+1000
+connection node_2;
+connection node_1;
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2;
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t1 where f2 = 'abcd';
+EXPECT_1000
+1000
+SELECT COUNT(*) AS EXPECT_1000 FROM fts_t2 where f2 = 'efjh';
+EXPECT_1000
+1000
+connection node_1;
+USE fts;
+DROP TABLE fts_t1;
+DROP TABLE fts_t2;
+SHOW TABLES;
+Tables_in_fts
+DROP DATABASE fts;
+connection node_2;
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:");
+Warnings:
+Note 1049 Unknown database 'fts'
diff --git a/mysql-test/suite/galera/r/galera_drop_multi.result b/mysql-test/suite/galera/r/galera_drop_multi.result
new file mode 100644
index 00000000..1ff8afe3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_drop_multi.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TEMPORARY TABLE t2 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TEMPORARY TABLE t4 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t5 (f1 INTEGER);
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+DROP TABLE t1, t2, t3, t4;
+INSERT INTO t5 VALUES (1);
+COMMIT;
+connection node_2;
+SHOW CREATE TABLE t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+SHOW CREATE TABLE t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+SHOW CREATE TABLE t3;
+ERROR 42S02: Table 'test.t3' doesn't exist
+SHOW CREATE TABLE t4;
+ERROR 42S02: Table 'test.t4' doesn't exist
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test.t2,test.t4'' on query\. Default database: 'test'\. Query: 'DROP TABLE t1, t2, t3, t4', Error_code: 1051");
+connection node_1;
+DROP TABLE t5;
diff --git a/mysql-test/suite/galera/r/galera_encrypt_tmp_files.result b/mysql-test/suite/galera/r/galera_encrypt_tmp_files.result
new file mode 100644
index 00000000..fdfca331
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_encrypt_tmp_files.result
@@ -0,0 +1,39 @@
+connection node_2;
+connection node_1;
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE `t1` (
+`col1` int(11) NOT NULL,
+`col2` varchar(64) NOT NULL DEFAULT '',
+`col3` varchar(32) NOT NULL DEFAULT '0',
+`col4` varchar(64) NOT NULL DEFAULT '',
+`col5` tinyint(4) NOT NULL DEFAULT '0',
+`col6` int(11) NOT NULL DEFAULT '0',
+`col7` varchar(64) NOT NULL DEFAULT '',
+`col8` tinyint(4) NOT NULL DEFAULT '0',
+`col9` tinyint(4) NOT NULL DEFAULT '0',
+`col10` text NOT NULL,
+`col11` varchar(255) NOT NULL DEFAULT '',
+`col12` tinyint(4) NOT NULL DEFAULT '1'
+) ;
+create table t2 (test int);
+insert into t2 values (1);
+drop table t1,t2;
diff --git a/mysql-test/suite/galera/r/galera_enum.result b/mysql-test/suite/galera/r/galera_enum.result
new file mode 100644
index 00000000..40fc6931
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_enum.result
@@ -0,0 +1,53 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 ENUM('', 'one', 'two'), KEY (f1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('');
+INSERT INTO t1 VALUES ('one'), ('two');
+INSERT IGNORE INTO t1 VALUES (0), (1), (2);
+Warnings:
+Warning 1265 Data truncated for column 'f1' at row 1
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+6
+SELECT COUNT(*) FROM t1 where f1 = '';
+COUNT(*)
+2
+SELECT COUNT(*) FROM t1 where f1 = 'one';
+COUNT(*)
+2
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 ENUM('', 'one', 'two', 'three', 'four') PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (''), ('one'), ('two');
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+3
+SELECT COUNT(*) FROM t1 WHERE f1 = '';
+COUNT(*)
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'three' where f1 = '';
+connection node_2;
+SET AUTOCOMMIt=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'four' where f1 = '';
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1;
+SELECT COUNT(*) FROM t1 WHERE f1 = 'three';
+COUNT(*)
+1
+SELECT * FROM t1;
+f1
+one
+two
+three
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_events.result b/mysql-test/suite/galera/r/galera_events.result
new file mode 100644
index 00000000..373f063c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_events.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE EVENT event1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1;
+Warnings:
+Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
+connection node_2;
+SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1';
+DEFINER= 'root@localhost' ORIGINATOR = 1 STATUS = 'SLAVESIDE_DISABLED' EVENT_TYPE = 'ONE TIME' ON_COMPLETION = 'NOT PRESERVE'
+1 1 1 1 1
+connection node_1;
+ALTER EVENT event1 DISABLE;
+connection node_2;
+SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1';
+DEFINER= 'root@localhost' ORIGINATOR = 1 STATUS = 'SLAVESIDE_DISABLED' EVENT_TYPE = 'ONE TIME' ON_COMPLETION = 'NOT PRESERVE'
+1 1 1 1 1
+connection node_2;
+SET GLOBAL event_scheduler = ON;
+CREATE EVENT event2 ON SCHEDULE AT CURRENT_TIMESTAMP ON COMPLETION NOT PRESERVE DO SELECT 1;
+connection node_1;
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event2';
+COUNT(*) = 0
+1
+connection node_1;
+DROP EVENT event1;
+connection node_2;
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1';
+COUNT(*) = 0
+1
+connection node_2;
+SET GLOBAL event_scheduler = OFF;;
diff --git a/mysql-test/suite/galera/r/galera_events2.result b/mysql-test/suite/galera/r/galera_events2.result
new file mode 100644
index 00000000..26d3a74a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_events2.result
@@ -0,0 +1,126 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE event_table(a int) engine=innodb;
+CREATE EVENT event_2 ON SCHEDULE EVERY 1 SECOND
+ENDS NOW() + INTERVAL 6 SECOND
+ON COMPLETION NOT PRESERVE
+DO
+INSERT INTO event_table VALUES (1);
+Warnings:
+Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
+# node_1 event should be there
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+def test event_2 root@localhost SQL INSERT INTO event_table VALUES (1) RECURRING NULL 1 SECOND ENABLED NOT PRESERVE
+connection node_2;
+set global wsrep_sync_wait=15;
+# node_2 event should be there
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+def test event_2 root@localhost SQL INSERT INTO event_table VALUES (1) RECURRING NULL 1 SECOND SLAVESIDE_DISABLED NOT PRESERVE
+connection node_1;
+SET GLOBAL event_scheduler=ON;
+SHOW VARIABLES LIKE 'event_scheduler';
+Variable_name Value
+event_scheduler ON
+# node_1 event should be removed
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+connection node_2;
+# node_2 event should be removed
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='event_2';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+connection node_1;
+SET GLOBAL event_scheduler=OFF;
+DROP TABLE event_table;
+connection node_1;
+CREATE DATABASE IF NOT EXISTS events_test;
+use events_test;
+CREATE USER ev_test@localhost;
+GRANT ALL ON events_test.* to ev_test@localhost;
+connect ev_con1,localhost,ev_test,,events_test;
+CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123;
+Warnings:
+Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
+SHOW EVENTS;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+events_test one_event ev_test@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+def events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
+"The definer should be ev_test@localhost"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+def events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+connection node_2;
+use events_test;
+"The definer should be ev_test@localhost"
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+def events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND SLAVESIDE_DISABLED NOT PRESERVE
+connection node_1;
+disconnect ev_con1;
+use test;
+DROP EVENT events_test.one_event;
+DROP USER ev_test@localhost;
+DROP DATABASE events_test;
+connection node_1;
+use test;
+CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123;
+Warnings:
+Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
+# node_1 Event should be enabled
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+def test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+connection node_2;
+use test;
+# node_2 Event should be SERVERSIDE_DISABLED
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+def test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND SLAVESIDE_DISABLED NOT PRESERVE
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=InnoDB;
+INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a');
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 a
+Shutting down server ...
+connection node_1;
+UPDATE t1 SET f2 = 'b' WHERE f1 > 1;
+UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+connection node_2;
+# Force SST from node_1 to node_2
+Starting server ...
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+# node_2 Event should be SERVERSIDE_DISABLED
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+def test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND SLAVESIDE_DISABLED NOT PRESERVE
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:.*");
+connection node_1;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+# node_1 Event should be ENABLED
+SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
+EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
+def test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
+DROP TABLE t1;
+DROP EVENT one_event;
diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_delete.result b/mysql-test/suite/galera/r/galera_fk_cascade_delete.result
new file mode 100644
index 00000000..9bb004d0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_cascade_delete.result
@@ -0,0 +1,160 @@
+connection node_2;
+connection node_1;
+#
+# test phase with cascading foreign key through 3 tables
+#
+connection node_1;
+CREATE TABLE grandparent (
+id INT NOT NULL PRIMARY KEY
+) ENGINE=InnoDB;
+CREATE TABLE parent (
+id INT NOT NULL PRIMARY KEY,
+grandparent_id INT,
+FOREIGN KEY (grandparent_id)
+REFERENCES grandparent(id)
+ON DELETE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT NOT NULL PRIMARY KEY,
+parent_id INT,
+FOREIGN KEY (parent_id)
+REFERENCES parent(id)
+ON DELETE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO grandparent VALUES (1),(2);
+INSERT INTO parent VALUES (1,1), (2,2);
+INSERT INTO child VALUES (1,1), (2,2);
+connection node_2;
+DELETE FROM grandparent WHERE id = 1;
+SELECT * FROM grandparent;
+id
+2
+SELECT * FROM parent;
+id grandparent_id
+2 2
+SELECT * FROM child;
+id parent_id
+2 2
+connection node_1;
+SELECT * FROM grandparent;
+id
+2
+SELECT * FROM parent;
+id grandparent_id
+2 2
+SELECT * FROM child;
+id parent_id
+2 2
+DROP TABLE child;
+DROP TABLE parent;
+DROP TABLE grandparent;
+
+Scenario 2, testing PA applying with FK cascade delete
+
+CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
+ON DELETE CASCADE,
+CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
+ON DELETE CASCADE);
+connection node_2;
+set global wsrep_slave_threads=DEFAULT;
+SELECT * FROM p1;
+f1 f2
+SELECT * FROM p2;
+f1 f2
+SELECT * FROM c;
+f1 p1_id p2_id f2
+connection node_1;
+DROP TABLE c;
+DROP TABLE p1,p2;
+
+Scenario 4, testing PA applying with FK cascade delete on
+more than one level
+
+CREATE TABLE gp1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE gp2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT pfk_3 FOREIGN KEY (p1_id) REFERENCES gp1 (f1)
+ON DELETE CASCADE
+) ENGINE=INNODB;
+CREATE TABLE p2 (f1 INTEGER PRIMARY KEY,p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT pfk_4 FOREIGN KEY (p1_id) REFERENCES gp2 (f1)
+ON DELETE CASCADE
+) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
+ON DELETE CASCADE,
+CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
+ON DELETE CASCADE) ENGINE=INNODB;
+connection node_2;
+set global wsrep_slave_threads=DEFAULT;
+SELECT * FROM gp1;
+f1 f2
+SELECT * FROM gp2;
+f1 f2
+SELECT * FROM p1;
+f1 p1_id p2_id f2
+SELECT * FROM p2;
+f1 p1_id p2_id f2
+SELECT * FROM c;
+f1 p1_id p2_id f2
+connection node_1;
+DROP TABLE c;
+DROP TABLE p1,p2;
+DROP TABLE gp1,gp2;
+
+Scenario 3, testing PA applying with FK cascade delete on
+more than one level in a diamond topology
+
+CREATE TABLE ggp1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE gp1 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT pfk_6 FOREIGN KEY (p1_id) REFERENCES ggp1 (f1)
+ON DELETE CASCADE
+) ENGINE=INNODB;
+CREATE TABLE gp2 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT pfk_5 FOREIGN KEY (p1_id) REFERENCES ggp1 (f1)
+ON DELETE CASCADE
+) ENGINE=INNODB;
+CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT pfk_3 FOREIGN KEY (p1_id) REFERENCES gp1 (f1)
+ON DELETE CASCADE
+) ENGINE=INNODB;
+CREATE TABLE p2 (f1 INTEGER PRIMARY KEY,p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT pfk_4 FOREIGN KEY (p1_id) REFERENCES gp2 (f1)
+ON DELETE CASCADE
+) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p1_id INTEGER, p2_id INTEGER,
+f2 INTEGER,
+CONSTRAINT fk_1 FOREIGN KEY (p1_id) REFERENCES p1 (f1)
+ON DELETE CASCADE,
+CONSTRAINT fk_2 FOREIGN KEY (p2_id) REFERENCES p2 (f1)
+ON DELETE CASCADE) ENGINE=INNODB;
+connection node_2;
+set global wsrep_slave_threads=DEFAULT;
+SELECT * FROM ggp1;
+f1 f2
+SELECT * FROM gp2;
+f1 p1_id p2_id f2
+SELECT * FROM gp1;
+f1 p1_id p2_id f2
+SELECT * FROM p1;
+f1 p1_id p2_id f2
+SELECT * FROM p2;
+f1 p1_id p2_id f2
+SELECT * FROM c;
+f1 p1_id p2_id f2
+connection node_1;
+DROP TABLE c;
+DROP TABLE p1,p2;
+DROP TABLE gp1,gp2;
+DROP TABLE ggp1;
diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result b/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result
new file mode 100644
index 00000000..e545da53
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_cascade_delete_debug.result
@@ -0,0 +1,66 @@
+connection node_2;
+connection node_1;
+#
+# test phase with foreign key of varchar type
+#
+connection node_1;
+CREATE TABLE parent (
+`id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+CREATE TABLE child (
+`id` int NOT NULL,
+`parent_id` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
+PRIMARY KEY (`id`),
+KEY `parent_id` (`parent_id`),
+CONSTRAINT `ipallocations_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+INSERT INTO parent VALUES ('row one'), ('row two');
+INSERT INTO child VALUES (1,'row one'), (2,'row two');
+connection node_2;
+DELETE FROM parent;
+connection node_1;
+SELECT * FROM parent;
+id
+SELECT * FROM child;
+id parent_id
+DROP TABLE child;
+DROP TABLE parent;
+#
+# test phase with MM conflict in FK cascade
+#
+connection node_1;
+set wsrep_retry_autocommit=0;
+CREATE TABLE parent (
+id INT NOT NULL PRIMARY KEY
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT NOT NULL PRIMARY KEY,
+j int default 0,
+parent_id INT,
+FOREIGN KEY (parent_id)
+REFERENCES parent(id)
+ON DELETE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO parent VALUES (1);
+INSERT INTO child VALUES (1,0,1);
+connection node_2;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_2;
+DELETE FROM parent;
+connection node_1a;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_1;
+update child set j=2;;
+connection node_1a;
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "RESET";
+connection node_1;
+SELECT * FROM parent;
+id
+SELECT * FROM child;
+id j parent_id
+DROP TABLE child;
+DROP TABLE parent;
diff --git a/mysql-test/suite/galera/r/galera_fk_cascade_update.result b/mysql-test/suite/galera/r/galera_fk_cascade_update.result
new file mode 100644
index 00000000..5294826a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_cascade_update.result
@@ -0,0 +1,34 @@
+connection node_2;
+connection node_1;
+CREATE TABLE grandparent (
+id INT NOT NULL PRIMARY KEY
+) ENGINE=InnoDB;
+CREATE TABLE parent (
+id INT NOT NULL PRIMARY KEY,
+grandparent_id INT,
+FOREIGN KEY (grandparent_id)
+REFERENCES grandparent(id)
+ON UPDATE CASCADE
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT NOT NULL PRIMARY KEY,
+grandparent_id INT,
+FOREIGN KEY (grandparent_id)
+REFERENCES parent(grandparent_id)
+ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO grandparent VALUES (1),(2);
+INSERT INTO parent VALUES (1,1), (2,2);
+INSERT INTO child VALUES (1,1), (2,2);
+connection node_2;
+UPDATE grandparent SET id = 3 WHERE id = 1;
+connection node_1;
+SELECT COUNT(*) = 1 FROM parent WHERE grandparent_id = 3;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM child WHERE grandparent_id = 3;
+COUNT(*) = 1
+1
+DROP TABLE child;
+DROP TABLE parent;
+DROP TABLE grandparent;
diff --git a/mysql-test/suite/galera/r/galera_fk_conflict.result b/mysql-test/suite/galera/r/galera_fk_conflict.result
new file mode 100644
index 00000000..f9f151ab
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_conflict.result
@@ -0,0 +1,29 @@
+connection node_2;
+connection node_1;
+CREATE TABLE parent (
+id INT PRIMARY KEY,
+KEY (id)
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT PRIMARY KEY,
+parent_id INT,
+FOREIGN KEY (parent_id)
+REFERENCES parent(id)
+) ENGINE=InnoDB;
+INSERT INTO parent VALUES (1), (2);
+INSERT INTO child VALUES (1,1);
+connection node_1;
+SET AUTOCOMMIT = OFF;
+START TRANSACTION;
+DELETE FROM parent WHERE id = 2;
+connection node_2;
+SET AUTOCOMMIT = OFF;
+START TRANSACTION;
+INSERT INTO child VALUES (2, 2);
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE child;
+DROP TABLE parent;
diff --git a/mysql-test/suite/galera/r/galera_fk_lock_wait.result b/mysql-test/suite/galera/r/galera_fk_lock_wait.result
new file mode 100644
index 00000000..0d87aa2a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_lock_wait.result
@@ -0,0 +1,54 @@
+connection node_2;
+connection node_1;
+CREATE TABLE parent(parent_id int not null AUTO_INCREMENT PRIMARY KEY,
+parent_name varchar(80)) ENGINE=InnoDB;
+CREATE TABLE child(child_id int not null AUTO_INCREMENT PRIMARY KEY,
+child_name varchar(80),
+child_parent_id int not null,
+CONSTRAINT `fk_child_parent`
+ FOREIGN KEY (child_parent_id) REFERENCES parent (parent_id)
+ON DELETE CASCADE
+ON UPDATE CASCADE) ENGINE=InnoDB;
+INSERT INTO parent VALUES (1, 'first'),(2,'second'),(3,'foo'),(4,'tmp');
+INSERT INTO child VALUES (NULL,'first_child',1);
+INSERT INTO child VALUES (NULL,'second_child',1);
+INSERT INTO child VALUES (NULL,'first_child2',2);
+INSERT INTO child VALUES (NULL,'first_child3',2);
+INSERT INTO child VALUES (NULL,'first_child4',3);
+BEGIN;
+UPDATE parent SET parent_name = 'bar' WHERE parent_id = 2;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION innodb_lock_wait_timeout=2;
+UPDATE child SET child_parent_id = 5 where child_parent_id = 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection node_1;
+COMMIT;
+SELECT * FROM parent;
+parent_id parent_name
+1 first
+2 bar
+3 foo
+4 tmp
+SELECT * FROM child;
+child_id child_name child_parent_id
+1 first_child 1
+3 second_child 1
+5 first_child2 2
+7 first_child3 2
+9 first_child4 3
+connection node_2;
+SELECT * FROM parent;
+parent_id parent_name
+1 first
+2 bar
+3 foo
+4 tmp
+SELECT * FROM child;
+child_id child_name child_parent_id
+1 first_child 1
+3 second_child 1
+5 first_child2 2
+7 first_child3 2
+9 first_child4 3
+DROP TABLE child, parent;
+disconnect node_1a;
diff --git a/mysql-test/suite/galera/r/galera_fk_mismatch.result b/mysql-test/suite/galera/r/galera_fk_mismatch.result
new file mode 100644
index 00000000..a030b121
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_mismatch.result
@@ -0,0 +1,30 @@
+connection node_2;
+connection node_1;
+CREATE TABLE parent (
+id1 INT,
+id2 INT,
+PRIMARY KEY (id1, id2) /* Multipart PK */
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT PRIMARY KEY,
+parent_id1 INT,
+FOREIGN KEY (parent_id1)
+REFERENCES parent(id1) /* FK is subset of PK above */
+ON UPDATE CASCADE
+ON DELETE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO parent VALUES (1, 2);
+INSERT INTO child VALUES (1, 1);
+connection node_2;
+UPDATE parent SET id1 = 3 WHERE id1 = 1;
+connection node_1;
+SELECT COUNT(*) = 1 FROM child WHERE parent_id1 = 3;
+COUNT(*) = 1
+1
+DELETE FROM parent WHERE id1 = 3;
+connection node_2;
+SELECT COUNT(*) = 0 FROM child WHERE parent_id1 = 3;
+COUNT(*) = 0
+1
+DROP TABLE child;
+DROP TABLE parent;
diff --git a/mysql-test/suite/galera/r/galera_fk_multibyte.result b/mysql-test/suite/galera/r/galera_fk_multibyte.result
new file mode 100644
index 00000000..f035d324
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_multibyte.result
@@ -0,0 +1,35 @@
+connection node_2;
+connection node_1;
+create table p (i varchar(100) primary key, j int) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+create table c1 (i int primary key auto_increment, j varchar(100), k int, key(j), constraint fk1 foreign key (j) references p(i)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+create table c2 (i int primary key auto_increment, j varchar(100), k int, key(j), constraint fk2 foreign key (j) references p(i)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+insert into p values('sippo',1);
+insert into c1 values(1,'sippo',1);
+insert into c2 values(1,'sippo',1);
+update c1 set k = 100 where j = 'sippo';
+insert into c1 values(2,'sippo',1);
+select * from p;
+i j
+sippo 1
+select * from c1;
+i j k
+1 sippo 100
+2 sippo 1
+select * from c2;
+i j k
+1 sippo 1
+connection node_2;
+select * from p;
+i j
+sippo 1
+select * from c1;
+i j k
+1 sippo 100
+2 sippo 1
+select * from c2;
+i j k
+1 sippo 1
+connection node_1;
+drop table c1;
+drop table c2;
+drop table p;
diff --git a/mysql-test/suite/galera/r/galera_fk_multicolumn.result b/mysql-test/suite/galera/r/galera_fk_multicolumn.result
new file mode 100644
index 00000000..b626d963
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_multicolumn.result
@@ -0,0 +1,39 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t0 (
+f1 INT PRIMARY KEY,
+f2 INT UNIQUE
+);
+CREATE TABLE t1 (
+f1 INT PRIMARY KEY,
+FOREIGN KEY (f1)
+REFERENCES t0(f1)
+ON UPDATE CASCADE
+);
+CREATE TABLE t2 (
+f2 INT PRIMARY KEY,
+FOREIGN KEY (f2)
+REFERENCES t0(f2)
+ON UPDATE CASCADE
+);
+INSERT INTO t0 VALUES (0, 0);
+INSERT INTO t1 VALUES (0);
+INSERT INTO t2 VALUES (0);
+connection node_2;
+UPDATE t0 SET f1 = 1, f2 = 2;
+connection node_1;
+SELECT f1 = 1 FROM t1 WHERE f1 = 1;
+f1 = 1
+1
+SELECT f2 = 2 FROM t2 WHERE f2 = 2;
+f2 = 2
+1
+SELECT f1 = 1 FROM t1;
+f1 = 1
+1
+SELECT f2 = 2 FROM t2;
+f2 = 2
+1
+DROP TABLE t2;
+DROP TABLE t1;
+DROP TABLE t0;
diff --git a/mysql-test/suite/galera/r/galera_fk_multitable.result b/mysql-test/suite/galera/r/galera_fk_multitable.result
new file mode 100644
index 00000000..83e1491a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_multitable.result
@@ -0,0 +1,26 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t0 (
+f0 INT PRIMARY KEY
+);
+CREATE TABLE t1 (
+f1 INT PRIMARY KEY,
+f0 INTEGER,
+FOREIGN KEY (f0)
+REFERENCES t0(f0)
+ON DELETE CASCADE
+);
+INSERT INTO t0 VALUES (0), (1);
+INSERT INTO t1 VALUES (0, 0);
+INSERT INTO t1 VALUES (1, 0);
+connection node_2;
+DELETE t0.*, t1.* FROM t0, t1 WHERE t0.f0 = 0 AND t1.f1 = 0;
+connection node_1;
+SELECT COUNT(*) = 1 FROM t0;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+DROP TABLE t0;
diff --git a/mysql-test/suite/galera/r/galera_fk_no_pk.result b/mysql-test/suite/galera/r/galera_fk_no_pk.result
new file mode 100644
index 00000000..622e63db
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_no_pk.result
@@ -0,0 +1,33 @@
+connection node_2;
+connection node_1;
+CREATE TABLE parent (
+id INT,
+KEY (id)
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT,
+parent_id INT,
+FOREIGN KEY (parent_id)
+REFERENCES parent(id)
+ON UPDATE CASCADE
+ON DELETE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO parent VALUES (1), (1), (2), (2);
+INSERT INTO child VALUES (1,1), (2,2), (1,1), (2,2);
+connection node_2;
+DELETE FROM parent WHERE id = 1;
+SELECT COUNT(*) = 0 FROM child WHERE id = 1;
+COUNT(*) = 0
+1
+connection node_1;
+UPDATE parent SET id = 3 WHERE id = 2;
+connection node_2;
+SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1;
+COUNT(*) = 0
+1
+SELECT parent_id = 3 FROM child WHERE id = 2;
+parent_id = 3
+1
+1
+DROP TABLE child;
+DROP TABLE parent;
diff --git a/mysql-test/suite/galera/r/galera_fk_selfreferential.result b/mysql-test/suite/galera/r/galera_fk_selfreferential.result
new file mode 100644
index 00000000..9a64521e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_selfreferential.result
@@ -0,0 +1,17 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (
+f1 INT NOT NULL PRIMARY KEY,
+f2 INT,
+FOREIGN KEY (f2)
+REFERENCES t1(f1)
+ON DELETE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 1), (2, 1);
+connection node_2;
+DELETE FROM t1 WHERE f1 = 1;
+connection node_1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_fk_setnull.result b/mysql-test/suite/galera/r/galera_fk_setnull.result
new file mode 100644
index 00000000..afb3fc3b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_setnull.result
@@ -0,0 +1,36 @@
+connection node_2;
+connection node_1;
+CREATE TABLE parent (
+id INT NOT NULL,
+PRIMARY KEY (id)
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT,
+parent_id INT,
+FOREIGN KEY (parent_id)
+REFERENCES parent(id)
+ON UPDATE SET NULL
+ON DELETE SET NULL
+) ENGINE=InnoDB;
+INSERT INTO parent VALUES (1),(2);
+INSERT INTO child VALUES (1,1),(2,2);
+connection node_2;
+DELETE FROM parent WHERE id = 1;
+SELECT parent_id IS NULL FROM child WHERE id = 1;
+parent_id IS NULL
+1
+connection node_1;
+SELECT parent_id IS NULL FROM child WHERE id = 1;
+parent_id IS NULL
+1
+UPDATE parent SET id = 3 WHERE id = 2;
+SELECT parent_id IS NULL FROM child WHERE id = 2;
+parent_id IS NULL
+1
+connection node_2;
+SELECT parent_id IS NULL FROM child WHERE id = 2;
+parent_id IS NULL
+1
+connection node_1;
+DROP TABLE child;
+DROP TABLE parent;
diff --git a/mysql-test/suite/galera/r/galera_fk_truncate.result b/mysql-test/suite/galera/r/galera_fk_truncate.result
new file mode 100644
index 00000000..a90f3e27
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fk_truncate.result
@@ -0,0 +1,47 @@
+connection node_2;
+connection node_1;
+CREATE TABLE author (
+id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+name VARCHAR(100) NOT NULL
+) ENGINE = InnoDB;
+CREATE TABLE book (
+id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+title VARCHAR(200) NOT NULL,
+author_id SMALLINT UNSIGNED NOT NULL,
+CONSTRAINT `fk_book_author`
+ FOREIGN KEY (author_id) REFERENCES author (id)
+ON DELETE CASCADE
+ON UPDATE RESTRICT
+) ENGINE = InnoDB;
+INSERT INTO author (name) VALUES ('Abdul Alhazred');
+INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID());
+TRUNCATE TABLE book;
+SELECT * FROM author;
+id name
+1 Abdul Alhazred
+SELECT * FROM book;
+id title author_id
+connection node_2;
+SELECT * FROM author;
+id name
+1 Abdul Alhazred
+SELECT * FROM book;
+id title author_id
+INSERT INTO author (name) VALUES ('Abdul Alhazred');
+INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID());
+TRUNCATE TABLE book;
+SELECT * FROM author;
+id name
+1 Abdul Alhazred
+2 Abdul Alhazred
+SELECT * FROM book;
+id title author_id
+connection node_1;
+TRUNCATE TABLE book;
+SELECT * FROM author;
+id name
+1 Abdul Alhazred
+2 Abdul Alhazred
+SELECT * FROM book;
+id title author_id
+DROP TABLE book, author;
diff --git a/mysql-test/suite/galera/r/galera_flush_local.result b/mysql-test/suite/galera/r/galera_flush_local.result
new file mode 100644
index 00000000..66884cd1
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_flush_local.result
@@ -0,0 +1,161 @@
+connection node_2;
+connection node_1;
+DROP TABLE IF EXISTS t1, t2, x1, x2;
+connection node_1;
+SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
+CREATE TABLE t1 (f1 INTEGER);
+CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
+CREATE TABLE x1 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE x2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO x1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO t2 (f2) SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4;
+INSERT INTO x2 (f2) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+connection node_2;
+connection node_1;
+FLUSH LOCAL DES_KEY_FILE;
+FLUSH LOCAL HOSTS;
+FLUSH LOCAL QUERY CACHE;
+FLUSH LOCAL STATUS;
+FLUSH LOCAL PRIVILEGES;
+FLUSH LOCAL USER_RESOURCES;
+FLUSH LOCAL TABLES;
+FLUSH LOCAL TABLES t2;
+FLUSH LOCAL ERROR LOGS;
+FLUSH LOCAL SLOW LOGS;
+FLUSH LOCAL GENERAL LOGS;
+FLUSH LOCAL ENGINE LOGS;
+FLUSH LOCAL RELAY LOGS;
+FLUSH LOCAL CLIENT_STATISTICS;
+FLUSH LOCAL INDEX_STATISTICS;
+FLUSH LOCAL TABLE_STATISTICS;
+FLUSH LOCAL USER_STATISTICS;
+FLUSH LOCAL LOGS;
+FLUSH LOCAL BINARY LOGS;
+FLUSH LOCAL TABLES WITH READ LOCK;
+UNLOCK TABLES;
+FLUSH LOCAL TABLES t1 WITH READ LOCK;
+UNLOCK TABLES;
+FLUSH LOCAL TABLES t1 FOR EXPORT;
+UNLOCK TABLES;
+LOCK TABLES t1 WRITE;
+FLUSH LOCAL TABLES t1;
+UNLOCK TABLES;
+LOCK TABLES t1 READ;
+FLUSH LOCAL TABLES t1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+UNLOCK TABLES;
+FLUSH LOCAL TABLES t1;
+ANALYZE LOCAL TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+OPTIMIZE LOCAL TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t2 optimize status OK
+REPAIR LOCAL TABLE x1, x2;
+Table Op Msg_type Msg_text
+test.x1 repair status OK
+test.x2 repair status OK
+connection node_2;
+wsrep_last_committed_diff
+1
+SELECT COUNT(*) AS EXPECT_10 FROM t1;
+EXPECT_10
+10
+SELECT COUNT(*) AS EXPECT_10 FROM x1;
+EXPECT_10
+10
+SELECT COUNT(*) AS EXPECT_10000 FROM t2;
+EXPECT_10000
+10000
+SELECT COUNT(*) AS EXPECT_10 FROM x2;
+EXPECT_10
+10
+connection node_1;
+DROP TABLE t1, t2, x1, x2;
+CREATE TABLE t1 (f1 INTEGER);
+CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
+CREATE TABLE x1 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE x2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO x1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+INSERT INTO t2 (f2) SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4;
+INSERT INTO x2 (f2) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+connection node_2;
+connection node_1;
+set wsrep_on=0;
+FLUSH DES_KEY_FILE;
+FLUSH HOSTS;
+FLUSH QUERY CACHE;
+FLUSH STATUS;
+FLUSH PRIVILEGES;
+FLUSH USER_RESOURCES;
+FLUSH TABLES;
+FLUSH TABLES t2;
+FLUSH ERROR LOGS;
+FLUSH SLOW LOGS;
+FLUSH GENERAL LOGS;
+FLUSH ENGINE LOGS;
+FLUSH RELAY LOGS;
+FLUSH CLIENT_STATISTICS;
+FLUSH INDEX_STATISTICS;
+FLUSH TABLE_STATISTICS;
+FLUSH USER_STATISTICS;
+FLUSH LOGS;
+FLUSH BINARY LOGS;
+FLUSH TABLES WITH READ LOCK;
+UNLOCK TABLES;
+FLUSH TABLES t1 WITH READ LOCK;
+UNLOCK TABLES;
+FLUSH TABLES t1 FOR EXPORT;
+UNLOCK TABLES;
+LOCK TABLES t1 WRITE;
+FLUSH TABLES t1;
+UNLOCK TABLES;
+LOCK TABLES t1 READ;
+FLUSH TABLES t1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+UNLOCK TABLES;
+FLUSH TABLES t1;
+ANALYZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+test.t2 analyze status Engine-independent statistics collected
+test.t2 analyze status OK
+OPTIMIZE TABLE t1, t2;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t2 optimize status OK
+REPAIR TABLE x1, x2;
+Table Op Msg_type Msg_text
+test.x1 repair status OK
+test.x2 repair status OK
+connection node_2;
+wsrep_last_committed_diff
+1
+wsrep_last_committed_diff2
+1
+SELECT COUNT(*) AS EXPECT_10 FROM t1;
+EXPECT_10
+10
+SELECT COUNT(*) AS EXPECT_10 FROM x1;
+EXPECT_10
+10
+SELECT COUNT(*) AS EXPECT_10000 FROM t2;
+EXPECT_10000
+10000
+SELECT COUNT(*) AS EXPECT_10 FROM x2;
+EXPECT_10
+10
+connection node_1;
+set wsrep_on=1;
+DROP TABLE t1, t2, x1, x2;
diff --git a/mysql-test/suite/galera/r/galera_forced_binlog_format.result b/mysql-test/suite/galera/r/galera_forced_binlog_format.result
new file mode 100644
index 00000000..4132d32c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_forced_binlog_format.result
@@ -0,0 +1,36 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+FLUSH BINARY LOGS;
+SET SESSION binlog_format = 'STATEMENT';
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET SESSION binlog_format = 'MIXED';
+INSERT INTO t1 VALUES (2);
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 <Pos> Gtid_list 1 <End_log_pos> []
+mysqld-bin.000001 <Pos> Binlog_checkpoint 1 <End_log_pos> mysqld-bin.000001
+mysqld-bin.000001 <Pos> Rotate 1 <End_log_pos> mysqld-bin.000002;pos=4
+DROP TABLE t1;
+#
+# MDEV-9401: wsrep_forced_binlog_format with binlog causes crash
+#
+SET SESSION binlog_format = 'ROW';
+CREATE DATABASE testdb_9401;
+USE testdb_9401;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE USER dummy@localhost;
+GRANT ALL PRIVILEGES ON testdb_9401.t1 TO dummy@localhost;
+FLUSH PRIVILEGES;
+SHOW GRANTS FOR dummy@localhost;
+Grants for dummy@localhost
+GRANT USAGE ON *.* TO `dummy`@`localhost`
+GRANT ALL PRIVILEGES ON `testdb_9401`.`t1` TO `dummy`@`localhost`
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
+DROP USER dummy@localhost;
+DROP DATABASE testdb_9401;
+# End of tests
diff --git a/mysql-test/suite/galera/r/galera_forced_binlog_format_ctas.result b/mysql-test/suite/galera/r/galera_forced_binlog_format_ctas.result
new file mode 100644
index 00000000..cae5f723
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_forced_binlog_format_ctas.result
@@ -0,0 +1,273 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since.*");
+SET GLOBAL wsrep_forced_binlog_format=ROW;
+connection node_1;
+CREATE TABLE t1(a int not null primary key auto_increment, b int) ENGINE=InnoDB;
+CREATE TABLE t2(a int not null primary key, b int) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL,1),(NULL,2);
+INSERT INTO t1(b) SELECT b+1 from t1;
+INSERT INTO t1(b) SELECT b+1 from t1;
+INSERT INTO t1(b) SELECT b+1 from t1;
+INSERT INTO t1(b) SELECT b+1 from t1;
+CREATE TABLE t3 AS SELECT * FROM t1;
+CREATE TABLE t4 AS SELECT * FROM t2;
+CREATE TABLE t5 (a INT UNIQUE) AS SELECT 1 AS a;
+CREATE TABLE t6 (a INT UNIQUE) REPLACE SELECT 1 AS a;
+CREATE TABLE t7 (a INT UNIQUE) REPLACE SELECT 1 AS a,2 AS b UNION SELECT 1 AS a,
+3 AS c;
+SELECT COUNT(*) AS EXPECT_32 FROM t1;
+EXPECT_32
+32
+SELECT COUNT(*) AS EXPECT_0 FROM t2;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_32 FROM t3;
+EXPECT_32
+32
+SELECT * FROM t4;
+a b
+SELECT * FROM t5;
+a
+1
+SELECT * FROM t6;
+a
+1
+SELECT * FROM t7;
+a b
+1 3
+connection node_2;
+# Veryfy CTAS replication
+SELECT COUNT(*) AS EXPECT_32 FROM t1;
+EXPECT_32
+32
+SELECT COUNT(*) AS EXPECT_0 FROM t2;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_32 FROM t3;
+EXPECT_32
+32
+SELECT * FROM t4;
+a b
+SELECT * FROM t5;
+a
+1
+SELECT * FROM t6;
+a
+1
+SELECT * FROM t7;
+a b
+1 3
+connection node_1;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7;
+SET GLOBAL wsrep_forced_binlog_format=STATEMENT;
+connection node_1;
+CREATE TABLE t1(a int not null primary key auto_increment, b int) ENGINE=InnoDB;
+CREATE TABLE t2(a int not null primary key, b int) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL,1),(NULL,2);
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+INSERT INTO t1(b) SELECT b+1 from t1;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+INSERT INTO t1(b) SELECT b+1 from t1;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+INSERT INTO t1(b) SELECT b+1 from t1;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+INSERT INTO t1(b) SELECT b+1 from t1;
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statements writing to a table with an auto-increment column after selecting from another table are unsafe because the order in which rows are retrieved determines what (if any) rows will be written. This order cannot be predicted and may differ on master and the slave
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave
+CREATE TABLE t3 AS SELECT * FROM t1;
+Warnings:
+Warning 1105 Galera does not support wsrep_forced_binlog_format = STMT in CREATE TABLE AS SELECT
+CREATE TABLE t4 AS SELECT * FROM t2;
+Warnings:
+Warning 1105 Galera does not support wsrep_forced_binlog_format = STMT in CREATE TABLE AS SELECT
+CREATE TABLE t5 (a INT UNIQUE) AS SELECT 1 AS a;
+Warnings:
+Warning 1105 Galera does not support wsrep_forced_binlog_format = STMT in CREATE TABLE AS SELECT
+CREATE TABLE t6 (a INT UNIQUE) REPLACE SELECT 1 AS a;
+Warnings:
+Warning 1105 Galera does not support wsrep_forced_binlog_format = STMT in CREATE TABLE AS SELECT
+CREATE TABLE t7 (a INT UNIQUE) REPLACE SELECT 1 AS a,2 AS b UNION SELECT 1 AS a,
+3 AS c;
+Warnings:
+Warning 1105 Galera does not support wsrep_forced_binlog_format = STMT in CREATE TABLE AS SELECT
+SELECT COUNT(*) AS EXPECT_32 FROM t1;
+EXPECT_32
+32
+SELECT COUNT(*) AS EXPECT_0 FROM t2;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_32 FROM t3;
+EXPECT_32
+32
+SELECT * FROM t4;
+a b
+SELECT * FROM t5;
+a
+1
+SELECT * FROM t6;
+a
+1
+SELECT * FROM t7;
+a b
+1 3
+connection node_2;
+# Veryfy CTAS replication
+SELECT COUNT(*) AS EXPECT_32 FROM t1;
+EXPECT_32
+32
+SELECT COUNT(*) AS EXPECT_0 FROM t2;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_32 FROM t3;
+EXPECT_32
+32
+SELECT * FROM t4;
+a b
+SELECT * FROM t5;
+a
+1
+SELECT * FROM t6;
+a
+1
+SELECT * FROM t7;
+a b
+1 3
+connection node_1;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7;
+SET GLOBAL wsrep_forced_binlog_format=MIXED;
+connection node_1;
+CREATE TABLE t1(a int not null primary key auto_increment, b int) ENGINE=InnoDB;
+CREATE TABLE t2(a int not null primary key, b int) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL,1),(NULL,2);
+INSERT INTO t1(b) SELECT b+1 from t1;
+INSERT INTO t1(b) SELECT b+1 from t1;
+INSERT INTO t1(b) SELECT b+1 from t1;
+INSERT INTO t1(b) SELECT b+1 from t1;
+CREATE TABLE t3 AS SELECT * FROM t1;
+Warnings:
+Warning 1105 Galera does not support wsrep_forced_binlog_format = MIXED in CREATE TABLE AS SELECT
+CREATE TABLE t4 AS SELECT * FROM t2;
+Warnings:
+Warning 1105 Galera does not support wsrep_forced_binlog_format = MIXED in CREATE TABLE AS SELECT
+CREATE TABLE t5 (a INT UNIQUE) AS SELECT 1 AS a;
+Warnings:
+Warning 1105 Galera does not support wsrep_forced_binlog_format = MIXED in CREATE TABLE AS SELECT
+CREATE TABLE t6 (a INT UNIQUE) REPLACE SELECT 1 AS a;
+Warnings:
+Warning 1105 Galera does not support wsrep_forced_binlog_format = MIXED in CREATE TABLE AS SELECT
+CREATE TABLE t7 (a INT UNIQUE) REPLACE SELECT 1 AS a,2 AS b UNION SELECT 1 AS a,
+3 AS c;
+Warnings:
+Warning 1105 Galera does not support wsrep_forced_binlog_format = MIXED in CREATE TABLE AS SELECT
+SELECT COUNT(*) AS EXPECT_32 FROM t1;
+EXPECT_32
+32
+SELECT COUNT(*) AS EXPECT_0 FROM t2;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_32 FROM t3;
+EXPECT_32
+32
+SELECT * FROM t4;
+a b
+SELECT * FROM t5;
+a
+1
+SELECT * FROM t6;
+a
+1
+SELECT * FROM t7;
+a b
+1 3
+connection node_2;
+# Veryfy CTAS replication
+SELECT COUNT(*) AS EXPECT_32 FROM t1;
+EXPECT_32
+32
+SELECT COUNT(*) AS EXPECT_0 FROM t2;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_32 FROM t3;
+EXPECT_32
+32
+SELECT * FROM t4;
+a b
+SELECT * FROM t5;
+a
+1
+SELECT * FROM t6;
+a
+1
+SELECT * FROM t7;
+a b
+1 3
+connection node_1;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7;
+SET GLOBAL wsrep_forced_binlog_format=NONE;
+connection node_1;
+CREATE TABLE t1(a int not null primary key auto_increment, b int) ENGINE=InnoDB;
+CREATE TABLE t2(a int not null primary key, b int) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL,1),(NULL,2);
+INSERT INTO t1(b) SELECT b+1 from t1;
+INSERT INTO t1(b) SELECT b+1 from t1;
+INSERT INTO t1(b) SELECT b+1 from t1;
+INSERT INTO t1(b) SELECT b+1 from t1;
+CREATE TABLE t3 AS SELECT * FROM t1;
+CREATE TABLE t4 AS SELECT * FROM t2;
+CREATE TABLE t5 (a INT UNIQUE) AS SELECT 1 AS a;
+CREATE TABLE t6 (a INT UNIQUE) REPLACE SELECT 1 AS a;
+CREATE TABLE t7 (a INT UNIQUE) REPLACE SELECT 1 AS a,2 AS b UNION SELECT 1 AS a,
+3 AS c;
+SELECT COUNT(*) AS EXPECT_32 FROM t1;
+EXPECT_32
+32
+SELECT COUNT(*) AS EXPECT_0 FROM t2;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_32 FROM t3;
+EXPECT_32
+32
+SELECT * FROM t4;
+a b
+SELECT * FROM t5;
+a
+1
+SELECT * FROM t6;
+a
+1
+SELECT * FROM t7;
+a b
+1 3
+connection node_2;
+# Veryfy CTAS replication
+SELECT COUNT(*) AS EXPECT_32 FROM t1;
+EXPECT_32
+32
+SELECT COUNT(*) AS EXPECT_0 FROM t2;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_32 FROM t3;
+EXPECT_32
+32
+SELECT * FROM t4;
+a b
+SELECT * FROM t5;
+a
+1
+SELECT * FROM t6;
+a
+1
+SELECT * FROM t7;
+a b
+1 3
+connection node_1;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7;
diff --git a/mysql-test/suite/galera/r/galera_ftwrl.result b/mysql-test/suite/galera/r/galera_ftwrl.result
new file mode 100644
index 00000000..eae8028a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ftwrl.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT1S";
+FLUSH TABLES WITH READ LOCK;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SHOW TABLES;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SELECT * FROM t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+UNLOCK TABLES;
+SHOW TABLES;
+Tables_in_test
+t1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ftwrl_concurrent.result b/mysql-test/suite/galera/r/galera_ftwrl_concurrent.result
new file mode 100644
index 00000000..d7b396bf
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ftwrl_concurrent.result
@@ -0,0 +1,122 @@
+connection node_2;
+connection node_1;
+connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait=0;
+#
+# Case 1: FTWRL
+#
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+FLUSH TABLES WITH READ LOCK;
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+Variable_name Value
+wsrep_local_state_comment Donor/Desynced
+SET SESSION debug_sync = "wsrep_unlock_global_read_lock_after_resume_and_resync SIGNAL unlock_ready WAIT_FOR unlock_continue";
+UNLOCK TABLES;
+connection node_1_ctrl;
+SET debug_sync = "now WAIT_FOR unlock_ready";
+connect node_1_a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1_a;
+SET SESSION debug_sync = "wsrep_global_read_lock_block_commit_after_pause SIGNAL lock_ready WAIT_FOR lock_continue";
+FLUSH TABLES WITH READ LOCK;
+connection node_1_ctrl;
+SET debug_sync = "now WAIT_FOR lock_ready";
+SET debug_sync = "now SIGNAL unlock_continue";
+connection node_1;
+connection node_1_ctrl;
+SET debug_sync = "now SIGNAL lock_continue";
+connection node_1_a;
+UNLOCK TABLES;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+DROP TABLE t1;
+connection node_1_ctrl;
+SET debug_sync = "RESET";
+#
+# Case 2: BACKUP STAGE
+#
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_DDL;
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+Variable_name Value
+wsrep_local_state_comment Donor/Desynced
+SET SESSION debug_sync = "wsrep_backup_stage_after_resume_and_resync SIGNAL resume_and_resync_ready WAIT_FOR resume_and_resync_continue";
+BACKUP STAGE END;
+connection node_1_ctrl;
+SET debug_sync = "now WAIT_FOR resume_and_resync_ready";
+connection node_1_a;
+BACKUP STAGE START;
+SET SESSION debug_sync = "wsrep_backup_stage_after_desync_and_pause SIGNAL desync_and_pause_ready WAIT_FOR desync_and_pause_continue";
+BACKUP STAGE BLOCK_DDL;
+connection node_1_ctrl;
+SET debug_sync = "now WAIT_FOR desync_and_pause_ready";
+SET debug_sync = "now SIGNAL resume_and_resync_continue";
+connection node_1;
+connection node_1_ctrl;
+SET debug_sync = "now SIGNAL desync_and_pause_continue";
+connection node_1_a;
+BACKUP STAGE END;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+DROP TABLE t1;
+connection node_1_ctrl;
+SET debug_sync = "RESET";
+#
+# Case 3: FTWRL first, BACKUP STAGE second
+#
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+SET SESSION wsrep_sync_wait=0;
+FLUSH TABLES WITH READ LOCK;
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+Variable_name Value
+wsrep_local_state_comment Donor/Desynced
+SET SESSION debug_sync = "wsrep_unlock_global_read_lock_after_resume_and_resync SIGNAL unlock_ready WAIT_FOR unlock_continue";
+UNLOCK TABLES;
+connection node_1_ctrl;
+SET debug_sync = "now WAIT_FOR unlock_ready";
+connection node_1_a;
+BACKUP STAGE START;
+SET SESSION debug_sync = "wsrep_backup_stage_after_desync_and_pause SIGNAL desync_and_pause_ready WAIT_FOR desync_and_pause_continue";
+BACKUP STAGE BLOCK_DDL;
+connection node_1_ctrl;
+SET debug_sync = "now WAIT_FOR desync_and_pause_ready";
+SET debug_sync = "now SIGNAL unlock_continue";
+connection node_1;
+connection node_1_ctrl;
+SET debug_sync = "now SIGNAL desync_and_pause_continue";
+connection node_1_a;
+BACKUP STAGE END;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+DROP TABLE t1;
+connection node_1_ctrl;
+SET debug_sync = "RESET";
+#
+# Case 4: BACKUP STAGE first, then FTWRL
+#
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+BACKUP STAGE START;
+BACKUP STAGE BLOCK_DDL;
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+Variable_name Value
+wsrep_local_state_comment Donor/Desynced
+SET SESSION debug_sync = "wsrep_backup_stage_after_resume_and_resync SIGNAL resume_and_resync_ready WAIT_FOR resume_and_resync_continue";
+BACKUP STAGE END;
+connection node_1_ctrl;
+SET debug_sync = "now WAIT_FOR resume_and_resync_ready";
+connection node_1_a;
+SET SESSION debug_sync = "wsrep_global_read_lock_block_commit_after_pause SIGNAL lock_ready WAIT_FOR lock_continue";
+FLUSH TABLES WITH READ LOCK;
+connection node_1_ctrl;
+SET debug_sync = "now WAIT_FOR lock_ready";
+SET debug_sync = "now SIGNAL resume_and_resync_continue";
+connection node_1;
+connection node_1_ctrl;
+SET debug_sync = "now SIGNAL lock_continue";
+connection node_1_a;
+UNLOCK TABLES;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+DROP TABLE t1;
+connection node_1_ctrl;
+SET debug_sync = "RESET";
diff --git a/mysql-test/suite/galera/r/galera_ftwrl_drain.result b/mysql-test/suite/galera/r/galera_ftwrl_drain.result
new file mode 100644
index 00000000..aa1358a8
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ftwrl_drain.result
@@ -0,0 +1,40 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_1;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
+0
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+FLUSH TABLES WITH READ LOCK;;
+connection node_2;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+connection node_2a;
+connection node_2;
+SET SESSION lock_wait_timeout = 1;
+SET SESSION innodb_lock_wait_timeout=1;
+SET SESSION wait_timeout=1;
+INSERT INTO t1 VALUES (2);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection node_2a;
+UNLOCK TABLES;
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
+1
+INSERT INTO t1 VALUES (3);
+connection node_1;
+SELECT COUNT(*) AS EXPECT_2 FROM t1;
+EXPECT_2
+2
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_fulltext.result b/mysql-test/suite/galera/r/galera_fulltext.result
new file mode 100644
index 00000000..94780f23
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_fulltext.result
@@ -0,0 +1,94 @@
+connection node_2;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB;
+connection node_2;
+SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%';
+COUNT(*) = 13
+1
+connection node_1;
+INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
+connection node_2;
+SELECT COUNT(f2) = 1000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz');
+COUNT(f2) = 1000
+1
+UPDATE t1 SET f2 = 'abcdefjhk';
+connection node_1;
+SELECT COUNT(f2) = 1000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk');
+COUNT(f2) = 1000
+1
+connection node_2;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB;
+connection node_2;
+INSERT INTO t1 (f1) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3;
+connection node_1;
+SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('foobarbaz');
+COUNT(f1) = 1000
+1
+UPDATE t1 SET f1 = 'abcdefjhk';
+connection node_2;
+SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk');
+COUNT(f1) = 1000
+1
+DROP TABLE t1;
+DROP TABLE ten;
+connection node_1;
+SET @value=REPEAT (1,5001);
+CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb;
+INSERT IGNORE INTO t VALUES(@value);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_2;
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_1;
+DROP TABLE t;
+CREATE TABLE t (a VARCHAR(5000)) engine=innodb;
+INSERT IGNORE INTO t VALUES(@value);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_2;
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_1;
+DROP TABLE t;
+connection node_1;
+SET @value=REPEAT (1,5001);
+CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb DEFAULT CHARSET=utf8;
+INSERT IGNORE INTO t VALUES(@value);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_2;
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_1;
+DROP TABLE t;
+CREATE TABLE t (a VARCHAR(5000)) engine=innodb DEFAULT CHARSET=utf8;
+INSERT IGNORE INTO t VALUES(@value);
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_2;
+SELECT COUNT(*) FROM t;
+COUNT(*)
+1
+connection node_1;
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/r/galera_gcache_recover.result b/mysql-test/suite/galera/r/galera_gcache_recover.result
new file mode 100644
index 00000000..72088a54
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gcache_recover.result
@@ -0,0 +1,25 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET SESSION wsrep_sync_wait = 0;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+INSERT INTO t1 VALUES (2);
+Killing server ...
+connection node_1;
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+INSERT INTO t1 VALUES (3);
+connection node_2;
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+connection node_1;
+include/diff_servers.inc [servers=1 2]
+connection node_1;
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+connection node_2;
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result b/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result
new file mode 100644
index 00000000..94825107
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gcache_recover_full_gcache.result
@@ -0,0 +1,36 @@
+connection node_2;
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+Killing server ...
+connection node_1;
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+connection node_2;
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+connection node_2;
+SET SESSION wsrep_sync_wait = 15;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+include/diff_servers.inc [servers=1 2]
+connection node_1;
+DROP TABLE t1;
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+include/assert_grep.inc [not found from cache, falling back to SST]
+connection node_2;
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
diff --git a/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result
new file mode 100644
index 00000000..76f16791
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result
@@ -0,0 +1,139 @@
+connection node_2;
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE PROCEDURE insert_simple ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f1, f2) VALUES (DEFAULT,'abcdef');
+END WHILE;
+END|
+CREATE PROCEDURE insert_multi ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f1) VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT);
+END WHILE;
+END|
+CREATE PROCEDURE insert_transaction ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+SET AUTOCOMMIT = OFF;
+WHILE 1 DO
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+COMMIT;
+END WHILE;
+END|
+CREATE PROCEDURE update_simple ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+UPDATE t1 SET f2 = CONCAT(f2,f2);
+END WHILE;
+END|
+CREATE PROCEDURE insert_1k ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024));
+END WHILE;
+END|
+CREATE PROCEDURE insert_1m ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024));
+END WHILE;
+END|
+CREATE PROCEDURE insert_10m ()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET SESSION wsrep_sync_wait = 0;
+WHILE 1 DO
+INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
+END WHILE;
+END|
+connect node_1_insert_simple, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1_insert_multi, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1_insert_transaction, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1_update_simple, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1_insert_1k, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1_insert_1m, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1_insert_10m, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1_insert_simple;
+CALL insert_simple();;
+connection node_1_insert_multi;
+CALL insert_multi();;
+connection node_1_insert_transaction;
+CALL insert_transaction ();;
+connection node_1_update_simple;
+CALL update_simple ();;
+connection node_1_insert_1k;
+CALL insert_1k ();;
+connection node_1_insert_1m;
+CALL insert_1m ();;
+connection node_1_insert_10m;
+CALL insert_10m ();;
+connection node_2;
+call mtr.add_suppression("Error in Log_event::read_log_event\(\):.*");
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+Killing server ...
+connection node_1_insert_simple;
+ERROR HY000: Lost connection to server during query
+connection node_1_insert_multi;
+ERROR HY000: Lost connection to server during query
+connection node_1_insert_transaction;
+ERROR HY000: Lost connection to server during query
+connection node_1_update_simple;
+ERROR HY000: Lost connection to server during query
+connection node_1_insert_1k;
+ERROR HY000: Lost connection to server during query
+connection node_1_insert_1m;
+ERROR HY000: Lost connection to server during query
+connection node_1_insert_10m;
+ERROR HY000: Lost connection to server during query
+connection node_1;
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+connection node_2;
+Performing --wsrep-recover ...
+Using --wsrep-start-position when starting mysqld ...
+connection node_1;
+include/diff_servers.inc [servers=1 2]
+connection node_1;
+DROP TABLE t1;
+DROP TABLE ten;
+DROP PROCEDURE insert_simple;
+DROP PROCEDURE insert_multi;
+DROP PROCEDURE insert_transaction;
+DROP PROCEDURE update_simple;
+DROP PROCEDURE insert_1k;
+DROP PROCEDURE insert_1m;
+connection node_1;
+call mtr.add_suppression("Error in Log_event::read_log_event\(\):.*");
+CALL mtr.add_suppression("conflict state 7 after post commit");
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
+connection node_2;
+call mtr.add_suppression("Error in Log_event::read_log_event\(\):.*");
+CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
diff --git a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
new file mode 100644
index 00000000..432cf87f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,B INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1);
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1';
+LOCK TABLE t1 WRITE;
+connection node_1;
+FLUSH STATUS;
+INSERT INTO t1 VALUES (2,2);
+INSERT INTO t1 VALUES (3,3);
+INSERT INTO t1 VALUES (4,4);
+INSERT INTO t1(B) SELECT B FROM t1;
+connection node_1a;
+# In node_1 either insert or commit should be stuck
+connection node_2;
+UNLOCK TABLES;
+connection node_1;
+INSERT INTO t1 VALUES (NULL,6);
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_gcs_fragment.result b/mysql-test/suite/galera/r/galera_gcs_fragment.result
new file mode 100644
index 00000000..bdd74904
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gcs_fragment.result
@@ -0,0 +1,37 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 TEXT);
+connection node_2;
+SET GLOBAL wsrep_cluster_address='';
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,gcs_core_after_frag_send';
+connection node_1;
+SET SESSION wsrep_retry_autocommit=0;
+INSERT INTO t1 VALUES (1, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_2;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+INSERT INTO t1 VALUES (2, "bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'signal=gcs_core_after_frag_send';
+connection node_1;
+ERROR HY000: Got error 6 "No such device or address" during COMMIT
+INSERT INTO t1 VALUES (3, "cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
+SELECT * FROM t1;
+f1 f2
+2 bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+3 cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+connection node_2;
+SELECT * FROM t1;
+f1 f2
+2 bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+3 cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result b/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result
new file mode 100644
index 00000000..b97be573
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gcs_max_packet_size.result
@@ -0,0 +1,18 @@
+connection node_2;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 VARCHAR(512) UNIQUE) ENGINE=InnoDB;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+INSERT INTO t2 VALUES (REPEAT('x', 512));
+connection node_2;
+SELECT COUNT(*) = 10000 FROM t1;
+COUNT(*) = 10000
+1
+SELECT LENGTH(f1) = 512 FROM t2 WHERE f1 = REPEAT('x', 512);
+LENGTH(f1) = 512
+1
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_gra_log.result b/mysql-test/suite/galera/r/galera_gra_log.result
new file mode 100644
index 00000000..6060e8d1
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gra_log.result
@@ -0,0 +1,38 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors=0;
+SET SESSION wsrep_on=OFF;
+CREATE TABLE t1 (f1 INTEGER);
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+connection node_2;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
+/*!40019 SET @@session.max_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+ROLLBACK/*!*/;
+use `test`/*!*/;
+SET TIMESTAMP=<TIMESTAMP>/*!*/;
+SET @@session.pseudo_thread_id=<PSEUDO_THREAD_ID>/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1, @@session.system_versioning_insert_history=0/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=latin1,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+CREATE TABLE t1 (f1 INTEGER)
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+Killing server ...
+SET GLOBAL wsrep_ignore_apply_errors = 7;
+DROP TABLE t1;
+CALL mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on");
diff --git a/mysql-test/suite/galera/r/galera_gtid.result b/mysql-test/suite/galera/r/galera_gtid.result
new file mode 100644
index 00000000..3f5c5960
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gtid.result
@@ -0,0 +1,14 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+connection node_2;
+UPDATE t1 SET f1 = 2;
+connection node_1;
+SET SESSION wsrep_sync_wait = 15;
+SELECT * from t1;
+f1
+2
+gtid_binlog_state_equal
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_gtid_server_id.result b/mysql-test/suite/galera/r/galera_gtid_server_id.result
new file mode 100644
index 00000000..8765fcc1
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gtid_server_id.result
@@ -0,0 +1,83 @@
+connection node_2;
+connection node_1;
+connection node_1;
+select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode;
+@@gtid_domain_id @@server_id @@wsrep_gtid_domain_id @@wsrep_gtid_mode
+0 11 1 1
+connection node_2;
+call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
+select @@gtid_domain_id, @@server_id, @@wsrep_gtid_domain_id,@@wsrep_gtid_mode;
+@@gtid_domain_id @@server_id @@wsrep_gtid_domain_id @@wsrep_gtid_mode
+0 12 1 1
+connection node_1;
+CREATE TABLE t1(id int not null primary key) engine=innodb;
+INSERT INTO t1 values (1);
+show global variables like '%gtid%';
+Variable_name Value
+gtid_binlog_pos 1-11-2
+gtid_binlog_state 1-11-2
+gtid_cleanup_batch_size 64
+gtid_current_pos 1-11-2
+gtid_domain_id 0
+gtid_ignore_duplicates OFF
+gtid_pos_auto_engines
+gtid_slave_pos
+gtid_strict_mode OFF
+wsrep_gtid_domain_id 1
+wsrep_gtid_mode ON
+connection node_2;
+SET SESSION wsrep_sync_wait=15;
+show global variables like '%gtid%';
+Variable_name Value
+gtid_binlog_pos 0-12-1,1-11-2
+gtid_binlog_state 0-12-1,1-11-2
+gtid_cleanup_batch_size 64
+gtid_current_pos 0-12-1
+gtid_domain_id 0
+gtid_ignore_duplicates OFF
+gtid_pos_auto_engines
+gtid_slave_pos
+gtid_strict_mode OFF
+wsrep_gtid_domain_id 1
+wsrep_gtid_mode ON
+SET GLOBAL server_id=200;
+ERROR 42000: Variable 'server_id' can't be set to the value of '200'
+SHOW WARNINGS;
+Level Code Message
+Warning 1231 Can't change server_id because wsrep and wsrep_gtid_mode is set. You can set server_id only with wsrep_new_cluster.
+Error 1231 Variable 'server_id' can't be set to the value of '200'
+SET SESSION server_id=200;
+ERROR 42000: Variable 'server_id' can't be set to the value of '200'
+SHOW WARNINGS;
+Level Code Message
+Warning 1231 Can't change server_id because wsrep and wsrep_gtid_mode is set. You can set server_id only with wsrep_new_cluster.
+Error 1231 Variable 'server_id' can't be set to the value of '200'
+INSERT INTO t1 values(2);
+show global variables like '%gtid%';
+Variable_name Value
+gtid_binlog_pos 0-12-1,1-11-3
+gtid_binlog_state 0-12-1,1-11-3
+gtid_cleanup_batch_size 64
+gtid_current_pos 0-12-1
+gtid_domain_id 0
+gtid_ignore_duplicates OFF
+gtid_pos_auto_engines
+gtid_slave_pos
+gtid_strict_mode OFF
+wsrep_gtid_domain_id 1
+wsrep_gtid_mode ON
+connection node_1;
+show global variables like '%gtid%';
+Variable_name Value
+gtid_binlog_pos 1-11-3
+gtid_binlog_state 1-11-3
+gtid_cleanup_batch_size 64
+gtid_current_pos 1-11-3
+gtid_domain_id 0
+gtid_ignore_duplicates OFF
+gtid_pos_auto_engines
+gtid_slave_pos
+gtid_strict_mode OFF
+wsrep_gtid_domain_id 1
+wsrep_gtid_mode ON
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_gtid_slave.result b/mysql-test/suite/galera/r/galera_gtid_slave.result
new file mode 100644
index 00000000..d460d169
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gtid_slave.result
@@ -0,0 +1,45 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
+START SLAVE;
+connection node_3;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+begin;
+insert into t2 values(21);
+insert into t2 values(22);
+commit;
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+2-3-4
+connection node_2;
+INSERT INTO t1 VALUES(2);
+INSERT INTO t1 VALUES(3);
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+1-1-2,2-3-4
+connection node_1;
+INSERT INTO t1 VALUES(4);
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+1-1-3,2-3-4
+connection node_3;
+DROP TABLE t1,t2;
+connection node_2;
+connection node_1;
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
+SET GLOBAL wsrep_on=OFF;
+reset master;
+SET GLOBAL wsrep_on=ON;
+connection node_1;
+SET GLOBAL wsrep_on=OFF;
+reset master;
+SET GLOBAL wsrep_on=ON;
+connection node_3;
+reset master;
+connection node_2;
+CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
diff --git a/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result
new file mode 100644
index 00000000..f41e3abc
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gtid_slave_sst_rsync.result
@@ -0,0 +1,170 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+#Connection 2
+connection node_2;
+START SLAVE;
+#Connection 3
+connection node_3;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 int unique) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(1,11);
+INSERT INTO t2 VALUES(2,22);
+INSERT INTO t2 VALUES(3,33);
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+2-3-4
+include/save_master_gtid.inc
+#Connection 2
+connection node_2;
+include/sync_with_master_gtid.inc
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+2-3-4
+INSERT INTO t2 VALUES(4,44);
+INSERT INTO t2 VALUES(5,55);
+INSERT INTO t2 VALUES(6,66);
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+1-1-3,2-3-4
+#Connection 1
+connection node_1;
+INSERT INTO t2 VALUES(7,77);
+INSERT INTO t2 VALUES(8,88);
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+1-1-5,2-3-4
+#Connection 3
+connection node_3;
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+include/save_master_gtid.inc
+#Connection 2
+connection node_2;
+include/sync_with_master_gtid.inc
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+#Connection 1
+connection node_1;
+connection node_1;
+connection node_2;
+#Connection 2
+connection node_2;
+Shutting down server ...
+#Connection 1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+#Connection 2
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+#Connection 1
+connection node_1;
+Select * from t1 order by f1;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_during
+node1_committed_during
+node2_committed_after
+node2_committed_after
+node2_committed_before
+node2_committed_before
+#Connection 2
+connection node_2;
+Select * from t1 order by f1;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_during
+node1_committed_during
+node2_committed_after
+node2_committed_after
+node2_committed_before
+node2_committed_before
+#Connection 1
+connection node_1;
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+1-1-8,2-3-6
+#Connection 2
+connection node_2;
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+1-1-8,2-3-6
+#Connection 3
+connection node_3;
+SET AUTOCOMMIT=ON;
+#Connection 2
+connection node_2;
+SET AUTOCOMMIT=ON;
+#Connection 1
+connection node_1;
+SET AUTOCOMMIT=ON;
+#Connection 2
+connection node_2;
+STOP slave;
+INSERT INTO t1 VALUES ('node2_slave_stoped');
+#Connection 3
+connection node_3;
+INSERT INTO t1 VALUES ('node3_normal_entry');
+include/save_master_gtid.inc
+#Connection 2
+connection node_2;
+INSERT INTO t1 VALUES ('node2_slave_stoped_inserted');
+start slave;
+include/sync_with_master_gtid.inc
+INSERT INTO t1 VALUES ('node2_slave_started');
+SELECT count(*) from t1;
+count(*)
+12
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+1-1-11,2-3-7
+#Connection 1
+connection node_1;
+SELECT count(*) from t1;
+count(*)
+12
+SELECT @@global.gtid_binlog_state;
+@@global.gtid_binlog_state
+1-1-11,2-3-7
+#Connection 3
+connection node_3;
+DROP TABLE t2,t1;
+#Connection 2
+connection node_2;
+#Connection 1
+connection node_1;
+#Connection 2
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+set global gtid_slave_pos="";
+#Connection 1
+connection node_1;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+#Connection 3
+connection node_3;
+reset master;
+connection node_2;
+CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
diff --git a/mysql-test/suite/galera/r/galera_gtid_trx_conflict.result b/mysql-test/suite/galera/r/galera_gtid_trx_conflict.result
new file mode 100644
index 00000000..602816f1
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_gtid_trx_conflict.result
@@ -0,0 +1,45 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_1;
+SET AUTOCOMMIT = OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES(1);
+connection node_2;
+SET AUTOCOMMIT = OFF;
+SET @@wsrep_gtid_seq_no = 100;
+START TRANSACTION;
+INSERT INTO t1 VALUES(1);
+connection node_1;
+COMMIT;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+# Expected GTID value 1-1-2 on both nodes
+SELECT @@gtid_binlog_state;
+@@gtid_binlog_state
+1-1-2
+SET AUTOCOMMIT = ON;
+INSERT INTO t1 VALUES(2);
+# Expected GTID value 1-1-100 on both nodes, seqno is set with wsrep_gtid_seq_no
+SELECT @@gtid_binlog_state;
+@@gtid_binlog_state
+1-1-100
+connection node_1;
+SELECT @@gtid_binlog_state;
+@@gtid_binlog_state
+1-1-100
+SET AUTOCOMMIT = ON;
+INSERT INTO t1 VALUES(3);
+# Expected GTID value 1-1-101 on both nodes
+SELECT @@gtid_binlog_state;
+@@gtid_binlog_state
+1-1-101
+connection node_2;
+SELECT @@gtid_binlog_state;
+@@gtid_binlog_state
+1-1-101
+DROP TABLE t1;
+CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
diff --git a/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result b/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result
new file mode 100644
index 00000000..eeacc9ab
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1(id int not null primary key, b int) engine=InnoDB;
+INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3);
+BEGIN;
+UPDATE t1 set b = 100 where id between 1 and 2;;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1b;
+SET @save_dbug = @@SESSION.debug_dbug;
+SET @@SESSION.innodb_lock_wait_timeout=2;
+SET @@SESSION.debug_dbug = '+d,wsrep_instrument_BF_lock_wait';
+UPDATE t1 set b = 200 WHERE id = 1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SET @@SESSION.debug_dbug = @save_dbug;
+connection node_1;
+COMMIT;
+SELECT * FROM t1;
+id b
+0 0
+1 100
+2 100
+3 3
+disconnect node_1b;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_insert_bulk.result b/mysql-test/suite/galera/r/galera_insert_bulk.result
new file mode 100644
index 00000000..f4d4adf6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_insert_bulk.result
@@ -0,0 +1,30 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET foreign_key_checks = 0;
+SET unique_checks = 0;
+START TRANSACTION;
+connection node_2;
+SET foreign_key_checks = 1;
+SET unique_checks = 1;
+INSERT INTO t1 VALUES (1001);
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+START TRANSACTION;
+connection node_2;
+SET foreign_key_checks = 1;
+SET unique_checks = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1001);
+connection node_1;
+COMMIT;
+2
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_insert_ignore.result b/mysql-test/suite/galera/r/galera_insert_ignore.result
new file mode 100644
index 00000000..41752424
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_insert_ignore.result
@@ -0,0 +1,63 @@
+connection node_2;
+connection node_1;
+SET GLOBAL wsrep_sync_wait = 15;
+connection node_2;
+SET GLOBAL wsrep_sync_wait = 15;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1), (2);
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+SELECT * FROM t1;
+f1
+1
+2
+connection node_2;
+SELECT * FROM t1;
+f1
+1
+2
+connection node_2;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (0), (2), (3);
+INSERT IGNORE INTO t1 SELECT f1 FROM t2;
+Warnings:
+Warning 1062 Duplicate entry '2' for key 'PRIMARY'
+SELECT * FROM t1;
+f1
+0
+1
+2
+3
+connection node_1;
+SELECT * FROM t1;
+f1
+0
+1
+2
+3
+connection node_2;
+CREATE TABLE t3 (f1 INTEGER UNIQUE) Engine=InnoDB;
+INSERT INTO t3 VALUES (NULL);
+connection node_1;
+INSERT IGNORE INTO t3 VALUES (1), (NULL), (2);
+SELECT * FROM t3;
+f1
+NULL
+NULL
+1
+2
+connection node_2;
+SELECT * FROM t3;
+f1
+NULL
+NULL
+1
+2
+SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait);
+connection node_1;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait);
diff --git a/mysql-test/suite/galera/r/galera_insert_multi.result b/mysql-test/suite/galera/r/galera_insert_multi.result
new file mode 100644
index 00000000..d7a4f018
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_insert_multi.result
@@ -0,0 +1,79 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2);
+connection node_2;
+INSERT INTO t1 VALUES (3),(4);
+connection node_1;
+SELECT COUNT(*) = 4 FROM t1;
+COUNT(*) = 4
+1
+connection node_2;
+SELECT COUNT(*) = 4 FROM t1;
+COUNT(*) = 4
+1
+DROP TABLE t1;
+connection node_2;
+CREATE TABLE t1 (f1 INTEGER, KEY (f1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(1);
+connection node_1;
+INSERT INTO t1 VALUES (2),(2);
+connection node_2;
+SELECT COUNT(*) = 4 FROM t1;
+COUNT(*) = 4
+1
+connection node_1;
+SELECT COUNT(*) = 4 FROM t1;
+COUNT(*) = 4
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT = OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1), (2);
+connection node_2;
+SET AUTOCOMMIT = OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2), (1);
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+INSERT INTO t1 VALUES (1), (2);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1), (2);
+connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2), (1);
+connection node_1;
+ROLLBACK;
+connection node_2;
+COMMIT;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+connection node_1;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff
new file mode 100644
index 00000000..4eda9d7d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff
@@ -0,0 +1,190 @@
+--- suite/galera/r/galera_ist_MDEV-28423.result 2022-06-13 09:40:33.073863796 +0300
++++ suite/galera/r/galera_ist_MDEV-28423.reject 2022-06-13 09:58:59.936874991 +0300
+@@ -517,3 +517,187 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result
new file mode 100644
index 00000000..5a71b490
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result
@@ -0,0 +1,519 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been temporarily disconnected
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Unloading wsrep provider ...
+SET GLOBAL wsrep_cluster_address = '';
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Loading wsrep provider ...
+disconnect node_2;
+connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_disconnect_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff
new file mode 100644
index 00000000..1c339163
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff
@@ -0,0 +1,190 @@
+--- suite/galera/r/galera_ist_MDEV-28583.result 2022-06-11 10:48:16.875034382 +0300
++++ suite/galera/r/galera_ist_MDEV-28583,debug.reject 2022-06-11 11:25:55.616481509 +0300
+@@ -517,3 +517,187 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result
new file mode 100644
index 00000000..5a71b490
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result
@@ -0,0 +1,519 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been temporarily disconnected
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Unloading wsrep provider ...
+SET GLOBAL wsrep_cluster_address = '';
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Loading wsrep provider ...
+disconnect node_2;
+connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_disconnect_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff
new file mode 100644
index 00000000..adf12c23
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff
@@ -0,0 +1,190 @@
+--- r/galera_ist_mariabackup.result 2021-04-10 14:21:16.141724901 +0300
++++ r/galera_ist_mariabackup,debug.reject 2021-04-10 14:49:04.455785652 +0300
+@@ -517,3 +517,187 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup.result b/mysql-test/suite/galera/r/galera_ist_mariabackup.result
new file mode 100644
index 00000000..5a71b490
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_mariabackup.result
@@ -0,0 +1,519 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been temporarily disconnected
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Unloading wsrep provider ...
+SET GLOBAL wsrep_cluster_address = '';
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Loading wsrep provider ...
+disconnect node_2;
+connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_disconnect_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff
new file mode 100644
index 00000000..c9457d70
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff
@@ -0,0 +1,190 @@
+--- r/galera_ist_mariabackup_innodb_flush_logs.result 2021-04-10 14:21:52.661886653 +0300
++++ r/galera_ist_mariabackup_innodb_flush_logs,debug.reject 2021-04-10 14:49:56.740062774 +0300
+@@ -172,3 +172,187 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs.result b/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs.result
new file mode 100644
index 00000000..2060698b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs.result
@@ -0,0 +1,174 @@
+connection node_2;
+connection node_1;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff
new file mode 100644
index 00000000..3ee121fd
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff
@@ -0,0 +1,200 @@
+--- r/galera_ist_mysqldump.result
++++ r/galera_ist_mysqldump,debug.reject
+@@ -354,11 +354,195 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
+ connection node_1;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
++connection node_1;
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ DROP USER sst;
+ connection node_2;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+ CALL mtr.add_suppression("Can't open and lock time zone table");
+ CALL mtr.add_suppression("Can't open and lock privilege tables");
diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump,release.rdiff b/mysql-test/suite/galera/r/galera_ist_mysqldump,release.rdiff
new file mode 100644
index 00000000..5cd6f4a3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_mysqldump,release.rdiff
@@ -0,0 +1,15 @@
+--- r/galera_ist_mysqldump.result
++++ r/galera_ist_mysqldump.reject
+@@ -355,10 +355,10 @@
+ DROP TABLE t1;
+ COMMIT;
+ connection node_1;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ DROP USER sst;
+ connection node_2;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+ CALL mtr.add_suppression("Can't open and lock time zone table");
+ CALL mtr.add_suppression("Can't open and lock privilege tables");
diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump.result b/mysql-test/suite/galera/r/galera_ist_mysqldump.result
new file mode 100644
index 00000000..6c57a571
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_mysqldump.result
@@ -0,0 +1,367 @@
+connection node_2;
+connection node_1;
+Setting SST method to mysqldump ...
+call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
+call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
+connection node_1;
+CREATE USER 'sst';
+GRANT ALL PRIVILEGES ON *.* TO 'sst';
+SET GLOBAL wsrep_sst_auth = 'sst:';
+connection node_2;
+SET GLOBAL wsrep_sst_method = 'mysqldump';
+call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*");
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+connection node_1;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+DROP USER sst;
+connection node_2;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+CALL mtr.add_suppression("Can't open and lock time zone table");
+CALL mtr.add_suppression("Can't open and lock privilege tables");
+CALL mtr.add_suppression("Info table is not ready to be used");
+CALL mtr.add_suppression("Native table .* has the wrong structure");
+CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
diff --git a/mysql-test/suite/galera/r/galera_ist_progress.result b/mysql-test/suite/galera/r/galera_ist_progress.result
new file mode 100644
index 00000000..16772271
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_progress.result
@@ -0,0 +1,29 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
+connection node_1;
+connection node_2;
+SET SESSION wsrep_on = OFF;
+SET SESSION wsrep_on = ON;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+connection node_2;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
+connection node_1;
+connection node_2;
+connection node_1;
+"Trying to find IST progress reporting"
+found
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ist_recv_bind.result b/mysql-test/suite/galera/r/galera_ist_recv_bind.result
new file mode 100644
index 00000000..be72aa60
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_recv_bind.result
@@ -0,0 +1,23 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SELECT @@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%';
+@@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%'
+1
+connection node_2;
+SELECT @@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%';
+@@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%'
+1
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
+connection node_1;
+connection node_2;
+SET SESSION wsrep_on = OFF;
+SET SESSION wsrep_on = ON;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
+connection node_1;
+connection node_2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ist_restart_joiner.result b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
new file mode 100644
index 00000000..2f78c475
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_restart_joiner.result
@@ -0,0 +1,50 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a');
+connection node_2;
+SET SESSION wsrep_sync_wait=0;
+Unloading wsrep provider ...
+SET GLOBAL wsrep_cluster_address = '';
+connection node_1;
+UPDATE t1 SET f2 = 'b' WHERE f1 > 1;
+UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
+connection node_2;
+Loading wsrep_provider ...
+SET SESSION wsrep_on=OFF;
+SET SESSION wsrep_on=ON;
+connection node_1;
+UPDATE t1 SET f2 = 'd' WHERE f1 > 3;
+connection node_2;
+Killing server ...
+connection node_1;
+UPDATE t1 SET f2 = 'e' WHERE f1 > 4;
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+connection node_1;
+UPDATE t1 SET f2 = 'f' WHERE f1 > 5;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+4 d
+5 e
+6 f
+connection node_2;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+4 d
+5 e
+6 f
+connection node_1;
+DROP TABLE t1;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff
new file mode 100644
index 00000000..e76b3783
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff
@@ -0,0 +1,190 @@
+--- r/galera_ist_rsync.result 2021-04-10 14:24:05.942467091 +0300
++++ r/galera_ist_rsync,debug.reject 2021-04-10 14:52:14.236776538 +0300
+@@ -517,3 +517,187 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result
new file mode 100644
index 00000000..5a71b490
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ist_rsync.result
@@ -0,0 +1,519 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been temporarily disconnected
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Unloading wsrep provider ...
+SET GLOBAL wsrep_cluster_address = '';
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Loading wsrep provider ...
+disconnect node_2;
+connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_disconnect_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_kill_applier.result b/mysql-test/suite/galera/r/galera_kill_applier.result
new file mode 100644
index 00000000..a47f486b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_kill_applier.result
@@ -0,0 +1,30 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SELECT @@wsrep_slave_threads;
+@@wsrep_slave_threads
+1
+SET GLOBAL wsrep_slave_threads=2;
+KILL ID;
+Got one of the listed errors
+KILL QUERY ID;
+Got one of the listed errors
+KILL ID;
+Got one of the listed errors
+KILL QUERY ID;
+Got one of the listed errors
+SET GLOBAL wsrep_slave_threads=DEFAULT;
+connection node_1;
+create table t1(a int not null primary key) engine=innodb;
+insert into t1 values (1);
+insert into t1 values (2);
+connection node_2;
+# Wait until one of the appliers has exited
+select count(*) from t1;
+count(*)
+2
+SELECT @@wsrep_slave_threads;
+@@wsrep_slave_threads
+1
+connection node_1;
+drop table t1;
diff --git a/mysql-test/suite/galera/r/galera_kill_ddl.result b/mysql-test/suite/galera/r/galera_kill_ddl.result
new file mode 100644
index 00000000..33a1b190
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_kill_ddl.result
@@ -0,0 +1,19 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: Last Applied Action message in non-primary configuration from member .*");
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+Killing server ...
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+connection node_2a;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1';
+COUNT(*)
+2
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_kill_group_commit.result b/mysql-test/suite/galera/r/galera_kill_group_commit.result
new file mode 100644
index 00000000..bb59ce14
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_kill_group_commit.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+connect node_1_kill, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait = 0;
+connect node_1_follower, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION DEBUG_SYNC = "commit_before_enqueue SIGNAL leader_before_enqueue_reached WAIT_FOR leader_before_enqueue_continue";
+INSERT INTO t1 VALUES (1);
+connection node_1_ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR leader_before_enqueue_reached";
+connection node_1_follower;
+INSERT INTO t1 VALUES (2);;
+connection node_1_ctrl;
+connection node_1_kill;
+# Execute KILL QUERY for group commit follower
+SET DEBUG_SYNC = "now SIGNAL leader_before_enqueue_continue";
+connection node_1_follower;
+connection node_1;
+SELECT * FROM t1;
+f1
+1
+2
+SET DEBUG_SYNC = "RESET";
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_kill_nochanges.result b/mysql-test/suite/galera/r/galera_kill_nochanges.result
new file mode 100644
index 00000000..f7478e29
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_kill_nochanges.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+Killing server ...
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_sync_wait = DEFAULT;
+connection node_2;
+connection node_2a;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE
+2
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_kill_smallchanges.result b/mysql-test/suite/galera/r/galera_kill_smallchanges.result
new file mode 100644
index 00000000..9d52de58
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_kill_smallchanges.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+connection node_2;
+Killing server ...
+connection node_1;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+connection node_2a;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_last_committed_id.result b/mysql-test/suite/galera/r/galera_last_committed_id.result
new file mode 100644
index 00000000..1a1339ed
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_last_committed_id.result
@@ -0,0 +1,37 @@
+connection node_2;
+connection node_1;
+SELECT WSREP_LAST_WRITTEN_GTID();
+WSREP_LAST_WRITTEN_GTID()
+100-1-0
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;;
+connection node_1a;
+SELECT WSREP_LAST_WRITTEN_GTID() != '100-1-2' AS wsrep_written_does_not_match_different_conn;
+wsrep_written_does_not_match_different_conn
+1
+connection node_2;
+SELECT WSREP_LAST_WRITTEN_GTID() != '100-1-2' AS wsrep_written_does_not_match_different_nodes;
+wsrep_written_does_not_match_different_nodes
+1
+connection node_1;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+wsrep_last_written_seen_id_match
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+WSREP_LAST_SEEN_GTID() = '100-1-3'
+1
+wsrep_last_written_id_match
+1
+COMMIT;
+wsrep_last_written_id_advanced
+1
+SET AUTOCOMMIT=ON;
+DROP TABLE t1;
+connection node_2;
+CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
diff --git a/mysql-test/suite/galera/r/galera_load_data.result b/mysql-test/suite/galera/r/galera_load_data.result
new file mode 100644
index 00000000..84e96f8a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_load_data.result
@@ -0,0 +1,57 @@
+connection node_2;
+connection node_1;
+connection node_1;
+create database cardtest02;
+use cardtest02;
+CREATE TABLE cardtest_tbl (
+`id` bigint(18) NOT NULL AUTO_INCREMENT,
+`course` bigint(18) NOT NULL,
+`name` varchar(200) DEFAULT NULL,
+`intro` longtext DEFAULT NULL,
+`introformat` smallint(4) DEFAULT 0,
+`timecreated` bigint(18) NOT NULL,
+`timemodified` bigint(18) NOT NULL,
+`grademethod` varchar(255) DEFAULT NULL,
+`grade` decimal(10,5) DEFAULT NULL,
+`updategradeoncompletion` tinyint(2) DEFAULT 1,
+`competencyoncompletion` varchar(255) DEFAULT NULL,
+`evaluationmethod` varchar(255) DEFAULT NULL,
+`completionmethod` varchar(255) DEFAULT NULL,
+`alloweddates` varchar(1024) DEFAULT NULL,
+`allowedslots` varchar(1024) DEFAULT NULL,
+`permissions` smallint(4) DEFAULT NULL,
+`notifications` varchar(1024) DEFAULT NULL,
+`type` varchar(255) DEFAULT NULL,
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=1324 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;
+LOCK TABLES cardtest_tbl WRITE;
+ALTER TABLE cardtest_tbl DISABLE KEYS;
+Warnings:
+Note 1031 Storage engine InnoDB of the table `cardtest02`.`cardtest_tbl` doesn't have this option
+INSERT INTO cardtest_tbl VALUES (1,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(2,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(3,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(4,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(5,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(6,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(7,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(8,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(9,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(10,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(11,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(12,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(13,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(14,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(15,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(16,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(17,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(18,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(19,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(20,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(21,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(22,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(23,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(24,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(25,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(26,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(27,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(28,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(29,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(30,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(31,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(32,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(33,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(34,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(35,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(36,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(37,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(38,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(39,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(40,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(41,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(42,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(43,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(44,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(45,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(46,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(47,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(48,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(49,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(50,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(51,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(52,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(53,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(54,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(55,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(56,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(57,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(58,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(59,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(60,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(61,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(62,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(63,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(64,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(65,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(66,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(67,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(68,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(69,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(70,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(71,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(72,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(73,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(74,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(75,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(76,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(77,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(78,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(79,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(80,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(81,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(82,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(83,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(84,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(85,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(86,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(87,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(88,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(89,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(90,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(91,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(92,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(93,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(94,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(95,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(96,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(97,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(98,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(99,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(100,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(101,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(102,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(103,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(104,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(105,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(106,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(107,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(108,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(109,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(110,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(111,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(112,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(113,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(114,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(115,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(116,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(117,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(118,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(119,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(120,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(121,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(122,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(123,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(124,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(125,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(126,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(127,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(128,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(129,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(130,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(131,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(132,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(133,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(134,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(135,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(136,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(137,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(138,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(139,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(140,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(141,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(142,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(143,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(144,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(145,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(146,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(147,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(148,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(149,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(150,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(151,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(152,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(153,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(154,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(155,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(156,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(157,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(158,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(159,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(160,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(161,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(162,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(163,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(164,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(165,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(166,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(167,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(168,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(169,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(170,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(171,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(172,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(173,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(174,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(175,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(176,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(177,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(178,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(179,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(180,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(181,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(182,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(183,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(184,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(185,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(186,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(187,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(188,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(189,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(190,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(191,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(192,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(193,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(194,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(195,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(196,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(197,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(198,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(199,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(200,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(201,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(202,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(203,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(204,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(205,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(206,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(207,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(208,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(209,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(210,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(211,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(212,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(213,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(214,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(215,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(216,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(217,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(218,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(219,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(220,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(221,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(222,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(223,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(224,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(225,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(226,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(227,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(228,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(229,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(230,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(231,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(232,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(233,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(234,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(235,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(236,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(237,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(238,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(239,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(240,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(241,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(242,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(243,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(244,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(245,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(246,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(247,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(248,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(249,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(250,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(251,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(252,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(253,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(254,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(255,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(256,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(257,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(258,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(259,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(260,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(261,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(262,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(263,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(264,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(265,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(266,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(267,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(268,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(269,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(270,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(271,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(272,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(273,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(274,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(275,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(276,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(277,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(278,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(279,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(280,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(281,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(282,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(283,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(284,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(285,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(286,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(287,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(288,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(289,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(290,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(291,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(292,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(293,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(294,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(295,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(296,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(297,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(298,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(299,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(300,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL),(301,1,'','',1,1466430455,1471454450,NULL,10.00000,1,NULL,'','',NULL,NULL,1,NULL,NULL);
+ALTER TABLE cardtest_tbl ENABLE KEYS;
+Warnings:
+Note 1031 Storage engine InnoDB of the table `cardtest02`.`cardtest_tbl` doesn't have this option
+UNLOCK TABLES;
+use cardtest02;
+ANALYZE TABLE cardtest_tbl;
+Table Op Msg_type Msg_text
+cardtest02.cardtest_tbl analyze status Engine-independent statistics collected
+cardtest02.cardtest_tbl analyze Warning Engine-independent statistics are not collected for column 'intro'
+cardtest02.cardtest_tbl analyze status OK
+SELECT COUNT(*) AS EXPECT_301 FROM cardtest_tbl;
+EXPECT_301
+301
+connection node_2;
+use cardtest02;
+ANALYZE TABLE cardtest_tbl;
+Table Op Msg_type Msg_text
+cardtest02.cardtest_tbl analyze status Engine-independent statistics collected
+cardtest02.cardtest_tbl analyze Warning Engine-independent statistics are not collected for column 'intro'
+cardtest02.cardtest_tbl analyze status OK
+SELECT COUNT(*) AS EXPECT_301 FROM cardtest_tbl;
+EXPECT_301
+301
+connection node_1;
+use test;
+drop database cardtest02;
diff --git a/mysql-test/suite/galera/r/galera_lock_table.result b/mysql-test/suite/galera/r/galera_lock_table.result
new file mode 100644
index 00000000..c3df1749
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_lock_table.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+NAME
+test/t1
+test/t2
+LOCK TABLE t1 READ;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+connection node_2a;
+SET SESSION wsrep_sync_wait=0;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+connection node_2;
+UNLOCK TABLES;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result b/mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result
new file mode 100644
index 00000000..68691a4e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_lock_tables_in_transaction.result
@@ -0,0 +1,12 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+LOCK TABLES t2 READ;
+ERROR 42S02: Table 'test.t2' doesn't exist
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+LOCK TABLES t1 READ;
+UNLOCK TABLES;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_log_bin.result b/mysql-test/suite/galera/r/galera_log_bin.result
new file mode 100644
index 00000000..31f953bf
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_bin.result
@@ -0,0 +1,81 @@
+connection node_2;
+connection node_1;
+connection node_2;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_1;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+connection node_2;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+DROP TABLE t1;
+DROP TABLE t2;
+#cleanup
+connection node_1;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
diff --git a/mysql-test/suite/galera/r/galera_log_bin_ext.result b/mysql-test/suite/galera/r/galera_log_bin_ext.result
new file mode 100644
index 00000000..9d7ea473
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_bin_ext.result
@@ -0,0 +1,69 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_1;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t1)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t2)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t2)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+connection node_2;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+connection node_2;
+Starting server ...
+connection node_2;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+hostname1-bin.000002 # Binlog_checkpoint # # hostname1-bin.000002
+DROP TABLE t1;
+DROP TABLE t2;
+#cleanup
+connection node_1;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
diff --git a/mysql-test/suite/galera/r/galera_log_bin_ext_mariabackup.result b/mysql-test/suite/galera/r/galera_log_bin_ext_mariabackup.result
new file mode 100644
index 00000000..9d7ea473
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_bin_ext_mariabackup.result
@@ -0,0 +1,69 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_1;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t1)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t2)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # BEGIN GTID #-#-#
+hostname1-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+hostname1-bin.000001 # Table_map # # table_id: # (test.t2)
+hostname1-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+hostname1-bin.000001 # Xid # # COMMIT /* XID */
+hostname1-bin.000001 # Gtid # # GTID #-#-#
+hostname1-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+connection node_2;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+connection node_2;
+Starting server ...
+connection node_2;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+hostname1-bin.000002 # Binlog_checkpoint # # hostname1-bin.000002
+DROP TABLE t1;
+DROP TABLE t2;
+#cleanup
+connection node_1;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
diff --git a/mysql-test/suite/galera/r/galera_log_bin_opt.result b/mysql-test/suite/galera/r/galera_log_bin_opt.result
new file mode 100644
index 00000000..31f953bf
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_bin_opt.result
@@ -0,0 +1,81 @@
+connection node_2;
+connection node_1;
+connection node_2;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_1;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+connection node_2;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; CREATE TABLE t2 (id INT) ENGINE=InnoDB
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # BEGIN GTID #-#-#
+mysqld-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1)
+mysqld-bin.000001 # Table_map # # table_id: # (test.t2)
+mysqld-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid # # COMMIT /* XID */
+mysqld-bin.000001 # Gtid # # GTID #-#-#
+mysqld-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN f2 INTEGER
+DROP TABLE t1;
+DROP TABLE t2;
+#cleanup
+connection node_1;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
diff --git a/mysql-test/suite/galera/r/galera_log_output_csv.result b/mysql-test/suite/galera/r/galera_log_output_csv.result
new file mode 100644
index 00000000..06b0838d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_log_output_csv.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) > 0 FROM mysql.general_log;
+COUNT(*) > 0
+1
+SELECT 1 = 1 FROM t1;
+1 = 1
+1
+SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 1 = 1 FROM t1';
+COUNT(*) = 1
+1
+connection node_2;
+SELECT 2 = 2 FROM t1;
+2 = 2
+1
+SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 2 = 2 FROM t1';
+COUNT(*) = 1
+1
+connection node_1;
+DROP TABLE t1;
+truncate table mysql.slow_log;
+truncate table mysql.general_log;
diff --git a/mysql-test/suite/galera/r/galera_many_columns.result b/mysql-test/suite/galera/r/galera_many_columns.result
new file mode 100644
index 00000000..64e97f11
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_many_columns.result
@@ -0,0 +1,42 @@
+connection node_2;
+connection node_1;
+INSERT INTO t1 (f1) VALUES (DEFAULT);
+connection node_2;
+SELECT f1 = 'ABC', f1017 = 'ABC' FROM t1;
+f1 = 'ABC' f1017 = 'ABC'
+1 1
+UPDATE t1 SET f1 = 'XYZ', f1017 = 'XYZ' ;
+connection node_1;
+SELECT f1 = 'XYZ', f1017 = 'XYZ' FROM t1 WHERE f1 = 'XYZ' AND f1017 = 'XYZ';
+f1 = 'XYZ' f1017 = 'XYZ'
+1 1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'KLM' WHERE f1 = 'XYZ' AND f1017 = 'XYZ';
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'CDE' WHERE f1 = 'XYZ' AND f1017 = 'XYZ';
+COMMIT;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+connection node_2;
+ROLLBACK;
+connection node_1;
+START TRANSACTION;
+INSERT INTO t1 (f1, f1017) VALUES ('BCE','BCE');
+INSERT INTO t1 (f1, f1017) VALUES ('CED','CED');
+INSERT INTO t1 (f1, f1017) VALUES ('EDF','EDF');
+INSERT INTO t1 (f1, f1017) VALUES ('FED','FED');
+ROLLBACK;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_many_indexes.result b/mysql-test/suite/galera/r/galera_many_indexes.result
new file mode 100644
index 00000000..963d3552
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_many_indexes.result
@@ -0,0 +1,137 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 VARCHAR(767) PRIMARY KEY) ENGINE=InnoDB;
+CREATE UNIQUE INDEX i63 ON t1(f1);
+CREATE UNIQUE INDEX i62 ON t1(f1);
+CREATE UNIQUE INDEX i61 ON t1(f1);
+CREATE UNIQUE INDEX i60 ON t1(f1);
+CREATE UNIQUE INDEX i59 ON t1(f1);
+CREATE UNIQUE INDEX i58 ON t1(f1);
+CREATE UNIQUE INDEX i57 ON t1(f1);
+CREATE UNIQUE INDEX i56 ON t1(f1);
+CREATE UNIQUE INDEX i55 ON t1(f1);
+CREATE UNIQUE INDEX i54 ON t1(f1);
+CREATE UNIQUE INDEX i53 ON t1(f1);
+CREATE UNIQUE INDEX i52 ON t1(f1);
+CREATE UNIQUE INDEX i51 ON t1(f1);
+CREATE UNIQUE INDEX i50 ON t1(f1);
+CREATE UNIQUE INDEX i49 ON t1(f1);
+CREATE UNIQUE INDEX i48 ON t1(f1);
+CREATE UNIQUE INDEX i47 ON t1(f1);
+CREATE UNIQUE INDEX i46 ON t1(f1);
+CREATE UNIQUE INDEX i45 ON t1(f1);
+CREATE UNIQUE INDEX i44 ON t1(f1);
+CREATE UNIQUE INDEX i43 ON t1(f1);
+CREATE UNIQUE INDEX i42 ON t1(f1);
+CREATE UNIQUE INDEX i41 ON t1(f1);
+CREATE UNIQUE INDEX i40 ON t1(f1);
+CREATE UNIQUE INDEX i39 ON t1(f1);
+CREATE UNIQUE INDEX i38 ON t1(f1);
+CREATE UNIQUE INDEX i37 ON t1(f1);
+CREATE UNIQUE INDEX i36 ON t1(f1);
+CREATE UNIQUE INDEX i35 ON t1(f1);
+CREATE UNIQUE INDEX i34 ON t1(f1);
+CREATE UNIQUE INDEX i33 ON t1(f1);
+CREATE UNIQUE INDEX i32 ON t1(f1);
+CREATE UNIQUE INDEX i31 ON t1(f1);
+CREATE UNIQUE INDEX i30 ON t1(f1);
+CREATE UNIQUE INDEX i29 ON t1(f1);
+CREATE UNIQUE INDEX i28 ON t1(f1);
+CREATE UNIQUE INDEX i27 ON t1(f1);
+CREATE UNIQUE INDEX i26 ON t1(f1);
+CREATE UNIQUE INDEX i25 ON t1(f1);
+CREATE UNIQUE INDEX i24 ON t1(f1);
+CREATE UNIQUE INDEX i23 ON t1(f1);
+CREATE UNIQUE INDEX i22 ON t1(f1);
+CREATE UNIQUE INDEX i21 ON t1(f1);
+CREATE UNIQUE INDEX i20 ON t1(f1);
+CREATE UNIQUE INDEX i19 ON t1(f1);
+CREATE UNIQUE INDEX i18 ON t1(f1);
+CREATE UNIQUE INDEX i17 ON t1(f1);
+CREATE UNIQUE INDEX i16 ON t1(f1);
+CREATE UNIQUE INDEX i15 ON t1(f1);
+CREATE UNIQUE INDEX i14 ON t1(f1);
+CREATE UNIQUE INDEX i13 ON t1(f1);
+CREATE UNIQUE INDEX i12 ON t1(f1);
+CREATE UNIQUE INDEX i11 ON t1(f1);
+CREATE UNIQUE INDEX i10 ON t1(f1);
+CREATE UNIQUE INDEX i9 ON t1(f1);
+CREATE UNIQUE INDEX i8 ON t1(f1);
+CREATE UNIQUE INDEX i7 ON t1(f1);
+CREATE UNIQUE INDEX i6 ON t1(f1);
+CREATE UNIQUE INDEX i5 ON t1(f1);
+CREATE UNIQUE INDEX i4 ON t1(f1);
+CREATE UNIQUE INDEX i3 ON t1(f1);
+CREATE UNIQUE INDEX i2 ON t1(f1);
+CREATE UNIQUE INDEX i1 ON t1(f1);
+INSERT INTO t1 VALUES (REPEAT('a', 767));
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT LENGTH(f1) = 767 FROM t1;
+LENGTH(f1) = 767
+1
+EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (PRIMARY) WHERE f1 = REPEAT('a', 767);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 769 const 1 Using index
+SELECT COUNT(*) = 1 FROM t1 FORCE KEY (PRIMARY) WHERE f1 = REPEAT('a', 767);
+COUNT(*) = 1
+1
+EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i1) WHERE f1 = REPEAT('a', 767);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const i1 i1 769 const 1 Using index
+SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i1) WHERE f1 = REPEAT('a', 767);
+COUNT(*) = 1
+1
+EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i63) WHERE f1 = REPEAT('a', 767);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const i63 i63 769 const 1 Using index
+SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i63) WHERE f1 = REPEAT('a', 767);
+COUNT(*) = 1
+1
+INSERT INTO t1 VALUES (REPEAT('b', 767));
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+connection node_1;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+DELETE FROM t1 WHERE f1 = REPEAT('b', 767);
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+INSERT INTO t1 (f1) VALUES (REPEAT('c', 767));
+ROLLBACK;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_2;
+START TRANSACTION;
+SET AUTOCOMMIT=OFF;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+START TRANSACTION;
+connection node_2;
+START TRANSACTION;
+connection node_1;
+UPDATE t1 SET f1 = REPEAT('e', 767);
+connection node_2;
+UPDATE t1 SET f1 = REPEAT('f', 767);
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_many_rows.result b/mysql-test/suite/galera/r/galera_many_rows.result
new file mode 100644
index 00000000..b34c2484
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_many_rows.result
@@ -0,0 +1,44 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+SET SESSION innodb_lock_wait_timeout=600;
+SET SESSION lock_wait_timeout=600;
+CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) engine=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
+INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_sync_wait = 15;
+SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT1H';
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+20000
+UPDATE t1 SET f2 = 1;
+connection node_2;
+SELECT COUNT(*) FROM t1 WHERE f2 = 1;
+COUNT(*)
+20000
+connection node_1;
+START TRANSACTION;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+20000
+UPDATE t1 SET f2 = 3;
+connection node_2;
+START TRANSACTION;
+UPDATE t1 SET f2 = 4;
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_many_tables_nopk.result b/mysql-test/suite/galera/r/galera_many_tables_nopk.result
new file mode 100644
index 00000000..d341a181
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_many_tables_nopk.result
@@ -0,0 +1,25 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+COMMIT;
+connection node_2;
+CREATE TABLE sum_table (f1 INTEGER);
+SELECT SUM(f1) = 100 FROM sum_table;
+SUM(f1) = 100
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t100 SET f1 = 3;
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP SCHEMA test;
+CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera/r/galera_many_tables_pk.result b/mysql-test/suite/galera/r/galera_many_tables_pk.result
new file mode 100644
index 00000000..2700df8e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_many_tables_pk.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+SELECT COUNT(*) = 100 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%';
+COUNT(*) = 100
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+COMMIT;
+connection node_2;
+CREATE TABLE sum_table (f1 INTEGER);
+SELECT SUM(f1) = 100 FROM sum_table;
+SUM(f1) = 100
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t100 SET f1 = 3;
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+include/diff_servers.inc [servers=1 2]
+DROP SCHEMA test;
+CREATE SCHEMA test;
diff --git a/mysql-test/suite/galera/r/galera_mdev_10812.result b/mysql-test/suite/galera/r/galera_mdev_10812.result
new file mode 100644
index 00000000..16eacc6b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_mdev_10812.result
@@ -0,0 +1,18 @@
+connection node_2;
+connection node_1;
+#
+# MDEV-10812: On COM_STMT_CLOSE/COM_QUIT, when wsrep_conflict_state
+# is ABORTED, it causes wrong response to be sent to the client
+#
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+CREATE TABLE t1(a INT PRIMARY KEY);
+INSERT INTO t1 VALUES(1),(2),(3);
+START TRANSACTION ;
+UPDATE t1 SET a=a+100;
+connection node_2;
+UPDATE t1 SET a=a+100;
+connection node_1a;
+disconnect node_1a;
+connection node_2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_mdev_13787.result b/mysql-test/suite/galera/r/galera_mdev_13787.result
new file mode 100644
index 00000000..4d077091
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_mdev_13787.result
@@ -0,0 +1,6 @@
+connection node_2;
+connection node_1;
+connection node_1;
+create table t(a int);
+insert into t select 1;
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/r/galera_mdev_15611.result b/mysql-test/suite/galera/r/galera_mdev_15611.result
new file mode 100644
index 00000000..5461f8f0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_mdev_15611.result
@@ -0,0 +1,18 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (
+id int primary key
+);
+CREATE TABLE t2 (
+id int primary key ,
+f_id int DEFAULT NULL, FOREIGN KEY(f_id) REFERENCES t1 (id)
+);
+insert into t1 select 1;
+#Running 200 insert in t2 table
+select count(*) from t2;
+count(*)
+200
+delete from t2;
+delete from t1;
+drop table t2,t1;
diff --git a/mysql-test/suite/galera/r/galera_mdl_race.result b/mysql-test/suite/galera/r/galera_mdl_race.result
new file mode 100644
index 00000000..cf747ed8
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_mdl_race.result
@@ -0,0 +1,44 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+LOCK TABLE t2 WRITE;
+connection node_1;
+SET @@debug_dbug = "d,sync.wsrep_before_mdl_wait";
+SELECT * FROM t2;;
+connection node_1a;
+SET @@debug_dbug = "d,sync.wsrep_after_BF_victim_lock";
+connection node_2;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 1;
+connection node_1a;
+SET @@debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_before_mdl_wait";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_after_BF_victim_lock";
+UNLOCK TABLES;
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+DROP TABLE t1;
+DROP TABLE t2;
+connection node_1a;
+SET DEBUG_SYNC = "RESET";
diff --git a/mysql-test/suite/galera/r/galera_multi_database.result b/mysql-test/suite/galera/r/galera_multi_database.result
new file mode 100644
index 00000000..a9d58d5d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_multi_database.result
@@ -0,0 +1,35 @@
+connection node_2;
+connection node_1;
+CREATE DATABASE d1;
+CREATE TABLE d1.t1(f1 INTEGER) ENGINE=InnoDB;
+CREATE DATABASE d2;
+CREATE TABLE d2.t1(f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO d1.t1 VALUES (1);
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO d2.t1 VALUES (1);
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+SELECT COUNT(*) = 1 FROM d1.t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM d2.t1;
+COUNT(*) = 1
+1
+connection node_1;
+SELECT COUNT(*) = 1 FROM d1.t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM d2.t1;
+COUNT(*) = 1
+1
+DROP TABLE d1.t1;
+DROP TABLE d2.t1;
+DROP DATABASE d1;
+DROP DATABASE d2;
diff --git a/mysql-test/suite/galera/r/galera_multirow_rollback.result b/mysql-test/suite/galera/r/galera_multirow_rollback.result
new file mode 100644
index 00000000..13502d0d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_multirow_rollback.result
@@ -0,0 +1,73 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
+connection node_1;
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES ('a'), ('b');
+ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
+COMMIT;
+SELECT COUNT(*) AS expect_0 FROM t1;
+expect_0
+0
+connection node_2;
+SELECT COUNT(*) AS expect_0 FROM t1;
+expect_0
+0
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
+connection node_1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'b');
+INSERT INTO t1 (f2) VALUES ('c'), ('d');
+ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
+COMMIT;
+expect (1,'a'), (2, 'b')
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+connection node_2;
+expect (1,'a'), (2, 'b')
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12));
+connection node_1;
+INSERT INTO t1 (f2) VALUES ('a'),('b');
+ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
+SELECT COUNT(*) AS expect_0 FROM t1;
+expect_0
+0
+connection node_2;
+SELECT COUNT(*) AS expect_0 FROM t1;
+expect_0
+0
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB;
+CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB;
+ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id);
+INSERT INTO p VALUES(1, 0);
+START TRANSACTION;
+INSERT INTO c VALUES (3,1);
+INSERT INTO c VALUES (1,1), (2,2);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`c`, CONSTRAINT `c_ibfk_1` FOREIGN KEY (`fk1`) REFERENCES `p` (`id`))
+COMMIT;
+SELECT * FROM p;
+id j
+1 0
+SELECT * FROM c;
+id fk1
+3 1
+connection node_2;
+SELECT * FROM p;
+id j
+1 0
+SELECT * FROM c;
+id fk1
+3 1
+DROP TABLE c;
+DROP TABLE p;
diff --git a/mysql-test/suite/galera/r/galera_myisam_autocommit.result b/mysql-test/suite/galera/r/galera_myisam_autocommit.result
new file mode 100644
index 00000000..6213e8f6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_myisam_autocommit.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2), (3);
+INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (2), (3);
+INSERT INTO t2 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
+INSERT INTO t2 VALUES (6), (1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+UPDATE t1 SET f1 = 9;
+UPDATE t2 SET f1 = 9 WHERE f1 = 1;
+DELETE FROM t1 WHERE f1 = 9;
+DELETE FROM t2 WHERE f1 = 9;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t1;
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_myisam_transactions.result b/mysql-test/suite/galera/r/galera_myisam_transactions.result
new file mode 100644
index 00000000..6afcda47
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_myisam_transactions.result
@@ -0,0 +1,50 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE t3 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (NEW.f1);
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+COMMIT;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+connection node_1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+DROP TABLE t1, t2, t3;
+SET SESSION lock_wait_timeout=2;
+SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
+CREATE TEMPORARY TABLE t1 (i INT, PRIMARY KEY pk (i)) ENGINE=MyISAM;
+Warnings:
+Warning 1280 Name 'pk' ignored for PRIMARY key.
+PREPARE stmt FROM "INSERT INTO t1 (id) SELECT * FROM (SELECT 4 AS i) AS y";
+INSERT INTO t1 VALUES(4);
+DEALLOCATE PREPARE stmt;
+COMMIT;
+DROP TABLE t1;
+SET GLOBAL wsrep_mode = DEFAULT;
diff --git a/mysql-test/suite/galera/r/galera_nonPK_and_PA.result b/mysql-test/suite/galera/r/galera_nonPK_and_PA.result
new file mode 100644
index 00000000..5ad55417
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_nonPK_and_PA.result
@@ -0,0 +1,63 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 VARCHAR(32) NOT NULL) ENGINE=InnoDB;
+INSERT INTO t1 (f1) VALUES ('0e66c5227a8a');
+INSERT INTO t1 (f1) VALUES ('c6c112992c9');
+CREATE TABLE t2 (i int primary key);
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_slave_threads = 2;
+***************************************************************
+scenario 1, conflicting UPDATE
+***************************************************************
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_slave_enter_sync';
+connection node_1;
+START TRANSACTION;
+UPDATE t1 SET f1='5ffceebfada' WHERE t1.f1 = 'c6c112992c9';
+COMMIT;
+connection node_2;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+connection node_1;
+START TRANSACTION;
+UPDATE t1 SET f1='4ffceebfcdc' WHERE t1.f1 = '0e66c5227a8a';
+COMMIT;
+connection node_2;
+distance
+1
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+***************************************************************
+scenario 2, conflicting DELETE
+***************************************************************
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_slave_enter_sync';
+connection node_1;
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+DELETE FROM t1 WHERE f1='5ffceebfada';
+COMMIT;
+connection node_2;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+connection node_1;
+START TRANSACTION;
+INSERT INTO t2 VALUES (2);
+DELETE FROM t1 WHERE f1='4ffceebfcdc';
+COMMIT;
+connection node_2;
+distance
+1
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+SET GLOBAL wsrep_slave_threads = DEFAULT;
+DROP TABLE t1;
+DROP TABLE t2;
+connection node_2;
+SET GLOBAL wsrep_slave_threads = DEFAULT;
diff --git a/mysql-test/suite/galera/r/galera_nopk_bit.result b/mysql-test/suite/galera/r/galera_nopk_bit.result
new file mode 100644
index 00000000..97ded793
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_nopk_bit.result
@@ -0,0 +1,35 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 BIT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL),(0),(b'1');
+connection node_2;
+SELECT f1 IS NULL, f1 = b'1' FROM t1;
+f1 IS NULL f1 = b'1'
+1 NULL
+0 0
+0 1
+DELETE FROM t1 WHERE f1 = b'1';
+UPDATE t1 SET f1 = b'1' WHERE f1 IS NULL;
+UPDATE t1 SET f1 = 1 WHERE f1 = b'0';
+connection node_1;
+SELECT f1 IS NULL, f1 = b'1' FROM t1;
+f1 IS NULL f1 = b'1'
+0 1
+0 1
+connection node_1;
+CREATE TABLE t2 (f1 BIT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (NULL);
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t2 SET f1 = 0 WHERE f1 IS NULL;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t2 SET f1 = 1 WHERE f1 IS NULL;
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_nopk_blob.result b/mysql-test/suite/galera/r/galera_nopk_blob.result
new file mode 100644
index 00000000..6a3cee51
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_nopk_blob.result
@@ -0,0 +1,35 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 BLOB) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL),('abc');
+connection node_2;
+SELECT f1 FROM t1;
+f1
+NULL
+abc
+DELETE FROM t1 WHERE f1 IS NULL;
+UPDATE t1 SET f1 = 'xyz' WHERE f1 = 'abc';
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT f1 = 'abc' FROM t1;
+f1 = 'abc'
+0
+connection node_1;
+CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (NULL);
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t2 SET f1 = 'abc' WHERE f1 IS NULL;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t2 SET f1 = 'xyz' WHERE f1 IS NULL;
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_nopk_large_varchar.result b/mysql-test/suite/galera/r/galera_nopk_large_varchar.result
new file mode 100644
index 00000000..6d293069
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_nopk_large_varchar.result
@@ -0,0 +1,38 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 VARCHAR(8000)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL),(CONCAT(REPEAT('x', 7999), 'a'));
+connection node_2;
+SELECT LENGTH(f1) FROM t1;
+LENGTH(f1)
+NULL
+8000
+DELETE FROM t1 WHERE f1 IS NULL;
+UPDATE t1 SET f1 = CONCAT(REPEAT('x', 7999), 'b') WHERE f1 = CONCAT(REPEAT('x', 7999), 'a');
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT LENGTH(f1) = 8000 FROM t1;
+LENGTH(f1) = 8000
+1
+SELECT f1 = CONCAT(REPEAT('x', 7999), 'b') FROM t1;
+f1 = CONCAT(REPEAT('x', 7999), 'b')
+1
+connection node_1;
+CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (CONCAT(REPEAT('x', 7999), 'a'));
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t2 SET f1 = 'abc' WHERE f1 = CONCAT(REPEAT('x', 7999), 'a');
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t2 SET f1 = 'xyz' WHERE f1 = CONCAT(REPEAT('x', 7999), 'a');
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_nopk_unicode.result b/mysql-test/suite/galera/r/galera_nopk_unicode.result
new file mode 100644
index 00000000..587ba928
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_nopk_unicode.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (
+f1 VARCHAR(255),
+KEY (f1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES ('текст');
+connection node_2;
+SELECT f1 = 'текст' FROM t1;
+f1 = 'текст'
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текст2';
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текст3';
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT f1 = 'текст2' FROM t1;
+f1 = 'текст2'
+1
+SELECT f1 = 'текст2' FROM t1 WHERE f1 = 'текст2';
+f1 = 'текст2'
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
new file mode 100644
index 00000000..a15b0c7d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result
@@ -0,0 +1,40 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SET GLOBAL wsrep_slave_threads = 2;
+LOCK TABLE t1 READ;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+connection node_2a;
+SET SESSION wsrep_sync_wait=0;
+SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committing%' or STATE = 'Waiting for certification');
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_0 FROM t2;
+EXPECT_0
+0
+connection node_2;
+UNLOCK TABLES;
+connection node_2a;
+SET SESSION wsrep_sync_wait = 15;;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_1 FROM t2;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committed%' or STATE = 'Waiting for certification');
+EXPECT_2
+2
+SET GLOBAL wsrep_slave_threads = 1;;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
new file mode 100644
index 00000000..6249edbe
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
@@ -0,0 +1,40 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
+connection node_2;
+set session wsrep_sync_wait=15;
+SET GLOBAL wsrep_slave_threads = 4;
+connection node_1;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+connection node_1a;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+connection node_2;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+30000
+SELECT COUNT(DISTINCT f1) FROM t1;
+COUNT(DISTINCT f1)
+30000
+connection node_1a;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+30000
+SELECT COUNT(DISTINCT f1) FROM t1;
+COUNT(DISTINCT f1)
+30000
+connection node_2;
+disconnect node_1a;
+SELECT COUNT(*) AS EXPECT_30000 FROM t1;
+EXPECT_30000
+30000
+SELECT COUNT(DISTINCT f1) AS EXPECT_30000 FROM t1;
+EXPECT_30000
+30000
+connection default;
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
new file mode 100644
index 00000000..e09e3427
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
@@ -0,0 +1,37 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
+connection node_2;
+set session wsrep_sync_wait=15;
+SET GLOBAL wsrep_slave_threads = 4;
+connection node_1;
+CREATE PROCEDURE p1 (repeat_count int)
+BEGIN
+DECLARE current_num int;
+SET current_num = 0;
+WHILE current_num < repeat_count do
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1;
+COMMIT;
+SET current_num = current_num + 1;
+END WHILE;
+END|
+call p1(1000);
+connection node_1;
+connection node_1a;
+connection node_1b;
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+40000
+SELECT COUNT(DISTINCT f1) FROM t1;
+COUNT(DISTINCT f1)
+40000
+disconnect node_1a;
+disconnect node_1b;
+connection default;
+DROP TABLE t1;
+DROP TABLE ten;
+DROP PROCEDURE p1;
diff --git a/mysql-test/suite/galera/r/galera_parallel_simple.result b/mysql-test/suite/galera/r/galera_parallel_simple.result
new file mode 100644
index 00000000..cac784cd
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_parallel_simple.result
@@ -0,0 +1,39 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT) ENGINE=InnoDB;
+CREATE TABLE t2 (id INT) ENGINE=InnoDB;
+connection node_2;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+NAME
+test/t1
+test/t2
+SET GLOBAL wsrep_slave_threads = 2;
+LOCK TABLE t1 WRITE;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 select * from t1;
+INSERT INTO t2 select * from t2;
+INSERT INTO t1 select * from t1;
+INSERT INTO t2 select * from t2;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+UNLOCK TABLES;
+SET SESSION wsrep_sync_wait = 15;
+SELECT COUNT(*) as expect_20 FROM t1;
+expect_20
+20
+SELECT COUNT(*) as expect_20 FROM t2;
+expect_20
+20
+SET GLOBAL wsrep_slave_threads = 1;;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_partition.result b/mysql-test/suite/galera/r/galera_partition.result
new file mode 100644
index 00000000..7b4d6e41
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_partition.result
@@ -0,0 +1,417 @@
+connection node_2;
+connection node_1;
+connection node_1;
+call mtr.add_suppression("WSREP: RSU failed due to pending transactions, schema: test, query ALTER.*");
+call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
+connection node_1;
+CREATE TABLE t1(
+id bigint unsigned NOT NULL AUTO_INCREMENT,
+dt datetime NOT NULL,
+PRIMARY KEY (id,dt),
+KEY dt_idx (dt)
+) ENGINE=InnoDB
+PARTITION BY RANGE( TO_DAYS(dt) ) (
+PARTITION rx2009xx VALUES LESS THAN( TO_DAYS('2010-01-01 00:00:00') ),
+PARTITION rx201001 VALUES LESS THAN( TO_DAYS('2010-02-01 00:00:00') ),
+PARTITION rx201002 VALUES LESS THAN( TO_DAYS('2010-03-01 00:00:00') ),
+PARTITION rx201003 VALUES LESS THAN( TO_DAYS('2010-04-01 00:00:00') ),
+PARTITION rx201004 VALUES LESS THAN( TO_DAYS('2010-05-01 00:00:00') ),
+PARTITION rx201005 VALUES LESS THAN( TO_DAYS('2010-06-01 00:00:00') ),
+PARTITION rx201006 VALUES LESS THAN( TO_DAYS('2010-07-01 00:00:00') ),
+PARTITION rx201007 VALUES LESS THAN( TO_DAYS('2010-08-01 00:00:00') ),
+PARTITION rx201008 VALUES LESS THAN( TO_DAYS('2010-09-01 00:00:00') ),
+PARTITION rx201009 VALUES LESS THAN( TO_DAYS('2010-10-01 00:00:00') ),
+PARTITION rx201010 VALUES LESS THAN( TO_DAYS('2010-11-01 00:00:00') ),
+PARTITION rx201011 VALUES LESS THAN( TO_DAYS('2010-12-01 00:00:00') ),
+PARTITION rx201012 VALUES LESS THAN( TO_DAYS('2011-01-01 00:00:00') ),
+PARTITION rx2011 VALUES LESS THAN MAXVALUE);
+CREATE PROCEDURE p1 (repeat_count int)
+BEGIN
+DECLARE current_num int;
+SET current_num = 0;
+WHILE current_num < repeat_count do
+INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-02-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-03-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-04-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-06-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2012-02-21 00:00:00');
+COMMIT;
+SET current_num = current_num + 1;
+END WHILE;
+END|
+insert into t1 (id, dt) values (1, '2010-01-02 00:00:00');
+insert into t1 (id, dt) values (2, '2010-01-03 00:00:00');
+insert into t1 (id, dt) values (3, '2010-01-04 00:00:00');
+insert into t1 (id, dt) values (4, '2010-01-05 00:00:00');
+insert into t1 (id, dt) values (5, '2010-01-06 00:00:00');
+insert into t1 (id, dt) values (6, '2010-01-07 00:00:00');
+insert into t1 (id, dt) values (7, '2010-01-08 00:00:00');
+insert into t1 (id, dt) values (8, '2010-01-09 00:00:00');
+insert into t1 (id, dt) values (9, '2010-01-10 00:00:00');
+insert into t1 (id, dt) values (10, '2010-01-11 00:00:00');
+insert into t1 (id, dt) values (11, '2010-01-12 00:00:00');
+insert into t1 (id, dt) values (12, '2010-01-13 00:00:00');
+insert into t1 (id, dt) values (13, '2010-01-14 00:00:00');
+insert into t1 (id, dt) values (14, '2010-01-15 00:00:00');
+insert into t1 (id, dt) values (15, '2010-01-16 00:00:00');
+insert into t1 (id, dt) values (16, '2010-01-17 00:00:00');
+insert into t1 (id, dt) values (17, '2010-01-18 00:00:00');
+insert into t1 (id, dt) values (18, '2010-01-19 00:00:00');
+insert into t1 (id, dt) values (19, '2010-01-20 00:00:00');
+insert into t1 (id, dt) values (20, '2010-01-21 00:00:00');
+insert into t1 (id, dt) values (21, '2010-01-22 00:00:00');
+insert into t1 (id, dt) values (22, '2010-01-23 00:00:00');
+insert into t1 (id, dt) values (23, '2010-01-24 00:00:00');
+insert into t1 (id, dt) values (24, '2010-01-25 00:00:00');
+insert into t1 (id, dt) values (25, '2010-01-26 00:00:00');
+insert into t1 (id, dt) values (26, '2010-01-27 00:00:00');
+insert into t1 (id, dt) values (27, '2010-01-28 00:00:00');
+insert into t1 (id, dt) values (28, '2010-01-29 00:00:00');
+insert into t1 (id, dt) values (29, '2010-01-30 00:00:00');
+insert into t1 (id, dt) values (30, '2010-01-31 00:00:00');
+insert into t1 (id, dt) values (31, '2010-02-01 00:00:00');
+insert into t1 (id, dt) values (32, '2010-02-02 00:00:00');
+insert into t1 (id, dt) values (33, '2010-02-03 00:00:00');
+insert into t1 (id, dt) values (34, '2010-02-04 00:00:00');
+insert into t1 (id, dt) values (35, '2010-02-05 00:00:00');
+insert into t1 (id, dt) values (36, '2010-02-06 00:00:00');
+insert into t1 (id, dt) values (37, '2010-02-07 00:00:00');
+insert into t1 (id, dt) values (38, '2010-02-08 00:00:00');
+insert into t1 (id, dt) values (39, '2010-02-09 00:00:00');
+insert into t1 (id, dt) values (40, '2010-02-10 00:00:00');
+insert into t1 (id, dt) values (41, '2010-02-11 00:00:00');
+insert into t1 (id, dt) values (42, '2010-02-12 00:00:00');
+insert into t1 (id, dt) values (43, '2010-02-13 00:00:00');
+insert into t1 (id, dt) values (44, '2010-02-14 00:00:00');
+insert into t1 (id, dt) values (45, '2010-02-15 00:00:00');
+insert into t1 (id, dt) values (46, '2010-02-16 00:00:00');
+insert into t1 (id, dt) values (47, '2010-02-17 00:00:00');
+insert into t1 (id, dt) values (48, '2010-02-18 00:00:00');
+insert into t1 (id, dt) values (49, '2010-02-19 00:00:00');
+insert into t1 (id, dt) values (50, '2010-02-20 00:00:00');
+insert into t1 (id, dt) values (51, '2010-02-21 00:00:00');
+insert into t1 (id, dt) values (52, '2010-02-22 00:00:00');
+insert into t1 (id, dt) values (53, '2010-02-23 00:00:00');
+insert into t1 (id, dt) values (54, '2010-02-24 00:00:00');
+insert into t1 (id, dt) values (55, '2010-02-25 00:00:00');
+insert into t1 (id, dt) values (56, '2010-02-26 00:00:00');
+insert into t1 (id, dt) values (57, '2010-02-27 00:00:00');
+insert into t1 (id, dt) values (58, '2010-02-28 00:00:00');
+insert into t1 (id, dt) values (59, '2010-03-01 00:00:00');
+insert into t1 (id, dt) values (60, '2010-03-02 00:00:00');
+insert into t1 (id, dt) values (61, '2010-03-03 00:00:00');
+insert into t1 (id, dt) values (62, '2010-03-04 00:00:00');
+insert into t1 (id, dt) values (63, '2010-03-05 00:00:00');
+insert into t1 (id, dt) values (64, '2010-03-06 00:00:00');
+insert into t1 (id, dt) values (65, '2010-03-07 00:00:00');
+insert into t1 (id, dt) values (66, '2010-03-08 00:00:00');
+insert into t1 (id, dt) values (67, '2010-03-09 00:00:00');
+insert into t1 (id, dt) values (68, '2010-03-10 00:00:00');
+insert into t1 (id, dt) values (69, '2010-03-11 00:00:00');
+insert into t1 (id, dt) values (70, '2010-03-12 00:00:00');
+insert into t1 (id, dt) values (71, '2010-03-13 00:00:00');
+insert into t1 (id, dt) values (72, '2010-03-14 00:00:00');
+insert into t1 (id, dt) values (73, '2010-03-15 00:00:00');
+insert into t1 (id, dt) values (74, '2010-03-16 00:00:00');
+insert into t1 (id, dt) values (75, '2010-03-17 00:00:00');
+insert into t1 (id, dt) values (76, '2010-03-18 00:00:00');
+insert into t1 (id, dt) values (77, '2010-03-19 00:00:00');
+insert into t1 (id, dt) values (78, '2010-03-20 00:00:00');
+insert into t1 (id, dt) values (79, '2010-03-21 00:00:00');
+insert into t1 (id, dt) values (80, '2010-03-22 00:00:00');
+insert into t1 (id, dt) values (81, '2010-03-23 00:00:00');
+insert into t1 (id, dt) values (82, '2010-03-24 00:00:00');
+insert into t1 (id, dt) values (83, '2010-03-25 00:00:00');
+insert into t1 (id, dt) values (84, '2010-03-26 00:00:00');
+insert into t1 (id, dt) values (85, '2010-03-27 00:00:00');
+insert into t1 (id, dt) values (86, '2010-03-28 00:00:00');
+insert into t1 (id, dt) values (87, '2010-03-29 00:00:00');
+insert into t1 (id, dt) values (88, '2010-03-30 00:00:00');
+insert into t1 (id, dt) values (89, '2010-03-31 00:00:00');
+insert into t1 (id, dt) values (90, '2010-04-01 00:00:00');
+insert into t1 (id, dt) values (91, '2010-04-02 00:00:00');
+insert into t1 (id, dt) values (92, '2010-04-03 00:00:00');
+insert into t1 (id, dt) values (93, '2010-04-04 00:00:00');
+insert into t1 (id, dt) values (94, '2010-04-05 00:00:00');
+insert into t1 (id, dt) values (95, '2010-04-06 00:00:00');
+insert into t1 (id, dt) values (96, '2010-04-07 00:00:00');
+insert into t1 (id, dt) values (97, '2010-04-08 00:00:00');
+insert into t1 (id, dt) values (98, '2010-04-09 00:00:00');
+insert into t1 (id, dt) values (99, '2010-04-10 00:00:00');
+insert into t1 (id, dt) values (100, '2010-04-11 00:00:00');
+insert into t1 (id, dt) values (101, '2010-04-12 00:00:00');
+insert into t1 (id, dt) values (102, '2010-04-13 00:00:00');
+insert into t1 (id, dt) values (103, '2010-04-14 00:00:00');
+insert into t1 (id, dt) values (104, '2010-04-15 00:00:00');
+insert into t1 (id, dt) values (105, '2010-04-16 00:00:00');
+insert into t1 (id, dt) values (106, '2010-04-17 00:00:00');
+insert into t1 (id, dt) values (107, '2010-04-18 00:00:00');
+insert into t1 (id, dt) values (108, '2010-04-19 00:00:00');
+insert into t1 (id, dt) values (109, '2010-04-20 00:00:00');
+insert into t1 (id, dt) values (110, '2010-04-21 00:00:00');
+insert into t1 (id, dt) values (111, '2010-04-22 00:00:00');
+insert into t1 (id, dt) values (112, '2010-04-23 00:00:00');
+insert into t1 (id, dt) values (113, '2010-04-24 00:00:00');
+insert into t1 (id, dt) values (114, '2010-04-25 00:00:00');
+insert into t1 (id, dt) values (115, '2010-04-26 00:00:00');
+insert into t1 (id, dt) values (116, '2010-04-27 00:00:00');
+insert into t1 (id, dt) values (117, '2010-04-28 00:00:00');
+insert into t1 (id, dt) values (118, '2010-04-29 00:00:00');
+insert into t1 (id, dt) values (119, '2010-04-30 00:00:00');
+insert into t1 (id, dt) values (120, '2010-05-01 00:00:00');
+insert into t1 (id, dt) values (121, '2010-05-02 00:00:00');
+insert into t1 (id, dt) values (122, '2010-05-03 00:00:00');
+insert into t1 (id, dt) values (123, '2010-05-04 00:00:00');
+insert into t1 (id, dt) values (124, '2010-05-05 00:00:00');
+insert into t1 (id, dt) values (125, '2010-05-06 00:00:00');
+insert into t1 (id, dt) values (126, '2010-05-07 00:00:00');
+insert into t1 (id, dt) values (127, '2010-05-08 00:00:00');
+insert into t1 (id, dt) values (128, '2010-05-09 00:00:00');
+insert into t1 (id, dt) values (129, '2010-05-10 00:00:00');
+insert into t1 (id, dt) values (130, '2010-05-11 00:00:00');
+insert into t1 (id, dt) values (131, '2010-05-12 00:00:00');
+insert into t1 (id, dt) values (132, '2010-05-13 00:00:00');
+insert into t1 (id, dt) values (133, '2010-05-14 00:00:00');
+insert into t1 (id, dt) values (134, '2010-05-15 00:00:00');
+insert into t1 (id, dt) values (135, '2010-05-16 00:00:00');
+insert into t1 (id, dt) values (136, '2010-05-17 00:00:00');
+insert into t1 (id, dt) values (137, '2010-05-18 00:00:00');
+insert into t1 (id, dt) values (138, '2010-05-19 00:00:00');
+insert into t1 (id, dt) values (139, '2010-05-20 00:00:00');
+insert into t1 (id, dt) values (140, '2010-05-21 00:00:00');
+insert into t1 (id, dt) values (141, '2010-05-22 00:00:00');
+insert into t1 (id, dt) values (142, '2010-05-23 00:00:00');
+insert into t1 (id, dt) values (143, '2010-05-24 00:00:00');
+insert into t1 (id, dt) values (144, '2010-05-25 00:00:00');
+insert into t1 (id, dt) values (145, '2010-05-26 00:00:00');
+insert into t1 (id, dt) values (146, '2010-05-27 00:00:00');
+insert into t1 (id, dt) values (147, '2010-05-28 00:00:00');
+insert into t1 (id, dt) values (148, '2010-05-29 00:00:00');
+insert into t1 (id, dt) values (149, '2010-05-30 00:00:00');
+insert into t1 (id, dt) values (150, '2010-05-31 00:00:00');
+insert into t1 (id, dt) values (151, '2010-06-01 00:00:00');
+insert into t1 (id, dt) values (152, '2010-06-02 00:00:00');
+insert into t1 (id, dt) values (153, '2010-06-03 00:00:00');
+insert into t1 (id, dt) values (154, '2010-06-04 00:00:00');
+insert into t1 (id, dt) values (155, '2010-06-05 00:00:00');
+insert into t1 (id, dt) values (156, '2010-06-06 00:00:00');
+insert into t1 (id, dt) values (157, '2010-06-07 00:00:00');
+insert into t1 (id, dt) values (158, '2010-06-08 00:00:00');
+insert into t1 (id, dt) values (159, '2010-06-09 00:00:00');
+insert into t1 (id, dt) values (160, '2010-06-10 00:00:00');
+insert into t1 (id, dt) values (161, '2010-06-11 00:00:00');
+insert into t1 (id, dt) values (162, '2010-06-12 00:00:00');
+insert into t1 (id, dt) values (163, '2010-06-13 00:00:00');
+insert into t1 (id, dt) values (164, '2010-06-14 00:00:00');
+insert into t1 (id, dt) values (165, '2010-06-15 00:00:00');
+insert into t1 (id, dt) values (166, '2010-06-16 00:00:00');
+insert into t1 (id, dt) values (167, '2010-06-17 00:00:00');
+insert into t1 (id, dt) values (168, '2010-06-18 00:00:00');
+insert into t1 (id, dt) values (169, '2010-06-19 00:00:00');
+insert into t1 (id, dt) values (170, '2010-06-20 00:00:00');
+insert into t1 (id, dt) values (171, '2010-06-21 00:00:00');
+insert into t1 (id, dt) values (172, '2010-06-22 00:00:00');
+insert into t1 (id, dt) values (173, '2010-06-23 00:00:00');
+insert into t1 (id, dt) values (174, '2010-06-24 00:00:00');
+insert into t1 (id, dt) values (175, '2010-06-25 00:00:00');
+insert into t1 (id, dt) values (176, '2010-06-26 00:00:00');
+insert into t1 (id, dt) values (177, '2010-06-27 00:00:00');
+insert into t1 (id, dt) values (178, '2010-06-28 00:00:00');
+insert into t1 (id, dt) values (179, '2010-06-29 00:00:00');
+insert into t1 (id, dt) values (180, '2010-06-30 00:00:00');
+insert into t1 (id, dt) values (181, '2010-07-01 00:00:00');
+insert into t1 (id, dt) values (182, '2010-07-02 00:00:00');
+insert into t1 (id, dt) values (183, '2010-07-03 00:00:00');
+insert into t1 (id, dt) values (184, '2010-07-04 00:00:00');
+insert into t1 (id, dt) values (185, '2010-07-05 00:00:00');
+insert into t1 (id, dt) values (186, '2010-07-06 00:00:00');
+insert into t1 (id, dt) values (187, '2010-07-07 00:00:00');
+insert into t1 (id, dt) values (188, '2010-07-08 00:00:00');
+insert into t1 (id, dt) values (189, '2010-07-09 00:00:00');
+insert into t1 (id, dt) values (190, '2010-07-10 00:00:00');
+insert into t1 (id, dt) values (191, '2010-07-11 00:00:00');
+insert into t1 (id, dt) values (192, '2010-07-12 00:00:00');
+insert into t1 (id, dt) values (193, '2010-07-13 00:00:00');
+insert into t1 (id, dt) values (194, '2010-07-14 00:00:00');
+insert into t1 (id, dt) values (195, '2010-07-15 00:00:00');
+insert into t1 (id, dt) values (196, '2010-07-16 00:00:00');
+insert into t1 (id, dt) values (197, '2010-07-17 00:00:00');
+insert into t1 (id, dt) values (198, '2010-07-18 00:00:00');
+insert into t1 (id, dt) values (199, '2010-07-19 00:00:00');
+insert into t1 (id, dt) values (200, '2010-07-20 00:00:00');
+insert into t1 (id, dt) values (201, '2010-07-21 00:00:00');
+insert into t1 (id, dt) values (202, '2010-07-22 00:00:00');
+insert into t1 (id, dt) values (203, '2010-07-23 00:00:00');
+insert into t1 (id, dt) values (204, '2010-07-24 00:00:00');
+insert into t1 (id, dt) values (205, '2010-07-25 00:00:00');
+insert into t1 (id, dt) values (206, '2010-07-26 00:00:00');
+insert into t1 (id, dt) values (207, '2010-07-27 00:00:00');
+insert into t1 (id, dt) values (208, '2010-07-28 00:00:00');
+insert into t1 (id, dt) values (209, '2010-07-29 00:00:00');
+insert into t1 (id, dt) values (210, '2010-07-30 00:00:00');
+insert into t1 (id, dt) values (211, '2010-07-31 00:00:00');
+insert into t1 (id, dt) values (212, '2010-08-01 00:00:00');
+insert into t1 (id, dt) values (213, '2010-08-02 00:00:00');
+insert into t1 (id, dt) values (214, '2010-08-03 00:00:00');
+insert into t1 (id, dt) values (215, '2010-08-04 00:00:00');
+insert into t1 (id, dt) values (216, '2010-08-05 00:00:00');
+insert into t1 (id, dt) values (217, '2010-08-06 00:00:00');
+insert into t1 (id, dt) values (218, '2010-08-07 00:00:00');
+insert into t1 (id, dt) values (219, '2010-08-08 00:00:00');
+insert into t1 (id, dt) values (220, '2010-08-09 00:00:00');
+insert into t1 (id, dt) values (221, '2010-08-10 00:00:00');
+insert into t1 (id, dt) values (222, '2010-08-11 00:00:00');
+insert into t1 (id, dt) values (223, '2010-08-12 00:00:00');
+insert into t1 (id, dt) values (224, '2010-08-13 00:00:00');
+insert into t1 (id, dt) values (225, '2010-08-14 00:00:00');
+insert into t1 (id, dt) values (226, '2010-08-15 00:00:00');
+insert into t1 (id, dt) values (227, '2010-08-16 00:00:00');
+insert into t1 (id, dt) values (228, '2010-08-17 00:00:00');
+insert into t1 (id, dt) values (229, '2010-08-18 00:00:00');
+insert into t1 (id, dt) values (230, '2010-08-19 00:00:00');
+insert into t1 (id, dt) values (231, '2010-08-20 00:00:00');
+insert into t1 (id, dt) values (232, '2010-08-21 00:00:00');
+insert into t1 (id, dt) values (233, '2010-08-22 00:00:00');
+insert into t1 (id, dt) values (234, '2010-08-23 00:00:00');
+insert into t1 (id, dt) values (235, '2010-08-24 00:00:00');
+insert into t1 (id, dt) values (236, '2010-08-25 00:00:00');
+insert into t1 (id, dt) values (237, '2010-08-26 00:00:00');
+insert into t1 (id, dt) values (238, '2010-08-27 00:00:00');
+insert into t1 (id, dt) values (239, '2010-08-28 00:00:00');
+insert into t1 (id, dt) values (240, '2010-08-29 00:00:00');
+insert into t1 (id, dt) values (241, '2010-08-30 00:00:00');
+insert into t1 (id, dt) values (242, '2010-08-31 00:00:00');
+insert into t1 (id, dt) values (243, '2010-09-01 00:00:00');
+insert into t1 (id, dt) values (244, '2010-09-02 00:00:00');
+insert into t1 (id, dt) values (245, '2010-09-03 00:00:00');
+insert into t1 (id, dt) values (246, '2010-09-04 00:00:00');
+insert into t1 (id, dt) values (247, '2010-09-05 00:00:00');
+insert into t1 (id, dt) values (248, '2010-09-06 00:00:00');
+insert into t1 (id, dt) values (249, '2010-09-07 00:00:00');
+insert into t1 (id, dt) values (250, '2010-09-08 00:00:00');
+insert into t1 (id, dt) values (251, '2010-09-09 00:00:00');
+insert into t1 (id, dt) values (252, '2010-09-10 00:00:00');
+insert into t1 (id, dt) values (253, '2010-09-11 00:00:00');
+insert into t1 (id, dt) values (254, '2010-09-12 00:00:00');
+insert into t1 (id, dt) values (255, '2010-09-13 00:00:00');
+insert into t1 (id, dt) values (256, '2010-09-14 00:00:00');
+insert into t1 (id, dt) values (257, '2010-09-15 00:00:00');
+insert into t1 (id, dt) values (258, '2010-09-16 00:00:00');
+insert into t1 (id, dt) values (259, '2010-09-17 00:00:00');
+insert into t1 (id, dt) values (260, '2010-09-18 00:00:00');
+insert into t1 (id, dt) values (261, '2010-09-19 00:00:00');
+insert into t1 (id, dt) values (262, '2010-09-20 00:00:00');
+insert into t1 (id, dt) values (263, '2010-09-21 00:00:00');
+insert into t1 (id, dt) values (264, '2010-09-22 00:00:00');
+insert into t1 (id, dt) values (265, '2010-09-23 00:00:00');
+insert into t1 (id, dt) values (266, '2010-09-24 00:00:00');
+insert into t1 (id, dt) values (267, '2010-09-25 00:00:00');
+insert into t1 (id, dt) values (268, '2010-09-26 00:00:00');
+insert into t1 (id, dt) values (269, '2010-09-27 00:00:00');
+insert into t1 (id, dt) values (270, '2010-09-28 00:00:00');
+insert into t1 (id, dt) values (271, '2010-09-29 00:00:00');
+insert into t1 (id, dt) values (272, '2010-09-30 00:00:00');
+insert into t1 (id, dt) values (273, '2010-10-01 00:00:00');
+insert into t1 (id, dt) values (274, '2010-10-02 00:00:00');
+insert into t1 (id, dt) values (275, '2010-10-03 00:00:00');
+insert into t1 (id, dt) values (276, '2010-10-04 00:00:00');
+insert into t1 (id, dt) values (277, '2010-10-05 00:00:00');
+insert into t1 (id, dt) values (278, '2010-10-06 00:00:00');
+insert into t1 (id, dt) values (279, '2010-10-07 00:00:00');
+insert into t1 (id, dt) values (280, '2010-10-08 00:00:00');
+insert into t1 (id, dt) values (281, '2010-10-09 00:00:00');
+insert into t1 (id, dt) values (282, '2010-10-10 00:00:00');
+insert into t1 (id, dt) values (283, '2010-10-11 00:00:00');
+insert into t1 (id, dt) values (284, '2010-10-12 00:00:00');
+insert into t1 (id, dt) values (285, '2010-10-13 00:00:00');
+insert into t1 (id, dt) values (286, '2010-10-14 00:00:00');
+insert into t1 (id, dt) values (287, '2010-10-15 00:00:00');
+insert into t1 (id, dt) values (288, '2010-10-16 00:00:00');
+insert into t1 (id, dt) values (289, '2010-10-17 00:00:00');
+insert into t1 (id, dt) values (290, '2010-10-18 00:00:00');
+insert into t1 (id, dt) values (291, '2010-10-19 00:00:00');
+insert into t1 (id, dt) values (292, '2010-10-20 00:00:00');
+insert into t1 (id, dt) values (293, '2010-10-21 00:00:00');
+insert into t1 (id, dt) values (294, '2010-10-22 00:00:00');
+insert into t1 (id, dt) values (295, '2010-10-23 00:00:00');
+insert into t1 (id, dt) values (296, '2010-10-24 00:00:00');
+insert into t1 (id, dt) values (297, '2010-10-25 00:00:00');
+insert into t1 (id, dt) values (298, '2010-10-26 00:00:00');
+insert into t1 (id, dt) values (299, '2010-10-27 00:00:00');
+insert into t1 (id, dt) values (300, '2010-10-28 00:00:00');
+insert into t1 (id, dt) values (301, '2010-10-29 00:00:00');
+insert into t1 (id, dt) values (302, '2010-10-30 00:00:00');
+insert into t1 (id, dt) values (303, '2010-10-31 00:00:00');
+insert into t1 (id, dt) values (304, '2010-11-01 00:00:00');
+insert into t1 (id, dt) values (305, '2010-11-02 00:00:00');
+insert into t1 (id, dt) values (306, '2010-11-03 00:00:00');
+insert into t1 (id, dt) values (307, '2010-11-04 00:00:00');
+insert into t1 (id, dt) values (308, '2010-11-05 00:00:00');
+insert into t1 (id, dt) values (309, '2010-11-06 00:00:00');
+insert into t1 (id, dt) values (310, '2010-11-07 00:00:00');
+insert into t1 (id, dt) values (311, '2010-11-08 00:00:00');
+insert into t1 (id, dt) values (312, '2010-11-09 00:00:00');
+insert into t1 (id, dt) values (313, '2010-11-10 00:00:00');
+insert into t1 (id, dt) values (314, '2010-11-11 00:00:00');
+insert into t1 (id, dt) values (315, '2010-11-12 00:00:00');
+insert into t1 (id, dt) values (316, '2010-11-13 00:00:00');
+insert into t1 (id, dt) values (317, '2010-11-14 00:00:00');
+insert into t1 (id, dt) values (318, '2010-11-15 00:00:00');
+insert into t1 (id, dt) values (319, '2010-11-16 00:00:00');
+insert into t1 (id, dt) values (320, '2010-11-17 00:00:00');
+insert into t1 (id, dt) values (321, '2010-11-18 00:00:00');
+insert into t1 (id, dt) values (322, '2010-11-19 00:00:00');
+insert into t1 (id, dt) values (323, '2010-11-20 00:00:00');
+insert into t1 (id, dt) values (324, '2010-11-21 00:00:00');
+insert into t1 (id, dt) values (325, '2010-11-22 00:00:00');
+insert into t1 (id, dt) values (326, '2010-11-23 00:00:00');
+insert into t1 (id, dt) values (327, '2010-11-24 00:00:00');
+insert into t1 (id, dt) values (328, '2010-11-25 00:00:00');
+insert into t1 (id, dt) values (329, '2010-11-26 00:00:00');
+insert into t1 (id, dt) values (330, '2010-11-27 00:00:00');
+insert into t1 (id, dt) values (331, '2010-11-28 00:00:00');
+insert into t1 (id, dt) values (332, '2010-11-29 00:00:00');
+insert into t1 (id, dt) values (333, '2010-11-30 00:00:00');
+insert into t1 (id, dt) values (334, '2010-12-01 00:00:00');
+insert into t1 (id, dt) values (335, '2010-12-02 00:00:00');
+insert into t1 (id, dt) values (336, '2010-12-03 00:00:00');
+insert into t1 (id, dt) values (337, '2010-12-04 00:00:00');
+insert into t1 (id, dt) values (338, '2010-12-05 00:00:00');
+insert into t1 (id, dt) values (339, '2010-12-06 00:00:00');
+insert into t1 (id, dt) values (340, '2010-12-07 00:00:00');
+insert into t1 (id, dt) values (341, '2010-12-08 00:00:00');
+insert into t1 (id, dt) values (342, '2010-12-09 00:00:00');
+insert into t1 (id, dt) values (343, '2010-12-10 00:00:00');
+insert into t1 (id, dt) values (344, '2010-12-11 00:00:00');
+insert into t1 (id, dt) values (345, '2010-12-12 00:00:00');
+insert into t1 (id, dt) values (346, '2010-12-13 00:00:00');
+insert into t1 (id, dt) values (347, '2010-12-14 00:00:00');
+insert into t1 (id, dt) values (348, '2010-12-15 00:00:00');
+insert into t1 (id, dt) values (349, '2010-12-16 00:00:00');
+insert into t1 (id, dt) values (350, '2010-12-17 00:00:00');
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+350
+connection node_1;
+call p1(10);;
+connection node_2;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+SET SESSION wsrep_OSU_method='RSU';
+SET SESSION sql_log_bin = 0;
+ALTER TABLE t1 DROP PARTITION rx2009xx;
+ALTER TABLE t1 DROP PARTITION rx201004;
+ALTER TABLE t1 DROP PARTITION rx201008;
+SET SESSION wsrep_OSU_METHOD='TOI';
+SET SESSION sql_log_bin = 1;
+SELECT @@wsrep_OSU_method;
+@@wsrep_OSU_method
+TOI
+connection node_2;
+disconnect node_2a;
+connection node_1;
+connection node_1;
+DROP TABLE t1;
+DROP PROCEDURE p1;
diff --git a/mysql-test/suite/galera/r/galera_password.result b/mysql-test/suite/galera/r/galera_password.result
new file mode 100644
index 00000000..00ffc1df
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_password.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+SHOW VARIABLES LIKE '%password%';
+Variable_name Value
+default_password_lifetime 0
+disconnect_on_expired_password OFF
+max_password_errors 4294967295
+old_passwords OFF
+report_password
+strict_password_validation ON
+CREATE USER 'user123456'@'localhost';
+GRANT SELECT, INSERT, UPDATE ON test.* TO 'user123456'@'localhost';
+SET PASSWORD FOR 'user123456'@'localhost' = PASSWORD('A$10abcdDCBA123456%7');
+SHOW GRANTS FOR 'user123456'@'localhost';
+Grants for user123456@localhost
+GRANT USAGE ON *.* TO `user123456`@`localhost` IDENTIFIED BY PASSWORD '*5846CF4D641598B360B3562E581586155C59F65A'
+GRANT SELECT, INSERT, UPDATE ON `test`.* TO `user123456`@`localhost`
+connection node_2;
+SHOW GRANTS FOR 'user123456'@'localhost';
+Grants for user123456@localhost
+GRANT USAGE ON *.* TO `user123456`@`localhost` IDENTIFIED BY PASSWORD '*5846CF4D641598B360B3562E581586155C59F65A'
+GRANT SELECT, INSERT, UPDATE ON `test`.* TO `user123456`@`localhost`
+connection node_1;
+DROP USER 'user123456'@'localhost';
diff --git a/mysql-test/suite/galera/r/galera_pc_ignore_sb.result b/mysql-test/suite/galera/r/galera_pc_ignore_sb.result
new file mode 100644
index 00000000..e9f6cae5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_pc_ignore_sb.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address;
+SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options;
+SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true';
+connection node_2;
+Killing server ...
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 1
+1
+SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE = 'ON'
+1
+SET GLOBAL wsrep_cluster_address = '';
+SET GLOBAL wsrep_cluster_address = @wsrep_cluster_address_orig;
+connection node_2;
+connection node_1;
+SET GLOBAL wsrep_provider_options = @wsrep_provider_options_orig;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_pc_recovery.result b/mysql-test/suite/galera/r/galera_pc_recovery.result
new file mode 100644
index 00000000..17a43d17
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_pc_recovery.result
@@ -0,0 +1,37 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+connection node_1;
+CALL mtr.add_suppression("points to own listening address, blacklisting");
+CALL mtr.add_suppression("non weight changing install in S_PRIM");
+CALL mtr.add_suppression("No re-merged primary component found");
+connection node_2;
+CALL mtr.add_suppression("points to own listening address, blacklisting");
+CALL mtr.add_suppression("non weight changing install in S_PRIM");
+CALL mtr.add_suppression("No re-merged primary component found");
diff --git a/mysql-test/suite/galera/r/galera_performance_schema.result b/mysql-test/suite/galera/r/galera_performance_schema.result
new file mode 100644
index 00000000..8c99669c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_performance_schema.result
@@ -0,0 +1,54 @@
+connection node_2;
+connection node_1;
+use performance_schema;
+SELECT name
+FROM threads
+WHERE name LIKE 'thread/sql/wsrep%'
+ORDER BY name;
+name thread/sql/wsrep_applier_thread
+name thread/sql/wsrep_rollbacker_thread
+use test;
+create table t1 (a int not null primary key) engine=innodb;
+insert into t1 values (1),(2);
+use performance_schema;
+select name from mutex_instances where name like 'wait/synch/mutex/sql/LOCK_wsrep%' order by name;
+name wait/synch/mutex/sql/LOCK_wsrep_cluster_config
+name wait/synch/mutex/sql/LOCK_wsrep_config_state
+name wait/synch/mutex/sql/LOCK_wsrep_desync
+name wait/synch/mutex/sql/LOCK_wsrep_donor_monitor
+name wait/synch/mutex/sql/LOCK_wsrep_group_commit
+name wait/synch/mutex/sql/LOCK_wsrep_gtid_wait_upto
+name wait/synch/mutex/sql/LOCK_wsrep_joiner_monitor
+name wait/synch/mutex/sql/LOCK_wsrep_ready
+name wait/synch/mutex/sql/LOCK_wsrep_replaying
+name wait/synch/mutex/sql/LOCK_wsrep_slave_threads
+name wait/synch/mutex/sql/LOCK_wsrep_SR_pool
+name wait/synch/mutex/sql/LOCK_wsrep_SR_store
+name wait/synch/mutex/sql/LOCK_wsrep_sst
+name wait/synch/mutex/sql/LOCK_wsrep_sst_init
+select name from cond_instances where name like 'wait/synch/cond/sql/COND_wsrep%' order by name;
+name wait/synch/cond/sql/COND_wsrep_donor_monitor
+name wait/synch/cond/sql/COND_wsrep_joiner_monitor
+name wait/synch/cond/sql/COND_wsrep_ready
+name wait/synch/cond/sql/COND_wsrep_replaying
+name wait/synch/cond/sql/COND_wsrep_sst
+name wait/synch/cond/sql/COND_wsrep_sst_init
+name wait/synch/cond/sql/COND_wsrep_wsrep_slave_threads
+connection node_2;
+use test;
+SET SESSION wsrep_on=OFF;
+CREATE TABLE t2 (f1 INTEGER) engine=innodb;
+connection node_1;
+use test;
+CREATE TABLE t2 (f1 INTEGER) engine=innodb;
+connection node_2;
+SET SESSION wsrep_on=ON;
+SELECT COUNT(*) FROM t1;
+COUNT(*) 2
+use performance_schema;
+select count(*)>=1 from file_instances where file_name like '%GRA_%.log';
+count(*)>=1 1
+CALL mtr.add_suppression("Slave SQL: Error 'Table 't2' already exists' on query");
+use test;
+drop table t1;
+drop table t2;
diff --git a/mysql-test/suite/galera/r/galera_pk_bigint_signed.result b/mysql-test/suite/galera/r/galera_pk_bigint_signed.result
new file mode 100644
index 00000000..0b538778
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_pk_bigint_signed.result
@@ -0,0 +1,34 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 BIGINT SIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(-9223372036854775808, 'min'),
+(9223372036854775807, 'max')
+;
+connection node_2;
+SELECT * FROM t1;
+f1 f2
+-9223372036854775808 min
+9223372036854775807 max
+UPDATE t1 SET f2 = CONCAT(f2, '_');
+connection node_1;
+SELECT * FROM t1;
+f1 f2
+-9223372036854775808 min_
+9223372036854775807 max_
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'foo' WHERE f1 = -9223372036854775808;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'bar' WHERE f1 = -9223372036854775808;
+connection node_1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET AUTOCOMMIT=ON;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result b/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result
new file mode 100644
index 00000000..9442f79c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 BIGINT UNSIGNED PRIMARY KEY, f2 VARCHAR(5)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(18446744073709551615, 'max')
+;
+connection node_2;
+SELECT f1 = 18446744073709551615 FROM t1;
+f1 = 18446744073709551615
+1
+UPDATE t1 SET f2 = CONCAT(f2, '_');
+connection node_1;
+SELECT f1 = 18446744073709551615 FROM t1;
+f1 = 18446744073709551615
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'foo' WHERE f1 = 18446744073709551615;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'bar' WHERE f1 = 18446744073709551615;
+connection node_1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SET AUTOCOMMIT=ON;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_prepared_statement.result b/mysql-test/suite/galera/r/galera_prepared_statement.result
new file mode 100644
index 00000000..b84f25e9
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_prepared_statement.result
@@ -0,0 +1,38 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 CHAR(5)) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 CHAR(5)) ENGINE=InnoDB;
+CREATE TABLE t3 (f1 CHAR(5)) ENGINE=InnoDB;
+CREATE TABLE t4 (f1 CHAR(5)) ENGINE=InnoDB;
+SET SESSION sql_mode='STRICT_ALL_TABLES';
+PREPARE st1 FROM 'INSERT INTO t1 VALUES ("abc")';
+PREPARE st2 FROM 'INSERT INTO t2 VALUES ("abc")';
+PREPARE st3 FROM 'INSERT INTO t3 VALUES ("abc")';
+PREPARE st4 FROM 'INSERT INTO t4 VALUES ("abc")';
+EXECUTE st1;
+EXECUTE st2;
+EXECUTE st3;
+EXECUTE st4;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t3;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t4;
+COUNT(*) = 1
+1
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+ALTER TABLE t1 DROP COLUMN f1;
+connection node_1;
+EXECUTE st1;
+ERROR 22007: Incorrect integer value: 'abc' for column `test`.`t1`.`f2` at row 1
+connection node_1;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
diff --git a/mysql-test/suite/galera/r/galera_query_cache.result b/mysql-test/suite/galera/r/galera_query_cache.result
new file mode 100644
index 00000000..8f5bc4b6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_query_cache.result
@@ -0,0 +1,64 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+RESET QUERY CACHE;
+FLUSH STATUS;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+VARIABLE_VALUE = 1
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 1
+1
+connection node_1;
+INSERT INTO t1 VALUES (2);
+connection node_2;
+FLUSH STATUS;
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+VARIABLE_VALUE = 0
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+VARIABLE_VALUE = 1
+1
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 0
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 1
+1
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+FLUSH STATUS;
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+VARIABLE_VALUE = 0
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Qcache_queries_in_cache';
+VARIABLE_VALUE = 1
+1
+SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 0
+1
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_query_cache_invalidate.result b/mysql-test/suite/galera/r/galera_query_cache_invalidate.result
new file mode 100644
index 00000000..4a6b61e4
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_query_cache_invalidate.result
@@ -0,0 +1,123 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_2;
+call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
+connection node_4;
+call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
+connection node_3;
+CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos;;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
+START SLAVE;
+include/wait_for_slave_to_start.inc
+connection node_1;
+CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
+SET AUTOCOMMIT=1;
+INSERT INTO t1 VALUES (4000000, 'foobar');
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+50001
+connection node_3;
+connection node_1;
+# node_1
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+connection node_2;
+# node_2
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+connection node_3;
+# node_3
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+connection node_4;
+# node_4
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+connection node_1;
+# node_1 insert new
+INSERT INTO t1 values (5000000, 'foobar');
+connection node_3;
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_2;
+# node_2
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_3;
+# node_3
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_4;
+# node_4
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+SELECT * FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_2;
+# node_3 different query same table
+SELECT id, msg FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_4;
+# node_6 different query same table
+SELECT id, msg FROM t1 WHERE msg='foobar';
+id msg
+4000000 foobar
+5000000 foobar
+connection node_1;
+drop table t1;
+connection node_3;
+connection node_3;
+STOP SLAVE;
+RESET SLAVE ALL;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
+connection node_1;
+SET SESSION WSREP_ON=OFF;
+RESET MASTER;
+SET SESSION WSREP_ON=ON;
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result b/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result
new file mode 100644
index 00000000..0f2f61ea
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_query_cache_sync_wait.result
@@ -0,0 +1,55 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT1S";
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+SELECT MAX(id) FROM t1;
+MAX(id)
+1
+connection node_1;
+INSERT INTO t1 VALUES (2);
+connection node_2;
+SELECT MAX(id) FROM t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+FLUSH QUERY CACHE;
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+SET DEBUG_SYNC = "RESET";
+connection node_1;
+INSERT INTO t1 VALUES (3);
+connection node_2;
+SELECT MAX(id) FROM t1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_1;
+INSERT INTO t1 VALUES (4);
+connection node_2;
+SELECT MAX(id) FROM t1;
+MAX(id)
+4
+FLUSH STATUS;
+SELECT MAX(id) FROM t1;
+MAX(id)
+4
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 1
+1
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_1;
+INSERT INTO t1 VALUES (5);
+connection node_2;
+SELECT MAX(id) FROM t1 ;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2;
+MAX(id)
+5
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'Qcache_hits';
+VARIABLE_VALUE = 1
+1
diff --git a/mysql-test/suite/galera/r/galera_read_only.result b/mysql-test/suite/galera/r/galera_read_only.result
new file mode 100644
index 00000000..0928c62f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_read_only.result
@@ -0,0 +1,35 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SET GLOBAL read_only=TRUE;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+CREATE USER foo@localhost;
+GRANT ALL ON test.* to foo@localhost;
+# Open connection to node 2 using 'foo' user.
+connect foo_node_2,127.0.0.1,foo,,test,$port_2,;
+
+# Connect with foo_node_2
+connection foo_node_2;
+INSERT INTO t1 VALUES (2);
+ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
+CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb;
+INSERT INTO t2 values (1);
+DROP TABLE t2;
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
+1
+connection node_2;
+SET GLOBAL read_only=TRUE;
+CREATE TEMPORARY TABLE t2(id int not null primary key) engine=innodb;
+INSERT INTO t2 values (1);
+DROP TABLE t2;
+SET GLOBAL read_only=FALSE;
+DROP TABLE t1;
+DROP USER foo@localhost;
diff --git a/mysql-test/suite/galera/r/galera_repair_view.result b/mysql-test/suite/galera/r/galera_repair_view.result
new file mode 100644
index 00000000..8dfe8c8d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_repair_view.result
@@ -0,0 +1,17 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1(a int not null primary key) engine=innodb;
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair note The storage engine for the table doesn't support repair
+CREATE VIEW v1 AS SELECT a FROM t1;
+REPAIR VIEW v1;
+Table Op Msg_type Msg_text
+test.v1 repair status OK
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE VIEW v1 AS SELECT table_name FROM information_schema.tables;
+REPAIR VIEW v1;
+Table Op Msg_type Msg_text
+test.v1 repair status OK
+DROP VIEW v1;
diff --git a/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result b/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result
new file mode 100644
index 00000000..3d421216
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_repl_key_format_flat16.result
@@ -0,0 +1,23 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET GLOBAL wsrep_provider_options = 'repl.key_format=FLAT16';
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (123);
+CREATE TABLE t2 (f1 VARCHAR(256)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (REPEAT('a', 256));
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+UPDATE t1 SET f1 = 234;
+UPDATE t2 SET f1 = REPEAT('b', 256);
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 234;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = REPEAT('b', 256);
+COUNT(*) = 1
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_repl_max_ws_size.result b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result
new file mode 100644
index 00000000..343381b9
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB;
+SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512';
+INSERT INTO t1 VALUES (REPEAT('a', 512));
+ERROR HY000: Maximum writeset size exceeded
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+CALL mtr.add_suppression("Maximum writeset size exceeded by");
+CALL mtr.add_suppression("transaction size limit");
+CALL mtr.add_suppression("transaction size exceeded");
+CALL mtr.add_suppression("rbr write fail");
diff --git a/mysql-test/suite/galera/r/galera_restart_nochanges.result b/mysql-test/suite/galera/r/galera_restart_nochanges.result
new file mode 100644
index 00000000..09f8d9a5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_restart_nochanges.result
@@ -0,0 +1,19 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+connection node_1;
+connection node_2a;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+DROP TABLE t1;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result b/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result
new file mode 100644
index 00000000..b1ee6f59
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_restart_on_unknown_option.result
@@ -0,0 +1,51 @@
+connection node_2;
+connection node_1;
+CALL mtr.add_suppression("Aborting");
+CALL mtr.add_suppression("unknown option '--galera-unknown-option'");
+connection node_1;
+connection node_2;
+connection node_2;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a');
+SELECT * FROM t1;
+f1 f2
+1 a
+2 a
+3 a
+Shutting down server ...
+connection node_1;
+UPDATE t1 SET f2 = 'b' WHERE f1 > 1;
+UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+connection node_2;
+Starting server ...
+Starting server ...
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+Shutting down server ...
+connection node_1;
+UPDATE t1 SET f2 = 'd' WHERE f1 > 1;
+UPDATE t1 SET f2 = 'd' WHERE f1 > 2;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 d
+3 d
+connection node_2;
+Starting server ...
+Starting server ...
+call mtr.add_suppression("WSREP: Failed to scan the last segment to the end. Last events may be missing. Last recovered event:");
+SELECT * FROM t1;
+f1 f2
+1 a
+2 d
+3 d
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_restart_replica.result b/mysql-test/suite/galera/r/galera_restart_replica.result
new file mode 100644
index 00000000..9b7e9fd2
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_restart_replica.result
@@ -0,0 +1,122 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+create user repl@'%' identified by 'repl';
+grant all on *.* to repl@'%';
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+connection node_1;
+connection node_2;
+connection node_2;
+START SLAVE;
+connection node_3;
+CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
+SELECT COUNT(*) AS EXPECT_10000 FROM t1;
+EXPECT_10000
+10000
+connection node_2;
+SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_10000 FROM t1;
+EXPECT_10000
+10000
+connection node_1;
+SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_10000 FROM t1;
+EXPECT_10000
+10000
+connection node_2;
+# Verify that graceful shutdown succeeds.
+# Force SST
+connection node_1;
+# Waiting until node_2 is not part of cluster anymore
+connection node_2;
+# Start node_2 again
+¤ Wait until node_2 is back on cluster
+connection node_2;
+SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_10000 FROM t1;
+EXPECT_10000
+10000
+connection node_1;
+SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_10000 FROM t1;
+EXPECT_10000
+10000
+connection node_3;
+SELECT COUNT(*) AS EXPECT_10000 FROM t1;
+EXPECT_10000
+10000
+connection node_3;
+drop table t1;
+connection node_2;
+connection node_1;
+connection node_3;
+CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
+SELECT COUNT(*) AS EXPECT_10000 FROM t1;
+EXPECT_10000
+10000
+connection node_2;
+SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_10000 FROM t1;
+EXPECT_10000
+10000
+connection node_1;
+SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_10000 FROM t1;
+EXPECT_10000
+10000
+connection node_2;
+# Verify that graceful shutdown succeeds.
+# Force SST
+connection node_1;
+# Waiting until node_2 is not part of cluster anymore
+connection node_3;
+SELECT COUNT(*) AS EXPECT_20000 FROM t1;
+EXPECT_20000
+20000
+connection node_2;
+# Start node_2 again
+¤ Wait until node_2 is back on cluster
+connection node_2;
+SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_20000 FROM t1;
+EXPECT_20000
+20000
+connection node_1;
+SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_20000 FROM t1;
+EXPECT_20000
+20000
+connection node_3;
+SELECT COUNT(*) AS EXPECT_20000 FROM t1;
+EXPECT_20000
+20000
+connection node_3;
+drop table t1;
+connection node_2;
+connection node_1;
+connection node_2;
+STOP SLAVE;
+RESET SLAVE ALL;
+connection node_3;
+RESET MASTER;
+connection node_1;
+disconnect node_3;
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/galera_roles.result b/mysql-test/suite/galera/r/galera_roles.result
new file mode 100644
index 00000000..fccef163
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_roles.result
@@ -0,0 +1,214 @@
+connection node_2;
+connection node_1;
+#
+# Testing CREATE/GRANT role
+#
+
+# On node_1
+connection node_1;
+CREATE DATABASE test1;
+CREATE TABLE test1.t1 (a int, b int);
+CREATE TABLE test1.t2 (a int, b int);
+INSERT INTO test1.t1 values (1,2),(3,4);
+INSERT INTO test1.t2 values (5,6),(7,8);
+CREATE PROCEDURE test1.pr1() SELECT "pr1";
+CREATE USER foo@localhost;
+CREATE ROLE role1;
+GRANT role1 TO foo@localhost;
+GRANT RELOAD ON *.* TO role1;
+GRANT SELECT ON mysql.* TO role1;
+GRANT EXECUTE ON PROCEDURE test1.pr1 TO role1;
+GRANT SELECT ON test1.t1 TO role1;
+GRANT SELECT (a) ON test1.t2 TO role1;
+# Open connections to the 2 nodes using 'foo' user.
+connect foo_node_1,127.0.0.1,foo,,"*NO-ONE*",$port_1,;
+connect foo_node_2,127.0.0.1,foo,,"*NO-ONE*",$port_2,;
+
+# Connect with foo_node_1
+connection foo_node_1;
+SHOW GRANTS;
+Grants for foo@localhost
+GRANT `role1` TO `foo`@`localhost`
+GRANT USAGE ON *.* TO `foo`@`localhost`
+FLUSH TABLES;
+ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
+SELECT * FROM mysql.roles_mapping;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping`
+SHOW TABLES FROM test1;
+ERROR 42000: Access denied for user 'foo'@'localhost' to database 'test1'
+SET ROLE role1;
+FLUSH TABLES;
+SELECT * FROM mysql.roles_mapping;
+Host User Role Admin_option
+localhost foo role1 N
+localhost root role1 Y
+SHOW TABLES FROM test1;
+Tables_in_test1
+t1
+t2
+SELECT * FROM test1.t1;
+a b
+1 2
+3 4
+SELECT * FROM test1.t2;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t2`
+SELECT a FROM test1.t2;
+a
+5
+7
+CALL test1.pr1();
+pr1
+pr1
+
+# Connect with foo_node_2
+connection foo_node_2;
+SHOW GRANTS;
+Grants for foo@localhost
+GRANT `role1` TO `foo`@`localhost`
+GRANT USAGE ON *.* TO `foo`@`localhost`
+FLUSH TABLES;
+ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
+SELECT * FROM mysql.roles_mapping;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping`
+SHOW TABLES FROM test1;
+ERROR 42000: Access denied for user 'foo'@'localhost' to database 'test1'
+SET ROLE role1;
+FLUSH TABLES;
+SELECT * FROM mysql.roles_mapping;
+Host User Role Admin_option
+localhost foo role1 N
+localhost root role1 Y
+SHOW TABLES FROM test1;
+Tables_in_test1
+t1
+t2
+SELECT * FROM test1.t1;
+a b
+1 2
+3 4
+SELECT * FROM test1.t2;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t2`
+SELECT a FROM test1.t2;
+a
+5
+7
+CALL test1.pr1();
+pr1
+pr1
+#
+# Testing REVOKE role
+#
+#
+# Connect with node_1
+connection node_1;
+REVOKE EXECUTE ON PROCEDURE test1.pr1 FROM role1;
+
+# Connect with foo_node_1
+connection foo_node_1;
+CALL test1.pr1();
+ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test1.pr1'
+
+# Connect with foo_node_2
+connection foo_node_2;
+CALL test1.pr1();
+ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test1.pr1'
+#
+# Testing DROP role
+#
+
+# Connect with node_1
+connection node_1;
+DROP ROLE role1;
+
+# Connect with foo_node_1
+connection foo_node_1;
+FLUSH TABLES;
+SELECT * FROM mysql.roles_mapping;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping`
+SELECT * FROM test1.t1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t1`
+SELECT a FROM test1.t2;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t2`
+SHOW GRANTS;
+Grants for foo@localhost
+GRANT USAGE ON *.* TO `foo`@`localhost`
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES;
+ROLE_NAME
+NULL
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES;
+ROLE_NAME
+NULL
+SELECT CURRENT_ROLE();
+CURRENT_ROLE()
+role1
+
+# Connect with foo_node_2
+connection foo_node_2;
+FLUSH TABLES;
+SELECT * FROM mysql.roles_mapping;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `mysql`.`roles_mapping`
+SELECT * FROM test1.t1;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t1`
+SELECT a FROM test1.t2;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `test1`.`t2`
+SHOW GRANTS;
+Grants for foo@localhost
+GRANT USAGE ON *.* TO `foo`@`localhost`
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES;
+ROLE_NAME
+NULL
+SELECT * FROM INFORMATION_SCHEMA.ENABLED_ROLES;
+ROLE_NAME
+NULL
+SELECT CURRENT_ROLE();
+CURRENT_ROLE()
+role1
+disconnect foo_node_2;
+# Connect with node_1
+connection node_1;
+DROP USER foo@localhost;
+DROP DATABASE test1;
+#
+# MDEV-10566: Create role statement replicated inconsistently in Galera Cluster
+#
+
+# On node_1
+connection node_1;
+CREATE USER foo@localhost;
+CREATE ROLE role1;
+CREATE ROLE role2 WITH ADMIN CURRENT_USER;
+CREATE ROLE role3 WITH ADMIN foo@localhost;
+CREATE ROLE role4 WITH ADMIN role1;
+SELECT * FROM mysql.roles_mapping;
+Host User Role Admin_option
+ role1 role4 Y
+localhost foo role3 Y
+localhost root role1 Y
+localhost root role2 Y
+SELECT * FROM INFORMATION_SCHEMA.APPLICABLE_ROLES;
+GRANTEE ROLE_NAME IS_GRANTABLE IS_DEFAULT
+role1 role4 YES NULL
+root@localhost role1 YES NO
+root@localhost role2 YES NO
+
+# On node_2
+connection node_2;
+SELECT * FROM mysql.roles_mapping;
+Host User Role Admin_option
+ role1 role4 Y
+localhost foo role3 Y
+localhost root role1 Y
+localhost root role2 Y
+SELECT * FROM INFORMATION_SCHEMA.APPLICABLE_ROLES;
+GRANTEE ROLE_NAME IS_GRANTABLE IS_DEFAULT
+role1 role4 YES NULL
+root@localhost role1 YES NO
+root@localhost role2 YES NO
+DROP ROLE role1;
+DROP ROLE role2;
+DROP ROLE role3;
+DROP ROLE role4;
+DROP USER foo@localhost;
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/galera_rsu_add_pk.result b/mysql-test/suite/galera/r/galera_rsu_add_pk.result
new file mode 100644
index 00000000..a38f3ff3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_rsu_add_pk.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;;
+connection node_2;
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_OSU_method = "TOI";
+INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+SELECT COUNT(*) AS EXPECT_300000 FROM t1;
+EXPECT_300000
+300000
+SELECT MAX(f1) AS EXPECT_299999 FROM t1;
+EXPECT_299999
+299999
+connection node_1;
+SELECT COUNT(*) AS EXPECT_300000 FROM t1;
+EXPECT_300000
+300000
+SELECT MAX(f1) AS EXPECT_299999 FROM t1;
+EXPECT_299999
+299999
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_OSU_method = "TOI";
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_rsu_drop_pk.result b/mysql-test/suite/galera/r/galera_rsu_drop_pk.result
new file mode 100644
index 00000000..61aa5f01
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_rsu_drop_pk.result
@@ -0,0 +1,50 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;;
+connection node_2;
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 DROP PRIMARY KEY;
+SET SESSION wsrep_OSU_method = "TOI";
+INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+SELECT COUNT(*) as expect_300000 FROM t1;
+expect_300000
+300000
+SELECT MAX(f1) as expect_299999 FROM t1;
+expect_299999
+299999
+connection node_1;
+SELECT COUNT(*) as expect_300000 FROM t1;
+expect_300000
+300000
+SELECT MAX(f1) as expect_299999 FROM t1;
+expect_299999
+299999
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 DROP PRIMARY KEY;
+SET SESSION wsrep_OSU_method = "TOI";
+connection node_2;
+INSERT INTO t1 (f1) VALUES (1);
+INSERT INTO t1 (f1) VALUES (10);
+connection node_1;
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 1;
+expect_2
+2
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 10;
+expect_2
+2
+INSERT INTO t1 (f1) VALUES (100);
+INSERT INTO t1 (f1) VALUES (1000);
+connection node_2;
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 100;
+expect_2
+2
+SELECT COUNT(*) as expect_2 FROM t1 WHERE f1 = 1000;
+expect_2
+2
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_rsu_error.result b/mysql-test/suite/galera/r/galera_rsu_error.result
new file mode 100644
index 00000000..f78e8fa5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_rsu_error.result
@@ -0,0 +1,26 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t1 VALUES (1), (1);
+connection node_2;
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+SET SESSION wsrep_OSU_method = "TOI";
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 't1';
+COUNT(*) = 0
+1
+INSERT INTO t1 VALUES (1);
+connection node_1;
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 't1';
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(3) = 4 FROM t1;
+COUNT(3) = 4
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_rsu_simple.result b/mysql-test/suite/galera/r/galera_rsu_simple.result
new file mode 100644
index 00000000..d75ef094
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_rsu_simple.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+connection node_2;
+SET SESSION wsrep_OSU_method = "RSU";
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+connection node_1;
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 1
+1
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+INSERT INTO t1 (f1) VALUES (2);
+connection node_1;
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result b/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result
new file mode 100644
index 00000000..54af2e68
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result
@@ -0,0 +1,54 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+SET GLOBAL wsrep_desync=1;
+SET wsrep_OSU_method=RSU;
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET GLOBAL wsrep_desync=0;
+SET DEBUG_SYNC= 'now SIGNAL continue';
+connection node_1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SHOW VARIABLES LIKE 'wsrep_desync';
+Variable_name Value
+wsrep_desync OFF
+SET wsrep_OSU_method=TOI;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+SET GLOBAL wsrep_desync=0;
+Warnings:
+Warning 1231 'wsrep_desync' is already OFF.
+SET wsrep_OSU_method=RSU;
+SET DEBUG_SYNC = 'alter_table_before_create_table_no_lock WAIT_FOR continue';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+connection node_1a;
+SET GLOBAL wsrep_desync=1;;
+connection node_1b;
+SET DEBUG_SYNC= 'now SIGNAL continue';
+connection node_1;
+connection node_1a;
+SET GLOBAL wsrep_desync=0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL,
+ `f2` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SET wsrep_OSU_method=TOI;
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+CALL mtr.add_suppression("Protocol violation");
+CALL mtr.add_suppression("desync failed");
+connection node_2;
+CALL mtr.add_suppression("Protocol violation");
diff --git a/mysql-test/suite/galera/r/galera_savepoint_replay.result b/mysql-test/suite/galera/r/galera_savepoint_replay.result
new file mode 100644
index 00000000..afea5f82
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_savepoint_replay.result
@@ -0,0 +1,53 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+f1 f2
+2 a
+SAVEPOINT my_sp;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+wsrep_local_replays
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_sbr.result b/mysql-test/suite/galera/r/galera_sbr.result
new file mode 100644
index 00000000..c5fdecec
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sbr.result
@@ -0,0 +1,19 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET SESSION binlog_format = 'STATEMENT';
+Warnings:
+Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET SESSION binlog_format = 'MIXED';
+Warnings:
+Warning 1105 MariaDB Galera and flashback do not support binlog format: MIXED
+INSERT INTO t1 VALUES (2);
+connection node_2;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
+connection node_1;
+SET GLOBAL binlog_format = 'ROW';
diff --git a/mysql-test/suite/galera/r/galera_sbr_binlog.result b/mysql-test/suite/galera/r/galera_sbr_binlog.result
new file mode 100644
index 00000000..c5fdecec
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sbr_binlog.result
@@ -0,0 +1,19 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET SESSION binlog_format = 'STATEMENT';
+Warnings:
+Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET SESSION binlog_format = 'MIXED';
+Warnings:
+Warning 1105 MariaDB Galera and flashback do not support binlog format: MIXED
+INSERT INTO t1 VALUES (2);
+connection node_2;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
+connection node_1;
+SET GLOBAL binlog_format = 'ROW';
diff --git a/mysql-test/suite/galera/r/galera_schema.result b/mysql-test/suite/galera/r/galera_schema.result
new file mode 100644
index 00000000..a43a5d9f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_schema.result
@@ -0,0 +1,114 @@
+connection node_2;
+connection node_1;
+CREATE TABLE IF NOT EXISTS wsrep_cluster
+(
+cluster_uuid CHAR(36) PRIMARY KEY,
+view_id BIGINT NOT NULL,
+view_seqno BIGINT NOT NULL,
+protocol_version INT NOT NULL,
+capabilities INT NOT NULL
+) ENGINE=InnoDB;
+CREATE TABLE IF NOT EXISTS wsrep_cluster_members
+(
+node_uuid CHAR(36) PRIMARY KEY,
+cluster_uuid CHAR(36) NOT NULL,
+node_name CHAR(32) NOT NULL,
+node_incoming_address VARCHAR(256) NOT NULL
+) ENGINE=InnoDB;
+CREATE TABLE IF NOT EXISTS wsrep_cluster_members_history
+(
+node_uuid CHAR(36) PRIMARY KEY,
+cluster_uuid CHAR(36) NOT NULL,
+last_view_id BIGINT NOT NULL,
+last_view_seqno BIGINT NOT NULL,
+node_name CHAR(32) NOT NULL,
+node_incoming_address VARCHAR(256) NOT NULL
+) ENGINE=InnoDB;
+CREATE TABLE IF NOT EXISTS wsrep_streaming_log
+(
+node_uuid CHAR(36),
+trx_id BIGINT,
+seqno BIGINT,
+flags INT NOT NULL,
+frag LONGBLOB NOT NULL,
+PRIMARY KEY (node_uuid, trx_id, seqno)
+) ENGINE=InnoDB;
+DELETE FROM wsrep_cluster;
+DELETE FROM wsrep_cluster_members;
+ALTER TABLE wsrep_cluster STATS_PERSISTENT=0;
+ALTER TABLE wsrep_cluster_members STATS_PERSISTENT=0;
+ALTER TABLE wsrep_cluster_members_history STATS_PERSISTENT=0;
+ALTER TABLE wsrep_streaming_log STATS_PERSISTENT=0;
+SHOW CREATE TABLE wsrep_cluster;
+Table Create Table
+wsrep_cluster CREATE TABLE `wsrep_cluster` (
+ `cluster_uuid` char(36) NOT NULL,
+ `view_id` bigint(20) NOT NULL,
+ `view_seqno` bigint(20) NOT NULL,
+ `protocol_version` int(11) NOT NULL,
+ `capabilities` int(11) NOT NULL,
+ PRIMARY KEY (`cluster_uuid`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0
+SHOW CREATE TABLE wsrep_cluster_members;
+Table Create Table
+wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` (
+ `node_uuid` char(36) NOT NULL,
+ `cluster_uuid` char(36) NOT NULL,
+ `node_name` char(32) NOT NULL,
+ `node_incoming_address` varchar(256) NOT NULL,
+ PRIMARY KEY (`node_uuid`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0
+SHOW CREATE TABLE wsrep_cluster_members_history;
+Table Create Table
+wsrep_cluster_members_history CREATE TABLE `wsrep_cluster_members_history` (
+ `node_uuid` char(36) NOT NULL,
+ `cluster_uuid` char(36) NOT NULL,
+ `last_view_id` bigint(20) NOT NULL,
+ `last_view_seqno` bigint(20) NOT NULL,
+ `node_name` char(32) NOT NULL,
+ `node_incoming_address` varchar(256) NOT NULL,
+ PRIMARY KEY (`node_uuid`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0
+SHOW CREATE TABLE wsrep_streaming_log;
+Table Create Table
+wsrep_streaming_log CREATE TABLE `wsrep_streaming_log` (
+ `node_uuid` char(36) NOT NULL,
+ `trx_id` bigint(20) NOT NULL,
+ `seqno` bigint(20) NOT NULL,
+ `flags` int(11) NOT NULL,
+ `frag` longblob NOT NULL,
+ PRIMARY KEY (`node_uuid`,`trx_id`,`seqno`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0
+SHOW CREATE TABLE mysql.wsrep_cluster;
+Table Create Table
+wsrep_cluster CREATE TABLE `wsrep_cluster` (
+ `cluster_uuid` char(36) NOT NULL,
+ `view_id` bigint(20) NOT NULL,
+ `view_seqno` bigint(20) NOT NULL,
+ `protocol_version` int(11) NOT NULL,
+ `capabilities` int(11) NOT NULL,
+ PRIMARY KEY (`cluster_uuid`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0
+SHOW CREATE TABLE mysql.wsrep_cluster_members;
+Table Create Table
+wsrep_cluster_members CREATE TABLE `wsrep_cluster_members` (
+ `node_uuid` char(36) NOT NULL,
+ `cluster_uuid` char(36) NOT NULL,
+ `node_name` char(32) NOT NULL,
+ `node_incoming_address` varchar(256) NOT NULL,
+ PRIMARY KEY (`node_uuid`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0
+SHOW CREATE TABLE mysql.wsrep_streaming_log;
+Table Create Table
+wsrep_streaming_log CREATE TABLE `wsrep_streaming_log` (
+ `node_uuid` char(36) NOT NULL,
+ `trx_id` bigint(20) NOT NULL,
+ `seqno` bigint(20) NOT NULL,
+ `flags` int(11) NOT NULL,
+ `frag` longblob NOT NULL,
+ PRIMARY KEY (`node_uuid`,`trx_id`,`seqno`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci STATS_PERSISTENT=0
+DROP TABLE wsrep_cluster;
+DROP TABLE wsrep_cluster_members;
+DROP TABLE wsrep_cluster_members_history;
+DROP TABLE wsrep_streaming_log;
diff --git a/mysql-test/suite/galera/r/galera_schema_dirty_reads.result b/mysql-test/suite/galera/r/galera_schema_dirty_reads.result
new file mode 100644
index 00000000..fbac9ff4
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_schema_dirty_reads.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+USE information_schema;
+SELECT * FROM SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep_dirty_reads";
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_DIRTY_READS OFF
+SET GLOBAL wsrep_reject_queries=ALL;
+SELECT * FROM SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep_dirty_reads";
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_DIRTY_READS OFF
+SET GLOBAL wsrep_reject_queries=NONE;
+SET SESSION wsrep_dirty_reads=TRUE;
+SELECT * FROM SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep_dirty_reads";
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_DIRTY_READS ON
diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result
new file mode 100644
index 00000000..1a5219c2
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sequences.result
@@ -0,0 +1,316 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB;
+SHOW CREATE SEQUENCE seq;
+Table Create Table
+seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB
+connection node_2;
+SHOW CREATE SEQUENCE seq;
+Table Create Table
+seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 1000000 increment by 0 cache 1000 nocycle ENGINE=InnoDB
+connection node_1;
+ALTER SEQUENCE seq MAXVALUE = 10000 NOCACHE;
+SHOW CREATE SEQUENCE seq;
+Table Create Table
+seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 10000 increment by 0 nocache nocycle ENGINE=InnoDB
+connection node_2;
+SHOW CREATE SEQUENCE seq;
+Table Create Table
+seq CREATE SEQUENCE `seq` start with 1 minvalue 1 maxvalue 10000 increment by 0 nocache nocycle ENGINE=InnoDB
+connection node_1;
+DROP SEQUENCE seq;
+SHOW CREATE SEQUENCE seq;
+ERROR 42S02: Table 'test.seq' doesn't exist
+connection node_2;
+SHOW CREATE SEQUENCE seq;
+ERROR 42S02: Table 'test.seq' doesn't exist
+connection node_1;
+CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE;
+select NEXT VALUE FOR Seq1_1;
+NEXT VALUE FOR Seq1_1
+1
+alter table Seq1_1 engine=myisam;
+ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster'
+select NEXT VALUE FOR Seq1_1;
+NEXT VALUE FOR Seq1_1
+2
+alter table Seq1_1 engine=innodb;
+select NEXT VALUE FOR Seq1_1;
+NEXT VALUE FOR Seq1_1
+3
+connection node_2;
+SHOW CREATE SEQUENCE Seq1_1;
+Table Create Table
+Seq1_1 CREATE SEQUENCE `Seq1_1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
+select NEXT VALUE FOR Seq1_1;
+NEXT VALUE FOR Seq1_1
+4
+connection node_1;
+DROP SEQUENCE Seq1_1;
+connection node_1;
+CREATE TABLE t2 (d CHAR(1)KEY);
+SET SESSION autocommit=0;
+INSERT INTO t2 VALUES(1);
+CREATE TEMPORARY SEQUENCE seq1 NOCACHE ENGINE=INNODB;
+CREATE SEQUENCE seq2 NOCACHE ENGINE=INNODB;
+COMMIT;
+SET SESSION AUTOCOMMIT=1;
+SHOW CREATE TABLE seq1;
+Table Create Table
+seq1 CREATE TEMPORARY TABLE `seq1` (
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
+ `increment` bigint(21) NOT NULL COMMENT 'increment value',
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
+) ENGINE=InnoDB SEQUENCE=1
+connection node_2;
+SHOW CREATE SEQUENCE seq1;
+ERROR 42S02: Table 'test.seq1' doesn't exist
+SHOW CREATE SEQUENCE seq2;
+Table Create Table
+seq2 CREATE SEQUENCE `seq2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
+connection node_1;
+SET SESSION autocommit=1;
+DROP SEQUENCE seq1;
+DROP SEQUENCE seq2;
+DROP TABLE t2;
+connection node_2;
+SET SESSION AUTOCOMMIT=0;
+SET SESSION wsrep_OSU_method='RSU';
+CREATE TABLE t1(c1 VARCHAR(10));
+create temporary sequence sq1 NOCACHE engine=innodb;
+create sequence sq2 NOCACHE engine=innodb;
+COMMIT;
+SET SESSION wsrep_OSU_method='TOI';
+SHOW CREATE SEQUENCE sq1;
+Table Create Table
+sq1 CREATE SEQUENCE `sq1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
+SHOW CREATE SEQUENCE sq2;
+Table Create Table
+sq2 CREATE SEQUENCE `sq2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
+connection node_1;
+SHOW CREATE SEQUENCE sq1;
+ERROR 42S02: Table 'test.sq1' doesn't exist
+SHOW CREATE SEQUENCE sq2;
+ERROR 42S02: Table 'test.sq2' doesn't exist
+connection node_2;
+SET SESSION AUTOCOMMIT=1;
+DROP TABLE t1;
+DROP SEQUENCE sq1;
+DROP SEQUENCE sq2;
+connection node_1;
+CREATE TABLE t (f INT) engine=innodb;
+LOCK TABLE t WRITE;
+CREATE OR REPLACE SEQUENCE t MAXVALUE=13 INCREMENT BY 1 NOCACHE engine=innodb;
+Warnings:
+Warning 138 Galera cluster does not support LOCK TABLE on SEQUENCES. Lock is released.
+LOCK TABLE t WRITE;
+ERROR 42000: This version of MariaDB doesn't yet support 'LOCK TABLE on SEQUENCES in Galera cluster'
+INSERT INTO t VALUES (0,0,1,1,1,0,0,0);
+SELECT * from t;
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
+0 0 1 1 1 0 0 0
+SELECT NEXTVAL(t);
+NEXTVAL(t)
+0
+UNLOCK TABLES;
+DROP TABLE t;
+CREATE SEQUENCE t INCREMENT BY 0 NOCACHE ENGINE=INNODB;
+CREATE TABLE t1(a int not null primary key default nextval(t),
+b int) engine=innodb;
+INSERT INTO t1(b) VALUES (1),(2),(3);
+SELECT * FROM t1;
+a b
+1 1
+3 2
+5 3
+connection node_2;
+SELECT * FROM t1;
+a b
+1 1
+3 2
+5 3
+INSERT INTO t1(b) VALUES (4),(5),(6);
+SELECT * FROM t1;
+a b
+1 1
+3 2
+5 3
+8 4
+10 5
+12 6
+connection node_1;
+SELECT * FROM t1;
+a b
+1 1
+3 2
+5 3
+8 4
+10 5
+12 6
+DROP TABLE t1;
+DROP SEQUENCE t;
+CREATE SEQUENCE t ENGINE=MYISAM;
+ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster'
+SHOW CREATE SEQUENCE t;
+ERROR 42S02: Table 'test.t' doesn't exist
+SHOW CREATE TABLE t;
+ERROR 42S02: Table 'test.t' doesn't exist
+connection node_2;
+SHOW CREATE SEQUENCE t;
+ERROR 42S02: Table 'test.t' doesn't exist
+SHOW CREATE TABLE t;
+ERROR 42S02: Table 'test.t' doesn't exist
+connection node_1;
+CREATE SEQUENCE t NOCACHE ENGINE=InnoDB;
+ALTER TABLE t ENGINE=MyISAM;
+ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster'
+SHOW CREATE SEQUENCE t;
+Table Create Table
+t CREATE SEQUENCE `t` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
+ `increment` bigint(21) NOT NULL COMMENT 'increment value',
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
+) ENGINE=InnoDB SEQUENCE=1
+connection node_2;
+SHOW CREATE SEQUENCE t;
+Table Create Table
+t CREATE SEQUENCE `t` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
+ `increment` bigint(21) NOT NULL COMMENT 'increment value',
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
+) ENGINE=InnoDB SEQUENCE=1
+connection node_1;
+DROP SEQUENCE t;
+CREATE SEQUENCE t INCREMENT BY 1 NOCACHE ENGINE=INNODB;
+CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
+connection node_2;
+# Wait DDL to replicate
+connection node_1;
+SELECT @@auto_increment_increment;
+@@auto_increment_increment
+2
+SELECT @@auto_increment_offset;
+@@auto_increment_offset
+1
+SET SESSION wsrep_sync_wait=0;
+connection node_2;
+SELECT @@auto_increment_increment;
+@@auto_increment_increment
+2
+SELECT @@auto_increment_offset;
+@@auto_increment_offset
+2
+SET SESSION wsrep_sync_wait=0;
+connection node_1;
+connection node_2;
+connection node_1;
+DROP SEQUENCE t;
+DROP TABLE t1;
+CREATE SEQUENCE t INCREMENT BY 0 NOCACHE ENGINE=INNODB;
+DROP SEQUENCE t;
+CREATE SEQUENCE t INCREMENT BY 1 CACHE=20 ENGINE=INNODB;
+ERROR 42000: This version of MariaDB doesn't yet support 'CACHE without INCREMENT BY 0 in Galera cluster'
+CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
+CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
+connection node_2;
+# Wait DDL to replicate
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+connection node_2;
+SET SESSION wsrep_sync_wait=0;
+connection node_1;
+connection node_2;
+connection node_1;
+DROP SEQUENCE t;
+DROP TABLE t1;
+CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
+ALTER TABLE t ENGINE=MYISAM;
+ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster'
+ALTER SEQUENCE t INCREMENT BY 1 CACHE=10;
+ERROR 42000: This version of MariaDB doesn't yet support 'CACHE without INCREMENT BY 0 in Galera cluster'
+ALTER SEQUENCE t INCREMENT BY 1 NOCACHE;
+ALTER SEQUENCE t INCREMENT BY 0 NOCACHE;
+ALTER SEQUENCE t INCREMENT BY 0 CACHE=10;
+DROP SEQUENCE t;
+CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
+CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
+BEGIN;
+INSERT INTO t1(b) VALUES (1);
+INSERT INTO t1(b) VALUES (2);
+INSERT INTO t1(b) VALUES (3);
+INSERT INTO t1(b) VALUES (4);
+INSERT INTO t1(a,b) VALUES (2,2);
+INSERT INTO t1(a,b) VALUES (3,2);
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
+ROLLBACK;
+SELECT * FROM t1;
+a b
+SELECT NEXTVAL(t);
+NEXTVAL(t)
+9
+connection node_2;
+SELECT * FROM t1;
+a b
+SELECT NEXTVAL(t);
+NEXTVAL(t)
+2
+connection node_1;
+DROP TABLE t1;
+DROP SEQUENCE t;
+CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB;
+CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
+BEGIN;
+INSERT INTO t1(b) VALUES (1);
+INSERT INTO t1(b) VALUES (2);
+INSERT INTO t1(b) VALUES (3);
+INSERT INTO t1(b) VALUES (4);
+INSERT INTO t1(a,b) VALUES (2,2);
+INSERT INTO t1(a,b) VALUES (3,2);
+ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
+COMMIT;
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 2
+5 3
+7 4
+SELECT NEXTVAL(t);
+NEXTVAL(t)
+9
+connection node_2;
+SELECT * FROM t1;
+a b
+1 1
+2 2
+3 2
+5 3
+7 4
+SELECT NEXTVAL(t);
+NEXTVAL(t)
+42
+connection node_1;
+DROP TABLE t1;
+DROP SEQUENCE t;
diff --git a/mysql-test/suite/galera/r/galera_serializable.result b/mysql-test/suite/galera/r/galera_serializable.result
new file mode 100644
index 00000000..e3785663
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_serializable.result
@@ -0,0 +1,39 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+START TRANSACTION;
+SELECT * FROM t1;
+id f2
+connection node_2;
+INSERT INTO t1 VALUES (1,1);
+connection node_1;
+SELECT * FROM t1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+DELETE FROM t1;
+connection node_1;
+INSERT INTO t1 VALUES (1,1);
+START TRANSACTION;
+SELECT * FROM t1;
+id f2
+1 1
+connection node_2;
+UPDATE t1 SET f2 = 2;
+connection node_1;
+UPDATE t1 SET f2 = 3;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+DELETE FROM t1;
+connection node_1;
+START TRANSACTION;
+connection node_1;
+INSERT INTO t1 VALUES (1,1);
+connection node_2;
+INSERT INTO t1 VALUES (1,2);
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_server.result b/mysql-test/suite/galera/r/galera_server.result
new file mode 100644
index 00000000..5130dee3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_server.result
@@ -0,0 +1,28 @@
+connection node_2;
+connection node_1;
+connection node_1;
+# On node_1
+CREATE SERVER s1
+FOREIGN DATA WRAPPER mysql
+OPTIONS (HOST 'foo');
+connection node_2;
+# On node_2
+SELECT * FROM mysql.servers;
+Server_name Host Db Username Password Port Socket Wrapper Owner
+s1 foo 3306 mysql
+ALTER SERVER s1
+OPTIONS (HOST 'bar');
+connection node_1;
+# On node_1
+SELECT * FROM mysql.servers;
+Server_name Host Db Username Password Port Socket Wrapper Owner
+s1 bar 3306 mysql
+DROP SERVER s1;
+connection node_2;
+# On node_2
+SELECT COUNT(*)=0 FROM mysql.servers;
+COUNT(*)=0
+1
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/galera_set_position_after_cert_failure.result b/mysql-test/suite/galera/r/galera_set_position_after_cert_failure.result
new file mode 100644
index 00000000..7717428b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_set_position_after_cert_failure.result
@@ -0,0 +1,36 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
+SET GLOBAL wsrep_slave_threads = 2;
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
+connection node_1;
+INSERT INTO t1 VALUES (1, 'node_1');;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_retry_autocommit = 0;
+INSERT INTO t1 VALUES (1, 'node_2');;
+connection node_2a;
+SET SESSION wsrep_sync_wait = 0;
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1;
+connection node_2a;
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "RESET";
+disconnect node_2a;
+connection node_2;
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+Performing --wsrep-recover ...
+connection node_2;
+Using --wsrep-start-position when starting mysqld ...
+connection node_1;
+DROP TABLE t1;
+SET GLOBAL wsrep_slave_threads = DEFAULT;
diff --git a/mysql-test/suite/galera/r/galera_set_position_after_dummy_writeset.result b/mysql-test/suite/galera/r/galera_set_position_after_dummy_writeset.result
new file mode 100644
index 00000000..da398b76
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_set_position_after_dummy_writeset.result
@@ -0,0 +1,36 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
+SET GLOBAL wsrep_slave_threads = 2;
+SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
+connection node_2;
+INSERT INTO t1 VALUES (1, 'node_2');;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait=0;
+SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_retry_autocommit = 0;
+INSERT INTO t1 VALUES (1, 'node_1');;
+connection node_1a;
+SET GLOBAL DEBUG_DBUG = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+connection node_2;
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+Performing --wsrep-recover ...
+connection node_2;
+Using --wsrep-start-position when starting mysqld ...
+connection node_1;
+DROP TABLE t1;
+SET GLOBAL wsrep_slave_threads = DEFAULT;
+connection node_1a;
+SET GLOBAL DEBUG_DBUG=NULL;
+SET DEBUG_SYNC = "RESET";
diff --git a/mysql-test/suite/galera/r/galera_shutdown_nonprim.result b/mysql-test/suite/galera/r/galera_shutdown_nonprim.result
new file mode 100644
index 00000000..8b769743
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_shutdown_nonprim.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+SET GLOBAL wsrep_provider_options = 'pc.weight=2';
+connection node_2;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+SET GLOBAL wsrep_provider_options = 'pc.weight = 1';
diff --git a/mysql-test/suite/galera/r/galera_slave_replay.result b/mysql-test/suite/galera/r/galera_slave_replay.result
new file mode 100644
index 00000000..8fb7e1ab
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_slave_replay.result
@@ -0,0 +1,96 @@
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+connection node_2;
+connection node_1;
+ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+RESET MASTER;
+connection node_2a;
+START SLAVE;
+connection node_3;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (3, 'a');
+set binlog_format=STATEMENT;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+SELECT * FROM t1 FOR UPDATE;
+f1 f2
+1 a
+3 a
+UPDATE t1 SET f2 = 'c' WHERE f1 > 1;
+connection node_2a;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_1;
+INSERT INTO test.t1 VALUES (2, 'b');
+connection node_3;
+COMMIT;
+connection node_2a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2a;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+connection node_3;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+SELECT * FROM t1;
+f1 f2
+1 a
+3 c
+connection node_2a;
+set session wsrep_sync_wait=15;
+set session wsrep_sync_wait=0;
+wsrep_local_replays
+1
+SELECT * FROM t1;
+f1 f2
+1 a
+2 b
+3 c
+SET DEBUG_SYNC = "RESET";
+#
+# test phase with real abort
+#
+connection node_3;
+set binlog_format=ROW;
+insert into t1 values (4, 'd');
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'd' WHERE f1 = 3;
+connection node_2a;
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_1;
+UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3;
+connection node_2a;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_3;
+COMMIT;
+connection node_2a;
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2a;
+set session wsrep_sync_wait=15;
+SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e';
+COUNT(*) = 1
+1
+set session wsrep_sync_wait=0;
+STOP SLAVE;
+RESET SLAVE;
+SET DEBUG_SYNC = "RESET";
+DROP TABLE t1;
+connection node_3;
+DROP TABLE t1;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_sp_bf_abort.result b/mysql-test/suite/galera/r/galera_sp_bf_abort.result
new file mode 100644
index 00000000..9216cc4f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sp_bf_abort.result
@@ -0,0 +1,356 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+CREATE PROCEDURE proc_update_insert()
+BEGIN
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+CALL proc_update_insert;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_update_insert_with_exit_handler()
+BEGIN
+DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN END;
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+CALL proc_update_insert_with_exit_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_update_insert_with_continue_handler()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+CALL proc_update_insert_with_continue_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_update_insert_transaction()
+BEGIN
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+COMMIT;
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+CALL proc_update_insert_transaction;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_update_insert_transaction_with_continue_handler()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+COMMIT;
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+CALL proc_update_insert_transaction_with_continue_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_update_insert_transaction_with_exit_handler()
+BEGIN
+DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN END;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b';
+INSERT INTO t1 VALUES (4, 'd');
+COMMIT;
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+CALL proc_update_insert_transaction_with_exit_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 b
+2 c
+3 b
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_insert_insert_conflict()
+BEGIN
+INSERT INTO t1 VALUES (2, 'd');
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+CALL proc_insert_insert_conflict;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+Got one of the listed errors
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 c
+3 a
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_insert_insert_conflict_with_exit_handler()
+BEGIN
+DECLARE EXIT HANDLER FOR SQLEXCEPTION SELECT "Conflict exit handler";
+INSERT INTO t1 VALUES (2, 'd');
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+CALL proc_insert_insert_conflict_with_exit_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+Conflict exit handler
+Conflict exit handler
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 c
+3 a
+wsrep_local_replays
+1
+DELETE FROM t1;
+connection node_1;
+CREATE PROCEDURE proc_insert_insert_conflict_with_continue_handler()
+BEGIN
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT "Conflict continue handler";
+INSERT INTO t1 VALUES (2, 'd');
+INSERT INTO t1 VALUES (4, 'd');
+END|
+INSERT INTO t1 VALUES (1, 'a'), (3, 'a');
+SET SESSION wsrep_sync_wait = 0;
+connection node_1a;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES (2, 'c');
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync';
+connection node_1;
+CALL proc_insert_insert_conflict_with_continue_handler;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync';
+connection node_1;
+Conflict continue handler
+Conflict continue handler
+SET SESSION wsrep_sync_wait = default;
+SELECT * FROM t1;
+f1 f2
+1 a
+2 c
+3 a
+4 d
+wsrep_local_replays
+1
+DELETE FROM t1;
+DROP PROCEDURE proc_update_insert;
+DROP PROCEDURE proc_update_insert_with_continue_handler;
+DROP PROCEDURE proc_update_insert_with_exit_handler;
+DROP PROCEDURE proc_update_insert_transaction;
+DROP PROCEDURE proc_update_insert_transaction_with_continue_handler;
+DROP PROCEDURE proc_update_insert_transaction_with_exit_handler;
+DROP PROCEDURE proc_insert_insert_conflict;
+DROP PROCEDURE proc_insert_insert_conflict_with_exit_handler;
+DROP PROCEDURE proc_insert_insert_conflict_with_continue_handler;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_sp_insert_parallel.result b/mysql-test/suite/galera/r/galera_sp_insert_parallel.result
new file mode 100644
index 00000000..3f072be7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sp_insert_parallel.result
@@ -0,0 +1,41 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+CREATE PROCEDURE proc_insert()
+BEGIN
+DECLARE i INT;
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
+SET i = 0;
+WHILE i < 1000 DO
+INSERT IGNORE INTO t1 (f1, f2)
+VALUES (FLOOR(1 + RAND() * 65535), FLOOR(1 + RAND() * 15)),
+(FLOOR(1 + RAND() * 65535), FLOOR(1 + RAND() * 15)),
+(FLOOR(1 + RAND() * 65535), FLOOR(1 + RAND() * 15)),
+(FLOOR(1 + RAND() * 65535), FLOOR(1 + RAND() * 15)),
+(FLOOR(1 + RAND() * 65535), FLOOR(1 + RAND() * 15)),
+(FLOOR(1 + RAND() * 65535), FLOOR(1 + RAND() * 15)),
+(FLOOR(1 + RAND() * 65535), FLOOR(1 + RAND() * 15)),
+(FLOOR(1 + RAND() * 65535), FLOOR(1 + RAND() * 15)),
+(FLOOR(1 + RAND() * 65535), FLOOR(1 + RAND() * 15));
+SET i = i + 1;
+END WHILE;
+END|
+connection node_1;
+SELECT 0;
+0
+0
+SET SESSION wsrep_sync_wait = 0;
+CALL proc_insert;
+connection node_2;
+SELECT 0;
+0
+0
+SET SESSION wsrep_sync_wait = 0;
+CALL proc_insert;
+connection node_1;
+SET SESSION wsrep_sync_wait = default;
+connection node_2;
+SET SESSION wsrep_sync_wait = default;
+connection node_1;
+DROP PROCEDURE proc_insert;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_split_brain.result b/mysql-test/suite/galera/r/galera_split_brain.result
new file mode 100644
index 00000000..374fb31a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_split_brain.result
@@ -0,0 +1,17 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+call mtr.add_suppression("WSREP: TO isolation failed for: ");
+connection node_1;
+call mtr.add_suppression("CREATE TABLE isolation failure");
+connection node_2;
+Killing server ...
+connection node_1;
+SET SESSION lock_wait_timeout= 3;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection node_2;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result b/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result
new file mode 100644
index 00000000..e9f81192
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sql_log_bin_zero.result
@@ -0,0 +1,16 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION sql_log_bin = 0;
+INSERT INTO t1 VALUES (1);
+SET SESSION sql_log_bin = 1;
+INSERT INTO t1 VALUES (2);
+connection node_2;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1;
+COUNT(*) = 1
+1
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ssl.result b/mysql-test/suite/galera/r/galera_ssl.result
new file mode 100644
index 00000000..ec3b717e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ssl.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_ssl_compression.result b/mysql-test/suite/galera/r/galera_ssl_compression.result
new file mode 100644
index 00000000..0acc4b97
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ssl_compression.result
@@ -0,0 +1,28 @@
+connection node_2;
+connection node_1;
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+connection node_2;
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+connection node_1;
+SET GLOBAL wsrep_provider_options = "socket.ssl_compression=No";
+ERROR HY000: Incorrect arguments to SET
+CREATE TABLE t1 (f1 VARCHAR(333) PRIMARY KEY, f2 BLOB) Engine=InnoDB;
+INSERT INTO t1 VALUES (REPEAT('a', 333), REPEAT('b', 65535));
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('a', 333) AND f2 = REPEAT('b', 65535);
+COUNT(*) = 1
+1
+connection node_1;
+DROP TABLE t1;
+CALL mtr.add_suppression("Unknown parameter 'socket\.ssl_compression'");
+CALL mtr.add_suppression("Set options returned 7");
diff --git a/mysql-test/suite/galera/r/galera_ssl_upgrade.result b/mysql-test/suite/galera/r/galera_ssl_upgrade.result
new file mode 100644
index 00000000..9993b86e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_ssl_upgrade.result
@@ -0,0 +1,33 @@
+connection node_2;
+connection node_1;
+connection node_1;
+call mtr.add_suppression("WSREP: write_handler().*");
+connection node_2;
+call mtr.add_suppression("WSREP: write_handler():.*");
+connection node_1;
+connection node_2;
+connection node_1;
+connection node_2;
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+connection node_1;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+connection node_2;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+connection node_1;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: write_handler().*");
+connection node_2;
+call mtr.add_suppression("WSREP: write_handler():.*");
diff --git a/mysql-test/suite/galera/r/galera_sst_encrypted.result b/mysql-test/suite/galera/r/galera_sst_encrypted.result
new file mode 100644
index 00000000..52ca6e06
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_encrypted.result
@@ -0,0 +1,348 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff
new file mode 100644
index 00000000..3aad611c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff
@@ -0,0 +1,192 @@
+--- r/galera_sst_mariabackup.result
++++ r/galera_sst_mariabackup.reject
+@@ -516,5 +516,189 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
+ disconnect node_2;
+ disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup.result b/mysql-test/suite/galera/r/galera_sst_mariabackup.result
new file mode 100644
index 00000000..caf602c0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup.result
@@ -0,0 +1,520 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir,debug.rdiff
new file mode 100644
index 00000000..870b12de
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir,debug.rdiff
@@ -0,0 +1,192 @@
+--- r/galera_sst_mariabackup_data_dir.result 2021-04-10 14:26:02.798965488 +0300
++++ r/galera_sst_mariabackup_data_dir,debug.reject 2021-04-10 14:54:44.825538224 +0300
+@@ -516,5 +516,189 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
+ disconnect node_2;
+ disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir.result
new file mode 100644
index 00000000..caf602c0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir.result
@@ -0,0 +1,520 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key-openssl.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key-openssl.result
new file mode 100644
index 00000000..409da775
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key-openssl.result
@@ -0,0 +1,5 @@
+connection node_2;
+connection node_1;
+SELECT 1;
+1
+1
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key.result
new file mode 100644
index 00000000..f3a140c5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key.result
@@ -0,0 +1,6 @@
+connection node_2;
+connection node_1;
+SELECT 1;
+1
+1
+include/assert_grep.inc [Using openssl based encryption with socat]
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key_server.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key_server.result
new file mode 100644
index 00000000..f3a140c5
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_encrypt_with_key_server.result
@@ -0,0 +1,6 @@
+connection node_2;
+connection node_1;
+SELECT 1;
+1
+1
+include/assert_grep.inc [Using openssl based encryption with socat]
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff
new file mode 100644
index 00000000..bad8355b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff
@@ -0,0 +1,192 @@
+--- r/galera_sst_mariabackup.result 2021-04-10 14:25:04.142716409 +0300
++++ r/galera_sst_mariabackup,debug.reject 2021-04-10 14:53:30.033162191 +0300
+@@ -516,5 +516,189 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
+ disconnect node_2;
+ disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery.result
new file mode 100644
index 00000000..caf602c0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery.result
@@ -0,0 +1,520 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff
new file mode 100644
index 00000000..a9c796da
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff
@@ -0,0 +1,192 @@
+--- r/galera_sst_mariabackup_logarchive.result
++++ r/galera_sst_mariabackup_logarchive.reject
+@@ -516,5 +516,189 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
+ disconnect node_2;
+ disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive.result
new file mode 100644
index 00000000..c2bbb946
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive.result
@@ -0,0 +1,522 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+connection node_1;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_lost_found.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_lost_found.result
new file mode 100644
index 00000000..2d5705c6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_lost_found.result
@@ -0,0 +1,39 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+Shutting down server ...
+connection node_1;
+CREATE DATABASE `lost+found`;
+USE `lost+found`;
+CREATE TABLE t1(id INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT * FROM `lost+found`.t1;
+id
+1
+2
+CREATE DATABASE `#mysql50#not_lost+found`;
+USE `#mysql50#not_lost+found`;
+CREATE TABLE t1(id INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT * FROM `#mysql50#not_lost+found`.t1;
+id
+1
+2
+Cleaning var directory ...
+connection node_2;
+Starting server ...
+SELECT * FROM `lost+found`.t1;
+id
+1
+2
+SELECT * FROM `#mysql50#not_lost+found`.t1;
+id
+1
+2
+connection node_1;
+DROP DATABASE `lost+found`;
+DROP DATABASE `#mysql50#not_lost+found`;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_qpress.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_qpress.result
new file mode 100644
index 00000000..8e7d19ce
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_qpress.result
@@ -0,0 +1,6 @@
+connection node_2;
+connection node_1;
+SELECT 1;
+1
+1
+include/assert_grep.inc [Compressed qpress files found]
diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_table_options.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_table_options.result
new file mode 100644
index 00000000..568c06de
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_table_options.result
@@ -0,0 +1,999 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 CHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1;
+CREATE TABLE t3 (f1 CHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=NO;
+CREATE TABLE t4 (f1 CHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES;
+CREATE TABLE t5 (f1 CHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+CREATE TABLE t6 (f1 CHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=NO;
+CREATE TABLE t7 (f1 CHAR(255)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES;
+CREATE TABLE t8 (f1 CHAR(255)) ENGINE=InnoDB ENCRYPTED=NO;
+CREATE TABLE t9 (f1 CHAR(255)) ENGINE=InnoDB ENCRYPTED=YES;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+insert into t9 values ('node1_committed_before');
+insert into t9 values ('node1_committed_before');
+insert into t9 values ('node1_committed_before');
+insert into t9 values ('node1_committed_before');
+insert into t9 values ('node1_committed_before');
+insert into t8 values ('node1_committed_before');
+insert into t8 values ('node1_committed_before');
+insert into t8 values ('node1_committed_before');
+insert into t8 values ('node1_committed_before');
+insert into t8 values ('node1_committed_before');
+insert into t7 values ('node1_committed_before');
+insert into t7 values ('node1_committed_before');
+insert into t7 values ('node1_committed_before');
+insert into t7 values ('node1_committed_before');
+insert into t7 values ('node1_committed_before');
+insert into t6 values ('node1_committed_before');
+insert into t6 values ('node1_committed_before');
+insert into t6 values ('node1_committed_before');
+insert into t6 values ('node1_committed_before');
+insert into t6 values ('node1_committed_before');
+insert into t5 values ('node1_committed_before');
+insert into t5 values ('node1_committed_before');
+insert into t5 values ('node1_committed_before');
+insert into t5 values ('node1_committed_before');
+insert into t5 values ('node1_committed_before');
+insert into t4 values ('node1_committed_before');
+insert into t4 values ('node1_committed_before');
+insert into t4 values ('node1_committed_before');
+insert into t4 values ('node1_committed_before');
+insert into t4 values ('node1_committed_before');
+insert into t3 values ('node1_committed_before');
+insert into t3 values ('node1_committed_before');
+insert into t3 values ('node1_committed_before');
+insert into t3 values ('node1_committed_before');
+insert into t3 values ('node1_committed_before');
+insert into t2 values ('node1_committed_before');
+insert into t2 values ('node1_committed_before');
+insert into t2 values ('node1_committed_before');
+insert into t2 values ('node1_committed_before');
+insert into t2 values ('node1_committed_before');
+insert into t1 values ('node1_committed_before');
+insert into t1 values ('node1_committed_before');
+insert into t1 values ('node1_committed_before');
+insert into t1 values ('node1_committed_before');
+insert into t1 values ('node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+insert into t9 values ('node2_committed_before');
+insert into t9 values ('node2_committed_before');
+insert into t9 values ('node2_committed_before');
+insert into t9 values ('node2_committed_before');
+insert into t9 values ('node2_committed_before');
+insert into t8 values ('node2_committed_before');
+insert into t8 values ('node2_committed_before');
+insert into t8 values ('node2_committed_before');
+insert into t8 values ('node2_committed_before');
+insert into t8 values ('node2_committed_before');
+insert into t7 values ('node2_committed_before');
+insert into t7 values ('node2_committed_before');
+insert into t7 values ('node2_committed_before');
+insert into t7 values ('node2_committed_before');
+insert into t7 values ('node2_committed_before');
+insert into t6 values ('node2_committed_before');
+insert into t6 values ('node2_committed_before');
+insert into t6 values ('node2_committed_before');
+insert into t6 values ('node2_committed_before');
+insert into t6 values ('node2_committed_before');
+insert into t5 values ('node2_committed_before');
+insert into t5 values ('node2_committed_before');
+insert into t5 values ('node2_committed_before');
+insert into t5 values ('node2_committed_before');
+insert into t5 values ('node2_committed_before');
+insert into t4 values ('node2_committed_before');
+insert into t4 values ('node2_committed_before');
+insert into t4 values ('node2_committed_before');
+insert into t4 values ('node2_committed_before');
+insert into t4 values ('node2_committed_before');
+insert into t3 values ('node2_committed_before');
+insert into t3 values ('node2_committed_before');
+insert into t3 values ('node2_committed_before');
+insert into t3 values ('node2_committed_before');
+insert into t3 values ('node2_committed_before');
+insert into t2 values ('node2_committed_before');
+insert into t2 values ('node2_committed_before');
+insert into t2 values ('node2_committed_before');
+insert into t2 values ('node2_committed_before');
+insert into t2 values ('node2_committed_before');
+insert into t1 values ('node2_committed_before');
+insert into t1 values ('node2_committed_before');
+insert into t1 values ('node2_committed_before');
+insert into t1 values ('node2_committed_before');
+insert into t1 values ('node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+insert into t9 values ('node1_committed_during');
+insert into t9 values ('node1_committed_during');
+insert into t9 values ('node1_committed_during');
+insert into t9 values ('node1_committed_during');
+insert into t9 values ('node1_committed_during');
+insert into t8 values ('node1_committed_during');
+insert into t8 values ('node1_committed_during');
+insert into t8 values ('node1_committed_during');
+insert into t8 values ('node1_committed_during');
+insert into t8 values ('node1_committed_during');
+insert into t7 values ('node1_committed_during');
+insert into t7 values ('node1_committed_during');
+insert into t7 values ('node1_committed_during');
+insert into t7 values ('node1_committed_during');
+insert into t7 values ('node1_committed_during');
+insert into t6 values ('node1_committed_during');
+insert into t6 values ('node1_committed_during');
+insert into t6 values ('node1_committed_during');
+insert into t6 values ('node1_committed_during');
+insert into t6 values ('node1_committed_during');
+insert into t5 values ('node1_committed_during');
+insert into t5 values ('node1_committed_during');
+insert into t5 values ('node1_committed_during');
+insert into t5 values ('node1_committed_during');
+insert into t5 values ('node1_committed_during');
+insert into t4 values ('node1_committed_during');
+insert into t4 values ('node1_committed_during');
+insert into t4 values ('node1_committed_during');
+insert into t4 values ('node1_committed_during');
+insert into t4 values ('node1_committed_during');
+insert into t3 values ('node1_committed_during');
+insert into t3 values ('node1_committed_during');
+insert into t3 values ('node1_committed_during');
+insert into t3 values ('node1_committed_during');
+insert into t3 values ('node1_committed_during');
+insert into t2 values ('node1_committed_during');
+insert into t2 values ('node1_committed_during');
+insert into t2 values ('node1_committed_during');
+insert into t2 values ('node1_committed_during');
+insert into t2 values ('node1_committed_during');
+insert into t1 values ('node1_committed_during');
+insert into t1 values ('node1_committed_during');
+insert into t1 values ('node1_committed_during');
+insert into t1 values ('node1_committed_during');
+insert into t1 values ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+insert into t9 values ('node1_to_be_rollbacked_after');
+insert into t9 values ('node1_to_be_rollbacked_after');
+insert into t9 values ('node1_to_be_rollbacked_after');
+insert into t9 values ('node1_to_be_rollbacked_after');
+insert into t9 values ('node1_to_be_rollbacked_after');
+insert into t8 values ('node1_to_be_rollbacked_after');
+insert into t8 values ('node1_to_be_rollbacked_after');
+insert into t8 values ('node1_to_be_rollbacked_after');
+insert into t8 values ('node1_to_be_rollbacked_after');
+insert into t8 values ('node1_to_be_rollbacked_after');
+insert into t7 values ('node1_to_be_rollbacked_after');
+insert into t7 values ('node1_to_be_rollbacked_after');
+insert into t7 values ('node1_to_be_rollbacked_after');
+insert into t7 values ('node1_to_be_rollbacked_after');
+insert into t7 values ('node1_to_be_rollbacked_after');
+insert into t6 values ('node1_to_be_rollbacked_after');
+insert into t6 values ('node1_to_be_rollbacked_after');
+insert into t6 values ('node1_to_be_rollbacked_after');
+insert into t6 values ('node1_to_be_rollbacked_after');
+insert into t6 values ('node1_to_be_rollbacked_after');
+insert into t5 values ('node1_to_be_rollbacked_after');
+insert into t5 values ('node1_to_be_rollbacked_after');
+insert into t5 values ('node1_to_be_rollbacked_after');
+insert into t5 values ('node1_to_be_rollbacked_after');
+insert into t5 values ('node1_to_be_rollbacked_after');
+insert into t4 values ('node1_to_be_rollbacked_after');
+insert into t4 values ('node1_to_be_rollbacked_after');
+insert into t4 values ('node1_to_be_rollbacked_after');
+insert into t4 values ('node1_to_be_rollbacked_after');
+insert into t4 values ('node1_to_be_rollbacked_after');
+insert into t3 values ('node1_to_be_rollbacked_after');
+insert into t3 values ('node1_to_be_rollbacked_after');
+insert into t3 values ('node1_to_be_rollbacked_after');
+insert into t3 values ('node1_to_be_rollbacked_after');
+insert into t3 values ('node1_to_be_rollbacked_after');
+insert into t2 values ('node1_to_be_rollbacked_after');
+insert into t2 values ('node1_to_be_rollbacked_after');
+insert into t2 values ('node1_to_be_rollbacked_after');
+insert into t2 values ('node1_to_be_rollbacked_after');
+insert into t2 values ('node1_to_be_rollbacked_after');
+insert into t1 values ('node1_to_be_rollbacked_after');
+insert into t1 values ('node1_to_be_rollbacked_after');
+insert into t1 values ('node1_to_be_rollbacked_after');
+insert into t1 values ('node1_to_be_rollbacked_after');
+insert into t1 values ('node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+COMMIT;
+connection node_1;
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t9 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t8 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t7 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t6 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t5 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t4 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t3 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t2 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+insert into t1 values ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+insert into t9 values ('node1_committed_after');
+insert into t9 values ('node1_committed_after');
+insert into t9 values ('node1_committed_after');
+insert into t9 values ('node1_committed_after');
+insert into t9 values ('node1_committed_after');
+insert into t8 values ('node1_committed_after');
+insert into t8 values ('node1_committed_after');
+insert into t8 values ('node1_committed_after');
+insert into t8 values ('node1_committed_after');
+insert into t8 values ('node1_committed_after');
+insert into t7 values ('node1_committed_after');
+insert into t7 values ('node1_committed_after');
+insert into t7 values ('node1_committed_after');
+insert into t7 values ('node1_committed_after');
+insert into t7 values ('node1_committed_after');
+insert into t6 values ('node1_committed_after');
+insert into t6 values ('node1_committed_after');
+insert into t6 values ('node1_committed_after');
+insert into t6 values ('node1_committed_after');
+insert into t6 values ('node1_committed_after');
+insert into t5 values ('node1_committed_after');
+insert into t5 values ('node1_committed_after');
+insert into t5 values ('node1_committed_after');
+insert into t5 values ('node1_committed_after');
+insert into t5 values ('node1_committed_after');
+insert into t4 values ('node1_committed_after');
+insert into t4 values ('node1_committed_after');
+insert into t4 values ('node1_committed_after');
+insert into t4 values ('node1_committed_after');
+insert into t4 values ('node1_committed_after');
+insert into t3 values ('node1_committed_after');
+insert into t3 values ('node1_committed_after');
+insert into t3 values ('node1_committed_after');
+insert into t3 values ('node1_committed_after');
+insert into t3 values ('node1_committed_after');
+insert into t2 values ('node1_committed_after');
+insert into t2 values ('node1_committed_after');
+insert into t2 values ('node1_committed_after');
+insert into t2 values ('node1_committed_after');
+insert into t2 values ('node1_committed_after');
+insert into t1 values ('node1_committed_after');
+insert into t1 values ('node1_committed_after');
+insert into t1 values ('node1_committed_after');
+insert into t1 values ('node1_committed_after');
+insert into t1 values ('node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+ROLLBACK;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t3;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t4;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t5;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t6;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t7;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t8;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t9;
+COUNT(*)
+30
+SELECT * FROM t1;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t2;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t3;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t4;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t5;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t6;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t7;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t8;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t9;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+COMMIT;
+SET AUTOCOMMIT=ON;
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t3;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t4;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t5;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t6;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t7;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t8;
+COUNT(*)
+30
+SELECT COUNT(*) FROM t9;
+COUNT(*)
+30
+SELECT * FROM t1;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t2;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t3;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t4;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t5;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t6;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t7;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t8;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+SELECT * FROM t9;
+f1
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node1_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node2_committed_before
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_committed_during
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_to_be_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+node1_committed_after
+COMMIT;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9;
+COMMIT;
+SET AUTOCOMMIT=ON;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff
new file mode 100644
index 00000000..ce99b383
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff
@@ -0,0 +1,200 @@
+--- r/galera_sst_mysqldump.result
++++ r/galera_sst_mysqldump,debug.reject
+@@ -698,11 +698,195 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
+ connection node_1;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
++connection node_1;
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ DROP USER sst;
+ connection node_2;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+ CALL mtr.add_suppression("Can't open and lock time zone table");
+ CALL mtr.add_suppression("Can't open and lock privilege tables");
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump,release.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump,release.rdiff
new file mode 100644
index 00000000..90ce82f3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump,release.rdiff
@@ -0,0 +1,15 @@
+--- r/galera_sst_mysqldump.result
++++ r/galera_sst_mysqldump.reject
+@@ -699,10 +699,10 @@
+ DROP TABLE t1;
+ COMMIT;
+ connection node_1;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ DROP USER sst;
+ connection node_2;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+ CALL mtr.add_suppression("Can't open and lock time zone table");
+ CALL mtr.add_suppression("Can't open and lock privilege tables");
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
new file mode 100644
index 00000000..e63b6f6f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result
@@ -0,0 +1,711 @@
+connection node_2;
+connection node_1;
+Setting SST method to mysqldump ...
+call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
+call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
+connection node_1;
+CREATE USER 'sst';
+GRANT ALL PRIVILEGES ON *.* TO 'sst';
+SET GLOBAL wsrep_sst_auth = 'sst:';
+connection node_2;
+SET GLOBAL wsrep_sst_method = 'mysqldump';
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been temporarily disconnected
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Unloading wsrep provider ...
+SET GLOBAL wsrep_cluster_address = '';
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Loading wsrep provider ...
+disconnect node_2;
+connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_disconnect_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+connection node_1;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+DROP USER sst;
+connection node_2;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+CALL mtr.add_suppression("Can't open and lock time zone table");
+CALL mtr.add_suppression("Can't open and lock privilege tables");
+CALL mtr.add_suppression("Info table is not ready to be used");
+CALL mtr.add_suppression("Native table .* has the wrong structure");
+CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff
new file mode 100644
index 00000000..078ed736
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff
@@ -0,0 +1,200 @@
+--- r/galera_sst_mysqldump_with_key.result
++++ r/galera_sst_mysqldump_with_key,debug.reject
+@@ -358,11 +358,195 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
+ connection node_1;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
++connection node_1;
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ DROP USER sst;
+ connection node_2;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+ CALL mtr.add_suppression("Can't open and lock time zone table");
+ CALL mtr.add_suppression("Can't open and lock privilege tables");
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,release.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,release.rdiff
new file mode 100644
index 00000000..f8b39fbf
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,release.rdiff
@@ -0,0 +1,15 @@
+--- r/galera_sst_mysqldump_with_key.result
++++ r/galera_sst_mysqldump_with_key.reject
+@@ -359,10 +359,10 @@
+ DROP TABLE t1;
+ COMMIT;
+ connection node_1;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ DROP USER sst;
+ connection node_2;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+ CALL mtr.add_suppression("Can't open and lock time zone table");
+ CALL mtr.add_suppression("Can't open and lock privilege tables");
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result
new file mode 100644
index 00000000..fcb250f0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result
@@ -0,0 +1,372 @@
+connection node_2;
+connection node_1;
+Setting SST method to mysqldump ...
+call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
+call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
+connection node_1;
+CREATE USER 'sst';
+GRANT ALL PRIVILEGES ON *.* TO 'sst';
+SET GLOBAL wsrep_sst_auth = 'sst:';
+connection node_2;
+SET GLOBAL wsrep_sst_method = 'mysqldump';
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE USER sslsst;
+GRANT ALL PRIVILEGES ON *.* TO sslsst;
+GRANT USAGE ON *.* TO sslsst REQUIRE SSL;
+SET GLOBAL wsrep_sst_auth = 'sslsst:';
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+connection node_1;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+DROP USER sst;
+connection node_2;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+CALL mtr.add_suppression("Can't open and lock time zone table");
+CALL mtr.add_suppression("Can't open and lock privilege tables");
+CALL mtr.add_suppression("Info table is not ready to be used");
+CALL mtr.add_suppression("Native table .* has the wrong structure");
+CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
+DROP USER sslsst;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff
new file mode 100644
index 00000000..87f8a463
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff
@@ -0,0 +1,190 @@
+--- galera_sst_rsync.result
++++ galera_sst_rsync.reject
+@@ -516,3 +516,187 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync.result b/mysql-test/suite/galera/r/galera_sst_rsync.result
new file mode 100644
index 00000000..8b531bc6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync.result
@@ -0,0 +1,518 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff
new file mode 100644
index 00000000..14f67770
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff
@@ -0,0 +1,190 @@
+--- r/galera_sst_rsync2.result 2021-04-10 14:34:48.646288119 +0300
++++ r/galera_sst_rsync2,debug.reject 2021-04-10 15:04:10.276286996 +0300
+@@ -516,3 +516,187 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync2.result b/mysql-test/suite/galera/r/galera_sst_rsync2.result
new file mode 100644
index 00000000..8b531bc6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync2.result
@@ -0,0 +1,518 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_binlogname.result b/mysql-test/suite/galera/r/galera_sst_rsync_binlogname.result
new file mode 100644
index 00000000..9b56a09d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_binlogname.result
@@ -0,0 +1,174 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff
new file mode 100644
index 00000000..00b42d53
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff
@@ -0,0 +1,190 @@
+--- r/galera_sst_rsync_data_dir.result 2021-04-10 14:35:28.090610315 +0300
++++ r/galera_sst_rsync_data_dir,debug.reject 2021-04-10 15:50:26.945234998 +0300
+@@ -516,3 +516,187 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result
new file mode 100644
index 00000000..8b531bc6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir.result
@@ -0,0 +1,518 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_capath,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_capath,debug.rdiff
new file mode 100644
index 00000000..59417d4d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_capath,debug.rdiff
@@ -0,0 +1,191 @@
+--- r/galera_sst_rsync_encrypt_with_server.result
++++ r/galera_sst_rsync_encrypt_with_server,debug.reject
+@@ -519,4 +519,188 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
+ include/assert_grep.inc [Using stunnel for SSL encryption]
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_capath.result b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_capath.result
new file mode 100644
index 00000000..be8c845b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_capath.result
@@ -0,0 +1,520 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+include/assert_grep.inc [Using stunnel for SSL encryption]
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_key,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_key,debug.rdiff
new file mode 100644
index 00000000..0d654130
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_key,debug.rdiff
@@ -0,0 +1,191 @@
+--- r/galera_sst_rsync_encrypt_with_key.result
++++ r/galera_sst_rsync_encrypt_with_key,debug.reject
+@@ -519,4 +519,188 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
+ include/assert_grep.inc [Using stunnel for SSL encryption]
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_key.result b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_key.result
new file mode 100644
index 00000000..be8c845b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_key.result
@@ -0,0 +1,520 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+include/assert_grep.inc [Using stunnel for SSL encryption]
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_server,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_server,debug.rdiff
new file mode 100644
index 00000000..59417d4d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_server,debug.rdiff
@@ -0,0 +1,191 @@
+--- r/galera_sst_rsync_encrypt_with_server.result
++++ r/galera_sst_rsync_encrypt_with_server,debug.reject
+@@ -519,4 +519,188 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
+ include/assert_grep.inc [Using stunnel for SSL encryption]
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_server.result b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_server.result
new file mode 100644
index 00000000..be8c845b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_encrypt_with_server.result
@@ -0,0 +1,520 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+include/assert_grep.inc [Using stunnel for SSL encryption]
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_logbasename.result b/mysql-test/suite/galera/r/galera_sst_rsync_logbasename.result
new file mode 100644
index 00000000..9b56a09d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_logbasename.result
@@ -0,0 +1,174 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff
new file mode 100644
index 00000000..5bc47c58
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff
@@ -0,0 +1,188 @@
+@@ -516,3 +516,187 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto.result b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto.result
new file mode 100644
index 00000000..8b531bc6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto.result
@@ -0,0 +1,518 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
diff --git a/mysql-test/suite/galera/r/galera_status_cluster.result b/mysql-test/suite/galera/r/galera_status_cluster.result
new file mode 100644
index 00000000..9db0b88a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_status_cluster.result
@@ -0,0 +1,16 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+connection node_2;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
diff --git a/mysql-test/suite/galera/r/galera_status_local_index.result b/mysql-test/suite/galera/r/galera_status_local_index.result
new file mode 100644
index 00000000..c67498ff
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_status_local_index.result
@@ -0,0 +1,18 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE wsrep_local_indexes (wsrep_local_index INTEGER);
+INSERT INTO wsrep_local_indexes VALUES ((SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_local_index'));
+connection node_2;
+INSERT INTO wsrep_local_indexes VALUES ((SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_local_index'));
+connection node_1;
+SELECT COUNT(*) = 2 FROM wsrep_local_indexes;
+COUNT(*) = 2
+1
+SELECT COUNT(DISTINCT wsrep_local_index) = 2 FROM wsrep_local_indexes;
+COUNT(DISTINCT wsrep_local_index) = 2
+1
+SELECT COUNT(*) = 0 FROM wsrep_local_indexes WHERE wsrep_local_index NOT IN (0, 1);
+COUNT(*) = 0
+1
+DROP TABLE wsrep_local_indexes;
diff --git a/mysql-test/suite/galera/r/galera_status_local_state.result b/mysql-test/suite/galera/r/galera_status_local_state.result
new file mode 100644
index 00000000..3fe988ee
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_status_local_state.result
@@ -0,0 +1,16 @@
+connection node_2;
+connection node_1;
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE = 4
+1
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
+SET GLOBAL wsrep_desync = 1;
+SELECT VARIABLE_VALUE = 'Donor/Desynced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Donor/Desynced'
+1
+SET GLOBAL wsrep_desync = 0;
+SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE = 'Synced'
+1
diff --git a/mysql-test/suite/galera/r/galera_strict_require_innodb.result b/mysql-test/suite/galera/r/galera_strict_require_innodb.result
new file mode 100644
index 00000000..cc243cd3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_strict_require_innodb.result
@@ -0,0 +1,120 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine .*");
+CREATE TABLE t1(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=INNODB;
+CREATE TABLE t2(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=MYISAM;
+CREATE TABLE t3(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=ARIA;
+CREATE TABLE t4(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=MEMORY;
+SET GLOBAL log_warnings=2;
+SET GLOBAL wsrep_mode = "STRICT_REPLICATION,REPLICATE_MYISAM,REPLICATE_ARIA";
+INSERT INTO t1 values (1,'innodb1');
+INSERT INTO t2 values (1,'myisam1');
+INSERT INTO t3 values (1,'aria1');
+INSERT INTO t4 values (1,'memory1');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
+SET GLOBAL wsrep_mode = "STRICT_REPLICATION,REPLICATE_ARIA";
+INSERT INTO t2 values (2,'myisam2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
+SET GLOBAL wsrep_mode = "STRICT_REPLICATION,REPLICATE_MYISAM";
+INSERT INTO t3 values (2,'aria2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
+SET GLOBAL log_warnings=1;
+INSERT INTO t1 values (3,'innodb3');
+INSERT INTO t2 values (3,'myisam3');
+INSERT INTO t3 values (3,'aria3');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
+INSERT INTO t4 values (3,'memory3');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
+include/assert_grep.inc [WSREP: wsrep_mode = STRICT_REPLICATION enabled.]
+SET GLOBAL log_warnings=2;
+INSERT INTO t2 values (4,'myisam3');
+INSERT INTO t3 values (4,'aria2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
+INSERT INTO t4 values (4,'memory2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
+INSERT INTO t2 values (5,'myisam3');
+INSERT INTO t3 values (5,'aria2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
+INSERT INTO t4 values (5,'memory2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
+INSERT INTO t2 values (6,'myisam3');
+INSERT INTO t3 values (6,'aria2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
+INSERT INTO t4 values (6,'memory2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
+INSERT INTO t2 values (7,'myisam3');
+INSERT INTO t3 values (7,'aria2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
+INSERT INTO t4 values (7,'memory2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
+INSERT INTO t2 values (8,'myisam3');
+INSERT INTO t3 values (8,'aria2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
+INSERT INTO t4 values (8,'memory2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
+INSERT INTO t2 values (9,'myisam3');
+INSERT INTO t3 values (9,'aria2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
+INSERT INTO t4 values (9,'memory2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
+INSERT INTO t2 values (10,'myisam3');
+INSERT INTO t3 values (10,'aria2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
+INSERT INTO t4 values (10,'memory2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
+INSERT INTO t2 values (11,'myisam3');
+INSERT INTO t3 values (11,'aria2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
+INSERT INTO t4 values (11,'memory2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
+SELECT COUNT(*) AS EXPECT_2 FROM t1;
+EXPECT_2
+2
+SELECT COUNT(*) AS EXPECT_10 FROM t2;
+EXPECT_10
+11
+SELECT COUNT(*) AS EXPECT_10 FROM t3;
+EXPECT_10
+11
+SELECT COUNT(*) AS EXPECT_10 FROM t4;
+EXPECT_10
+10
+connection node_2;
+SELECT COUNT(*) AS EXPECT_2 FROM t1;
+EXPECT_2
+2
+SELECT COUNT(*) AS EXPECT_10 FROM t2;
+EXPECT_10
+10
+SELECT COUNT(*) AS EXPECT_1 FROM t3;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_0 FROM t4;
+EXPECT_0
+0
+connection node_1;
+SET GLOBAL wsrep_mode= DEFAULT;
+DROP TABLE t1,t2,t3,t4;
+include/assert_grep.inc [WSREP: wsrep_mode = STRICT_REPLICATION enabled.]
+include/assert_grep.inc [WSREP: Suppressing warnings of type 'WSREP_REQUIRE_INNODB' for up to 300 seconds because of flooding]
diff --git a/mysql-test/suite/galera/r/galera_strict_require_primary_key.result b/mysql-test/suite/galera/r/galera_strict_require_primary_key.result
new file mode 100644
index 00000000..4a05f640
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_strict_require_primary_key.result
@@ -0,0 +1,209 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table .*");
+CREATE TABLE t1(a int, b varchar(50)) ENGINE=INNODB;
+CREATE TABLE t2(a int, b varchar(50)) ENGINE=MYISAM;
+CREATE TABLE t3(a int, b varchar(50)) ENGINE=MEMORY;
+CREATE TABLE t4(a int, b varchar(50)) ENGINE=ARIA;
+SET GLOBAL wsrep_mode = "REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM,REPLICATE_ARIA";
+SET GLOBAL log_warnings=2;
+INSERT INTO t1 values (1,'test1');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t2 values (1,'myisam1');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t3 values (1,'memory1');
+INSERT INTO t4 values (1,'aria1');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+SET GLOBAL wsrep_mode = "REQUIRED_PRIMARY_KEY,REPLICATE_ARIA";
+INSERT INTO t2 values (2,'myisam2');
+SET GLOBAL wsrep_mode = "REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM";
+INSERT INTO t4 values (2,'ARIA2');
+SET GLOBAL wsrep_mode = "REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM,REPLICATE_ARIA";
+SET GLOBAL log_warnings=1;
+INSERT INTO t1 values (21,'not1');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (22,'not2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t2 values (21,'not1');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (22,'not2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t4 values (21,'not1');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (22,'not2');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+include/assert_grep.inc [WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled.]
+SET GLOBAL log_warnings=2;
+INSERT INTO t1 values (6,'test6');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (7,'test7');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (8,'test8');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (9,'test9');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (10,'test10');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (11,'test11');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (12,'test12');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (13,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (33,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (34,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (35,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (36,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (37,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (38,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t1 values (39,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t1' should have PRIMARY KEY defined.
+INSERT INTO t2 values (6,'test6');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (7,'test7');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (8,'test8');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (9,'test9');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (10,'test10');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (11,'test11');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (12,'test12');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (13,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (33,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (34,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (35,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (36,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (37,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (38,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t2 values (39,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t2' should have PRIMARY KEY defined.
+INSERT INTO t4 values (6,'test6');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (7,'test7');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (8,'test8');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (9,'test9');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (10,'test10');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (11,'test11');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (12,'test12');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (13,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (33,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (34,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (35,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (36,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (37,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (38,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+INSERT INTO t4 values (39,'test13');
+Warnings:
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table 'test'.'t4' should have PRIMARY KEY defined.
+SELECT COUNT(*) AS EXPECT_18 FROM t1;
+EXPECT_18
+18
+SELECT COUNT(*) AS EXPECT_19 FROM t2;
+EXPECT_19
+19
+SELECT COUNT(*) AS EXPECT_1 FROM t3;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_19 FROM t4;
+EXPECT_19
+19
+connection node_2;
+SELECT COUNT(*) AS EXPECT_18 FROM t1;
+EXPECT_18
+18
+SELECT COUNT(*) AS EXPECT_18 FROM t2;
+EXPECT_18
+18
+SELECT COUNT(*) AS EXPECT_0 FROM t3;
+EXPECT_0
+0
+SELECT COUNT(*) AS EXPECT_18 FROM t4;
+EXPECT_18
+18
+connection node_1;
+DROP TABLE t1,t2,t3,t4;
+include/assert_grep.inc [WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled.]
+include/assert_grep.inc [WSREP: Suppressing warnings of type 'WSREP_REQUIRE_PRIMARY_KEY' for up to 300 seconds because of flooding]
diff --git a/mysql-test/suite/galera/r/galera_suspend_slave.result b/mysql-test/suite/galera/r/galera_suspend_slave.result
new file mode 100644
index 00000000..ce49b491
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_suspend_slave.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+disconnect node_2;
+connection node_1;
+Suspending node_2 ...
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_sync_wait = 15;
+INSERT INTO t1 VALUES (1);
+Got one of the listed errors
+Resuming node_2 ...
+SET SESSION wsrep_sync_wait = 0;
+INSERT INTO t1 VALUES (1);
+connection node_2a;
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SET SESSION wsrep_sync_wait = 15;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_sync_wait_show.result b/mysql-test/suite/galera/r/galera_sync_wait_show.result
new file mode 100644
index 00000000..8f6f9368
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sync_wait_show.result
@@ -0,0 +1,56 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET SESSION wsrep_sync_wait = 8;
+connection node_1;
+CREATE DATABASE db1;
+connection node_2;
+SHOW CREATE DATABASE db1;
+Database Create Database
+db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
+DROP DATABASE db1;
+connection node_1;
+CREATE PROCEDURE p1 () SELECT 1 FROM DUAL;
+connection node_2;
+SHOW CREATE PROCEDURE p1;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
+SELECT 1 FROM DUAL latin1 latin1_swedish_ci latin1_swedish_ci
+DROP PROCEDURE p1;
+connection node_1;
+CREATE PROCEDURE p1 () SELECT 1 FROM DUAL;
+connection node_2;
+SHOW PROCEDURE CODE p1;
+Pos Instruction
+0 stmt 0 "SELECT 1 FROM DUAL"
+DROP PROCEDURE p1;
+connection node_1;
+CREATE FUNCTION f1 () RETURNS INTEGER RETURN 123;
+connection node_2;
+SHOW CREATE FUNCTION f1;
+Function sql_mode Create Function character_set_client collation_connection Database Collation
+f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
+RETURN 123 latin1 latin1_swedish_ci latin1_swedish_ci
+DROP FUNCTION f1;
+connection node_1;
+CREATE FUNCTION f1 () RETURNS INTEGER RETURN 123;
+connection node_2;
+SHOW FUNCTION CODE f1;
+Pos Instruction
+0 freturn int 123
+DROP FUNCTION f1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a';
+connection node_2;
+SHOW CREATE TRIGGER tr1;
+Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
+tr1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a' latin1 latin1_swedish_ci latin1_swedish_ci #
+DROP TABLE t1;
+connection node_1;
+CREATE EVENT event1 ON SCHEDULE AT '2038-01-01 23:59:59' DO SELECT 1;
+connection node_2;
+SHOW CREATE EVENT event1;
+Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
+event1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `event1` ON SCHEDULE AT '2038-01-01 23:59:59' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
+DROP EVENT event1;
diff --git a/mysql-test/suite/galera/r/galera_sync_wait_upto.result b/mysql-test/suite/galera/r/galera_sync_wait_upto.result
new file mode 100644
index 00000000..c9f46877
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_sync_wait_upto.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SELECT WSREP_SYNC_WAIT_UPTO_GTID(NULL);
+ERROR HY000: Incorrect arguments to wsrep_sync_wait_upto_gtid
+SELECT WSREP_SYNC_WAIT_UPTO_GTID('a');
+ERROR HY000: Could not parse GTID list
+SELECT WSREP_SYNC_WAIT_UPTO_GTID(2);
+ERROR HY000: Could not parse GTID list
+SELECT WSREP_SYNC_WAIT_UPTO_GTID('1-1-1,1-1-2');
+ERROR HY000: Incorrect arguments to wsrep_sync_wait_upto_gtid
+WSREP_SYNC_WAIT_UPTO
+1
+WSREP_SYNC_WAIT_UPTO
+1
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+connection node_2;
+connection node_1;
+INSERT INTO t1 VALUES (2);
+connection node_2;
+WSREP_SYNC_WAIT_UPTO
+1
+connection node_1;
+DROP TABLE t1;
+connection node_2;
+CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
diff --git a/mysql-test/suite/galera/r/galera_temporary_sequences.result b/mysql-test/suite/galera/r/galera_temporary_sequences.result
new file mode 100644
index 00000000..af80551c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_temporary_sequences.result
@@ -0,0 +1,46 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET AUTOCOMMIT=0;
+SET SESSION wsrep_OSU_method='RSU';
+CREATE TABLE t (i int primary key, j int);
+CREATE TEMPORARY SEQUENCE seq2 NOCACHE ENGINE=InnoDB;
+COMMIT;
+SET SESSION wsrep_OSU_method='RSU';
+CREATE SEQUENCE seq1 NOCACHE ENGINE=InnoDB;
+SET SESSION wsrep_OSU_method='TOI';
+DROP TABLE t;
+DROP SEQUENCE seq2;
+DROP SEQUENCE seq1;
+connection node_1;
+CREATE TABLE t (i int primary key, j int) ENGINE=InnoDB;
+SET AUTOCOMMIT=0;
+INSERT INTO t VALUES (3,0);
+CREATE TEMPORARY SEQUENCE seq1 NOCACHE ENGINE=InnoDB;
+COMMIT;
+INSERT INTO t VALUES (4,0);
+CREATE SEQUENCE seq2 NOCACHE ENGINE=InnoDB;
+commit;
+connection node_2;
+SELECT * FROM t;
+i j
+3 0
+4 0
+SHOW CREATE TABLE seq1;
+ERROR 42S02: Table 'test.seq1' doesn't exist
+SHOW CREATE TABLE seq2;
+Table Create Table
+seq2 CREATE TABLE `seq2` (
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
+ `increment` bigint(21) NOT NULL COMMENT 'increment value',
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
+) ENGINE=InnoDB SEQUENCE=1
+connection node_1;
+DROP TABLE t;
+DROP SEQUENCE seq1;
+DROP SEQUENCE seq2;
diff --git a/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result
new file mode 100644
index 00000000..a9923ba4
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_alter_auto_increment.result
@@ -0,0 +1,58 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+connection node_2;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+ALTER TABLE t1 AUTO_INCREMENT = 1000;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+connection node_1;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+SELECT MIN(f1) >= 1000, COUNT(*) = 20, COUNT(DISTINCT f1) = 20 FROM t1 WHERE f1 >= 1000;
+MIN(f1) >= 1000 COUNT(*) = 20 COUNT(DISTINCT f1) = 20
+1 1 1
+connection node_2;
+SELECT MIN(f1) >= 1000, COUNT(*) = 20, COUNT(DISTINCT f1) = 20 FROM t1 WHERE f1 >= 1000;
+MIN(f1) >= 1000 COUNT(*) = 20 COUNT(DISTINCT f1) = 20
+1 1 1
+connection node_1;
+ALTER TABLE t1 AUTO_INCREMENT = 5;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+connection node_2;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+SELECT MIN(f1) >= 1000, COUNT(*) = 40, COUNT(DISTINCT f1) = 40 FROM t1 WHERE f1 >= 1000;
+MIN(f1) >= 1000 COUNT(*) = 40 COUNT(DISTINCT f1) = 40
+1 1 1
+connection node_1;
+SELECT MIN(f1) >= 1000, COUNT(*) = 40, COUNT(DISTINCT f1) = 40 FROM t1 WHERE f1 >= 1000;
+MIN(f1) >= 1000 COUNT(*) = 40 COUNT(DISTINCT f1) = 40
+1 1 1
+DROP TABLE t1;
+connection node_1;
+SET GLOBAL wsrep_auto_increment_control = OFF;
+SET GLOBAL auto_increment_increment = 1;
+SET GLOBAL auto_increment_offset = 1;
+connection node_2;
+SET GLOBAL wsrep_auto_increment_control = OFF;
+SET GLOBAL auto_increment_increment = 1;
+SET GLOBAL auto_increment_offset = 1;
+connection node_1a;
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+connection node_2a;
+ALTER TABLE t1 AUTO_INCREMENT=100;
+connection node_1a;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+connection node_2a;
+INSERT INTO t1 (f2) SELECT 1 FROM ten;
+SELECT MIN(f1) = 100, MAX(f1) = 119, COUNT(f1) = 20, COUNT(DISTINCT f1) = 20 FROM t1;
+MIN(f1) = 100 MAX(f1) = 119 COUNT(f1) = 20 COUNT(DISTINCT f1) = 20
+1 1 1 1
+connection node_1a;
+SELECT MIN(f1) = 100, MAX(f1) = 119, COUNT(f1) = 20, COUNT(DISTINCT f1) = 20 FROM t1;
+MIN(f1) = 100 MAX(f1) = 119 COUNT(f1) = 20 COUNT(DISTINCT f1) = 20
+1 1 1 1
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_error.result b/mysql-test/suite/galera/r/galera_toi_ddl_error.result
new file mode 100644
index 00000000..9aec137d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_error.result
@@ -0,0 +1,26 @@
+connection node_2;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 (f1) SELECT (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+INSERT INTO t1 (f1) SELECT MAX(f1) FROM t1;
+connection node_2;
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+ERROR 23000: Duplicate entry '111110' for key 'PRIMARY'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
+DROP TABLE ten;
+CALL mtr.add_suppression("Ignoring error 'Duplicate entry '111110' for key 'PRIMARY'' on query.");
+connection node_2;
+CALL mtr.add_suppression("Ignoring error 'Duplicate entry '111110' for key 'PRIMARY'' on query.");
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result
new file mode 100644
index 00000000..6e55c59a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result
@@ -0,0 +1,44 @@
+connection node_2;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE parent (
+id INT PRIMARY KEY AUTO_INCREMENT,
+f2 INTEGER
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT PRIMARY KEY AUTO_INCREMENT,
+parent_id INT
+) ENGINE=InnoDB;
+INSERT INTO parent VALUES (1, 0);
+connection node_2;
+INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+connection node_1a;
+INSERT INTO parent (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+connection node_2a;
+INSERT INTO parent (f2) SELECT 2 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;;
+connection node_1b;
+ALTER TABLE child ADD FOREIGN KEY (parent_id) REFERENCES parent(id);;
+connection node_1a;
+connection node_1b;
+connection node_2;
+connection node_2a;
+connection node_1;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) FROM parent;
+COUNT(*)
+20001
+SELECT COUNT(*) FROM child;
+COUNT(*)
+10000
+connection node_2;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) FROM parent;
+COUNT(*)
+20001
+SELECT COUNT(*) FROM child;
+COUNT(*)
+10000
+DROP TABLE child;
+DROP TABLE parent;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result b/mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result
new file mode 100644
index 00000000..a7966e36
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_fk_update.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE parent (
+id INT PRIMARY KEY,
+KEY (id)
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT PRIMARY KEY AUTO_INCREMENT,
+parent_id INT
+) ENGINE=InnoDB;
+INSERT INTO parent VALUES (1);
+INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+connection node_1;
+ALTER TABLE child ADD FOREIGN KEY (parent_id) REFERENCES parent(id) ON UPDATE CASCADE;;
+connection node_2;
+UPDATE parent SET id = 2 WHERE id = 1;;
+connection node_1;
+connection node_2;
+connection node_2;
+SELECT COUNT(*) = 10000 FROM child WHERE parent_id = 2;
+COUNT(*) = 10000
+1
+connection node_1;
+SELECT COUNT(*) = 10000 FROM child WHERE parent_id = 2;
+COUNT(*) = 10000
+1
+DROP TABLE child;
+DROP TABLE parent;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_locking.result b/mysql-test/suite/galera/r/galera_toi_ddl_locking.result
new file mode 100644
index 00000000..bbe181ce
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_locking.result
@@ -0,0 +1,60 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+SET DEBUG_SYNC= 'RESET';
+SET DEBUG_SYNC = 'alter_table_before_open_tables SIGNAL before_open_tables WAIT_FOR continue';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+connection node_1a;
+SET DEBUG_SYNC= 'now WAIT_FOR before_open_tables';
+SET wsrep_retry_autocommit=0;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+INSERT INTO t1 VALUES (1);;
+connection node_1c;
+SET SESSION wsrep_sync_wait = 0;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+INSERT INTO t2 VALUES (1);
+COMMIT;;
+connection node_1b;
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'Commit';
+COUNT(*) = 1
+1
+SET DEBUG_SYNC= 'now SIGNAL continue';
+connection node_1a;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1c;
+connection node_1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+SET debug_sync='RESET';
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result b/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result
new file mode 100644
index 00000000..5412cd3f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_nonconflicting.result
@@ -0,0 +1,29 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
+connection node_2;
+ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 123);;
+connection node_1;
+CREATE UNIQUE INDEX i1 ON t1(f2);;
+connection node_2;
+INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 234);
+SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 3
+1
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+connection node_1;
+SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 3
+1
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result b/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result
new file mode 100644
index 00000000..bc6dc499
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ddl_sequential.result
@@ -0,0 +1,41 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2, 3);
+connection node_1;
+ALTER TABLE t1 DROP COLUMN f2;
+INSERT INTO t1 VALUES (4);
+connection node_2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+SELECT * FROM t1 ORDER BY f1;
+f1
+1
+2
+4
+connection node_1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+SELECT * FROM t1 ORDER BY f1;
+f1
+1
+2
+4
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_drop_database.result b/mysql-test/suite/galera/r/galera_toi_drop_database.result
new file mode 100644
index 00000000..48056c70
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_drop_database.result
@@ -0,0 +1,34 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE DATABASE database1;
+USE database1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+SET SESSION wsrep_retry_autocommit = 0;
+INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;;
+connection node_1a;
+USE database1;
+SET SESSION wsrep_retry_autocommit = 0;
+INSERT INTO t2 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;;
+connection node_2;
+DROP DATABASE database1;;
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1a;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+connection node_1;
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database1';
+COUNT(*) = 0
+1
+USE database1;
+ERROR 42000: Unknown database 'database1'
+connection node_2;
+SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database1';
+COUNT(*) = 0
+1
+USE database1;
+ERROR 42000: Unknown database 'database1'
diff --git a/mysql-test/suite/galera/r/galera_toi_ftwrl.result b/mysql-test/suite/galera/r/galera_toi_ftwrl.result
new file mode 100644
index 00000000..320ff8e7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_ftwrl.result
@@ -0,0 +1,17 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+FLUSH TABLES WITH READ LOCK;
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+UNLOCK TABLES;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `f2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result b/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result
new file mode 100644
index 00000000..ee8c826f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2);
+connection node_2a;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=EXCLUSIVE;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1;
+INSERT INTO t1 VALUES (2, 2);
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+connection node_2;
+INSERT INTO t1 VALUES (3, 3);
+SELECT COUNT(*) = 3 FROM t1;
+COUNT(*) = 3
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_lock_shared.result b/mysql-test/suite/galera/r/galera_toi_lock_shared.result
new file mode 100644
index 00000000..ec54d101
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_lock_shared.result
@@ -0,0 +1,26 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=SHARED;
+connection node_1;
+INSERT INTO t1 VALUES (2, 2);
+SELECT COUNT(*) AS EXPECT_2 FROM t1;
+EXPECT_2
+2
+SELECT * FROM t1;
+id f2
+1 NULL
+2 2
+connection node_2;
+INSERT INTO t1 VALUES (3, 3);
+SELECT COUNT(*) AS EXPECT_3 FROM t1;
+EXPECT_3
+3
+SELECT * FROM t1;
+id f2
+1 NULL
+2 2
+3 3
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_toi_truncate.result b/mysql-test/suite/galera/r/galera_toi_truncate.result
new file mode 100644
index 00000000..bd3ee0dd
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_toi_truncate.result
@@ -0,0 +1,33 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (id int not null primary key auto_increment, f1 INTEGER) ENGINE=InnoDB;
+connection node_2;
+set session wsrep_sync_wait=0;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1b;
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_2;
+INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1;
+connection node_1b;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_1;
+TRUNCATE TABLE t1;;
+connection node_1b;
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "RESET";
+connection node_1;
+connection node_2;
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
+0
+connection node_1;
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
+0
+disconnect node_1b;
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_transaction_read_only.result b/mysql-test/suite/galera/r/galera_transaction_read_only.result
new file mode 100644
index 00000000..55923f58
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_transaction_read_only.result
@@ -0,0 +1,32 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+COMMIT;
+connection node_2;
+wsrep_last_committed_diff
+1
+connection node_2;
+connection node_1;
+START TRANSACTION READ ONLY;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_2;
+wsrep_last_committed_diff
+1
+connection node_1;
+START TRANSACTION;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_2;
+wsrep_last_committed_diff
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_transaction_replay.result b/mysql-test/suite/galera/r/galera_transaction_replay.result
new file mode 100644
index 00000000..272086c4
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_transaction_replay.result
@@ -0,0 +1,148 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+f1 f2
+2 a
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+wsrep_local_replays
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
+INSERT INTO t1 VALUES (1, 'a');
+INSERT INTO t1 VALUES (2, 'a');
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE t1 SET f2 = 'b' WHERE f1 = 1;
+SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE;
+f1 f2
+2 a
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+connection node_2;
+UPDATE t1 SET f2 = 'c' WHERE f1 = 2;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+wsrep_local_replays
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
+COUNT(*) = 1
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (i int primary key, j int) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1, 0), (3, 0);
+SELECT * FROM t1;
+i j
+1 0
+3 0
+SET AUTOCOMMIT=ON;
+PREPARE stmt1 FROM "UPDATE t1 SET j = 1 where i > 0";
+connection node_1a;
+SET SESSION wsrep_sync_wait=0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+INSERT INTO t1 VALUES(2,2);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait=0;
+EXECUTE stmt1;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end';
+SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
+connection node_1;
+SET SESSION wsrep_sync_wait=7;
+SELECT * FROM t1;
+i j
+1 1
+2 2
+3 1
+connection node_2;
+SELECT * FROM t1;
+i j
+1 1
+2 2
+3 1
+connection node_1;
+wsrep_local_replays
+1
+DEALLOCATE PREPARE stmt1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_trigger.result b/mysql-test/suite/galera/r/galera_trigger.result
new file mode 100644
index 00000000..2a31a104
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_trigger.result
@@ -0,0 +1,78 @@
+connection node_2;
+connection node_1;
+CREATE TABLE IF NOT EXISTS t1 (id int(10) not null primary key) engine=innodb;
+CREATE OR REPLACE TRIGGER tr1
+BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+SET NEW.id = 100;
+END|
+INSERT INTO t1 VALUES (1);
+SELECT * from t1;
+id
+100
+CREATE OR REPLACE TRIGGER tr1
+BEFORE INSERT ON t1 FOR EACH ROW
+BEGIN
+SET NEW.id = 200;
+END|
+connection node_2;
+SET SESSION wsrep_sync_wait=15;
+SELECT * FROM t1;
+id
+100
+INSERT INTO t1 values (2);
+SELECT * FROM t1;
+id
+100
+200
+connection node_1;
+SELECT * FROM t1;
+id
+100
+200
+DROP TRIGGER tr1;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1(id int not null auto_increment, value int not null, primary key (id)) engine=innodb;
+CREATE TABLE t2(id int not null auto_increment, tbl varchar(64) not null, action varchar(64) not null, primary key (id));
+create trigger log_insert after insert on t1
+for each row begin
+insert into t2(tbl, action) values ('t1', 'INSERT');
+end|
+insert into t1(value) values (1);
+insert into t1(value) values (2);
+connection node_2;
+set session wsrep_sync_wait=15;
+insert into t1(value) values (3);
+insert into t1(value) values (4);
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+connection node_1;
+drop trigger if exists log_insert;
+insert into t1(value) values (5);
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+connection node_2;
+insert into t1(value) values (6);
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+connection node_1;
+select tbl, action from t2;
+tbl action
+t1 INSERT
+t1 INSERT
+t1 INSERT
+t1 INSERT
+drop table t1, t2;
diff --git a/mysql-test/suite/galera/r/galera_truncate.result b/mysql-test/suite/galera/r/galera_truncate.result
new file mode 100644
index 00000000..c9a4bc85
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_truncate.result
@@ -0,0 +1,49 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+CREATE TABLE t2 (f1 VARCHAR(255)) Engine=InnoDB;
+INSERT INTO t2 VALUES ('abc');
+connection node_1;
+TRUNCATE TABLE t2;
+connection node_2;
+SELECT COUNT(*) = 0 FROM t2;
+COUNT(*) = 0
+1
+connection node_1;
+CREATE TABLE t3 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t3 VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT);
+CREATE TABLE t4 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB AUTO_INCREMENT=1234;
+INSERT INTO t4 VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT);
+TRUNCATE TABLE t3;
+TRUNCATE TABLE t4;
+connection node_2;
+SELECT AUTO_INCREMENT = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('t3', 't4');
+AUTO_INCREMENT = 1
+1
+1
+connection node_1;
+TRUNCATE TABLE mysql.user;
+ERROR 42S02: Table 'mysql.user' doesn't exist
+TRUNCATE TABLE performance_schema.threads;
+ERROR HY000: Invalid performance_schema usage
+TRUNCATE TABLE information_schema.tables;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+TRUNCATE TABLE mysql.innodb_index_stats;
+TRUNCATE TABLE foo.bar;
+ERROR 42S02: Table 'foo.bar' doesn't exist
+TRUNCATE TABLE t1;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP TABLE t4;
diff --git a/mysql-test/suite/galera/r/galera_truncate_temporary.result b/mysql-test/suite/galera/r/galera_truncate_temporary.result
new file mode 100644
index 00000000..81373bda
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_truncate_temporary.result
@@ -0,0 +1,74 @@
+connection node_2;
+connection node_1;
+CREATE TEMPORARY TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 VALUES (1);
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT * FROM t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+connection node_1;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2);
+SELECT f1 = 2 FROM t1;
+f1 = 2
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT f1 = 1 FROM t1;
+f1 = 1
+1
+connection node_1;
+DROP TABLE t1;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT f1 = 1 FROM t1;
+f1 = 1
+1
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+CREATE TEMPORARY TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2);
+connection node_2;
+TRUNCATE TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+SELECT f1 = 2 FROM t1;
+f1 = 2
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_unicode_identifiers.result b/mysql-test/suite/galera/r/galera_unicode_identifiers.result
new file mode 100644
index 00000000..5db1be8c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_unicode_identifiers.result
@@ -0,0 +1,52 @@
+connection node_2;
+connection node_1;
+SET GLOBAL wsrep_sync_wait = 15;
+connection node_2;
+SET GLOBAL wsrep_sync_wait = 15;
+connection node_1;
+CREATE DATABASE `database with space`;
+USE `database with space`;
+CREATE TABLE `table with space` (
+`column with space` INTEGER AUTO_INCREMENT PRIMARY KEY,
+`second column with space` INTEGER,
+UNIQUE `index name with space` (`second column with space`)
+) engine=innodb;
+INSERT INTO `table with space` VALUES (1, 1);
+CREATE DATABASE `база`;
+USE `база`;
+CREATE TABLE `таблица` (
+`първа_колона` INTEGER PRIMARY KEY,
+`втора_колона` INTEGER,
+UNIQUE `индекс` (`втора_колона`)
+) engine=innodb;
+INSERT INTO `таблица` VALUES (1, 1);
+CREATE DATABASE `втора база`;
+USE `втора база`;
+CREATE TABLE `втора таблица` (
+`първа колона` INTEGER,
+`втора колона` INTEGER,
+KEY `първи индекс` (`първа колона`)
+) engine=innodb;
+INSERT INTO `втора таблица` VALUES (1, 1);
+connection node_2;
+USE `database with space`;
+SELECT `second column with space` FROM `table with space`;
+second column with space
+1
+USE `база`;
+SELECT * FROM `таблица`;
+първа_колона втора_колона
+1 1
+USE `втора база`;
+SELECT `втора колона` FROM `втора таблица`;
+втора колона
+1
+SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait);
+connection node_1;
+DROP TABLE `database with space`.`table with space`;
+DROP TABLE `база`.`таблица`;
+DROP TABLE `втора база`.`втора таблица`;
+DROP DATABASE `database with space`;
+DROP DATABASE `база`;
+DROP DATABASE `втора база`;
+SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait);
diff --git a/mysql-test/suite/galera/r/galera_unicode_pk.result b/mysql-test/suite/galera/r/galera_unicode_pk.result
new file mode 100644
index 00000000..8ed1a3a0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_unicode_pk.result
@@ -0,0 +1,43 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (
+f1 VARCHAR(255) PRIMARY KEY
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES ('текст');
+connection node_2;
+SELECT f1 = 'текст' FROM t1;
+f1 = 'текст'
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текст2';
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'текст3';
+connection node_1;
+COMMIT;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT f1 = 'текст2' FROM t1;
+f1 = 'текст2'
+1
+SELECT f1 = 'текст2' FROM t1 WHERE f1 = 'текст2';
+f1 = 'текст2'
+1
+connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('текст4');
+connection node_1;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('текст4');
+connection node_2;
+COMMIT;
+connection node_1;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_update_limit.result b/mysql-test/suite/galera/r/galera_update_limit.result
new file mode 100644
index 00000000..bd021136
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_update_limit.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER not null primary key) Engine=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t1 SELECT f1 FROM ten ORDER BY RAND();
+connection node_2;
+UPDATE IGNORE t1 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5;
+connection node_1;
+sum_matches
+1
+max_matches
+1
+DROP TABLE t1;
+CREATE TABLE t2 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t2 SELECT f1 FROM ten ORDER BY RAND();
+connection node_2;
+UPDATE IGNORE t2 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5;
+connection node_1;
+sum_matches
+1
+DROP TABLE t2;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_v1_row_events.result b/mysql-test/suite/galera/r/galera_v1_row_events.result
new file mode 100644
index 00000000..80fe2fb6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_v1_row_events.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_OSU_method.result b/mysql-test/suite/galera/r/galera_var_OSU_method.result
new file mode 100644
index 00000000..2b0a713e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_OSU_method.result
@@ -0,0 +1,26 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+connection node_1;
+SET SESSION wsrep_OSU_method = "RSU";
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET GLOBAL wsrep_OSU_method = "TOI";
+SET DEBUG_SYNC= 'now SIGNAL continue';
+connection node_1;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 1
+1
+connection node_1;
+SET SESSION wsrep_OSU_method = "TOI";
+connection node_1;
+SET DEBUG_SYNC= 'RESET';
+connection node_1a;
+SET DEBUG_SYNC= 'RESET';
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_OSU_method2.result b/mysql-test/suite/galera/r/galera_var_OSU_method2.result
new file mode 100644
index 00000000..ca4f617d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_OSU_method2.result
@@ -0,0 +1,28 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+connection node_1;
+SET SESSION wsrep_OSU_method = "TOI";
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_OSU_method = "RSU";
+SET DEBUG_SYNC= 'now SIGNAL continue';
+connection node_1;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+INSERT INTO t1 VALUES (1,2);
+connection node_2;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+INSERT INTO t1 VALUES (3,4);
+connection node_1;
+SET GLOBAL wsrep_OSU_method = "TOI";
+DROP TABLE t1;
+SET DEBUG_SYNC= 'RESET';
+connection node_1a;
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result
new file mode 100644
index 00000000..9071331e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result
@@ -0,0 +1,73 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET GLOBAL wsrep_auto_increment_control = OFF;
+SET GLOBAL auto_increment_increment = 1;
+SET GLOBAL auto_increment_offset = 1;
+connection node_2;
+SET GLOBAL wsrep_auto_increment_control = OFF;
+SET GLOBAL auto_increment_increment = 1;
+SET GLOBAL auto_increment_offset = 1;
+connection node_1a;
+SELECT @@auto_increment_increment = 1;
+@@auto_increment_increment = 1
+1
+SELECT @@auto_increment_offset = 1;
+@@auto_increment_offset = 1
+1
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL AUTO_INCREMENT,
+ `node` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_2a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `f1` int(11) NOT NULL AUTO_INCREMENT,
+ `node` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_1a;
+SELECT @@auto_increment_increment = 1;
+@@auto_increment_increment = 1
+1
+SELECT @@auto_increment_offset = 1;
+@@auto_increment_offset = 1
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (node) VALUES ('node1');
+SELECT f1 FROM t1;
+f1
+1
+connection node_2a;
+SELECT @@auto_increment_increment = 1;
+@@auto_increment_increment = 1
+1
+SELECT @@auto_increment_offset = 1;
+@@auto_increment_offset = 1
+1
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 (node) VALUES ('node2');
+SELECT f1 FROM t1;
+f1
+1
+connection node_1a;
+COMMIT;
+connection node_2a;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_1a;
+SELECT * FROM t1;
+f1 node
+1 node1
+connection node_2a;
+SELECT * FROM t1;
+f1 node
+1 node1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result
new file mode 100644
index 00000000..48c649b6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_on.result
@@ -0,0 +1,43 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
+SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
+@@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size')
+1
+connection node_2;
+auto_increment_offset_differ
+1
+connection node_1;
+INSERT INTO t1 VALUES (DEFAULT, 'node1');;
+connection node_2;
+INSERT INTO t1 VALUES (DEFAULT, 'node2');;
+connection node_1;
+connection node_2;
+SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
+@@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size')
+1
+connection node_1;
+auto_increment_offset_differ
+1
+connection node_2;
+INSERT INTO t1 VALUES (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2');;
+connection node_1;
+INSERT INTO t1 VALUES (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1');;
+connection node_2;
+connection node_1;
+connection node_2;
+SELECT COUNT(*) = 22 FROM t1;
+COUNT(*) = 22
+1
+SELECT COUNT(DISTINCT f1) = 22 FROM t1;
+COUNT(DISTINCT f1) = 22
+1
+connection node_1;
+SELECT COUNT(*) = 22 FROM t1;
+COUNT(*) = 22
+1
+SELECT COUNT(DISTINCT f1) = 22 FROM t1;
+COUNT(DISTINCT f1) = 22
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result b/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result
new file mode 100644
index 00000000..f5472aa9
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_certify_nonPK_off.result
@@ -0,0 +1,32 @@
+connection node_2;
+connection node_1;
+SET GLOBAL wsrep_certify_nonPK = OFF;
+connection node_2;
+SET GLOBAL wsrep_certify_nonPK = OFF;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB /* Table has no primary key */;
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2);
+Got one of the listed errors
+INSERT INTO t2 VALUES (1), (2);
+UPDATE t2 SET f1 = 3 WHERE f1 = 1;
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 3;
+COUNT(*) = 1
+1
+connection node_1;
+SET GLOBAL wsrep_certify_nonPK = 1;
+connection node_2;
+SET GLOBAL wsrep_certify_nonPK = 1;
+DROP TABLE t1;
+DROP TABLE t2;
+connection node_1;
+call mtr.add_suppression("SQL statement was ineffective");
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_var_cluster_address.result b/mysql-test/suite/galera/r/galera_var_cluster_address.result
new file mode 100644
index 00000000..9cfe5a8f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_cluster_address.result
@@ -0,0 +1,54 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+SET GLOBAL wsrep_cluster_address = 'foo://';
+SHOW STATUS;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SET SESSION wsrep_sync_wait=0;
+SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+COUNT(*) > 0
+1
+SHOW STATUS LIKE 'wsrep_ready';
+Variable_name Value
+wsrep_ready OFF
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Disconnected
+SHOW STATUS LIKE 'wsrep_local_state';
+Variable_name Value
+wsrep_local_state 0
+SHOW STATUS LIKE 'wsrep_local_state_comment';
+Variable_name Value
+wsrep_local_state_comment Initialized
+connection node_1;
+SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 1
+1
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+connection node_2;
+connection node_1;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+connection node_2;
+CALL mtr.add_suppression("Backend not supported: foo");
+CALL mtr.add_suppression("Failed to initialize backend using 'foo");
+CALL mtr.add_suppression("Failed to open channel 'my_wsrep_cluster' at 'foo");
+CALL mtr.add_suppression("gcs connect failed: Socket type not supported");
+CALL mtr.add_suppression("wsrep::connect\\(\\) failed: 7");
+CALL mtr.add_suppression("gcs_caused\\(\\) returned -[0-9]+ \\(Software caused connection abort\\)");
+CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed to reach primary view: 110");
+CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)");
+CALL mtr.add_suppression("gcs connect failed: Connection timed out");
+CALL mtr.add_suppression("WSREP: wsrep::connect\\(foo://\\) failed: 7");
+CALL mtr.add_suppression("WSREP: wsrep::connect\\(gcomm://.*\\) failed: 7");
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/galera_var_cluster_conf_id.result b/mysql-test/suite/galera/r/galera_var_cluster_conf_id.result
new file mode 100644
index 00000000..c78d704d
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_cluster_conf_id.result
@@ -0,0 +1,10 @@
+connection node_2;
+connection node_1;
+connection node_1;
+show status like 'wsrep_cluster_conf_id';
+Variable_name Value
+wsrep_cluster_conf_id #
+connection node_2;
+show status like 'wsrep_cluster_conf_id';
+Variable_name Value
+wsrep_cluster_conf_id #
diff --git a/mysql-test/suite/galera/r/galera_var_desync_on.result b/mysql-test/suite/galera/r/galera_var_desync_on.result
new file mode 100644
index 00000000..6a2e501e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_desync_on.result
@@ -0,0 +1,37 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1';
+FLUSH TABLES WITH READ LOCK;
+connection node_1;
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+INSERT INTO t1 VALUES (4);
+INSERT INTO t1 VALUES (5);
+INSERT INTO t1 VALUES (6);
+INSERT INTO t1 VALUES (7);
+INSERT INTO t1 VALUES (8);
+INSERT INTO t1 VALUES (9);
+INSERT INTO t1 VALUES (10);
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+UNLOCK TABLES;
+SET SESSION wsrep_sync_wait = 1;
+SELECT COUNT(*) = 10 FROM t1;
+COUNT(*) = 10
+1
+connection node_1;
+INSERT INTO t1 VALUES (11);
+connection node_2;
+SELECT COUNT(*) = 11 FROM t1;
+COUNT(*) = 11
+1
+CALL mtr.add_suppression("Protocol violation");
+DROP TABLE t1;
+connection node_1;
+CALL mtr.add_suppression("Protocol violation");
diff --git a/mysql-test/suite/galera/r/galera_var_dirty_reads.result b/mysql-test/suite/galera/r/galera_var_dirty_reads.result
new file mode 100644
index 00000000..2b164fec
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_dirty_reads.result
@@ -0,0 +1,55 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
+connection node_1;
+connection node_2;
+connection node_2;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+SELECT * FROM t1;
+i
+1
+SET @@global.wsrep_cluster_address = '';
+SET @@session.wsrep_dirty_reads=OFF;
+SET SESSION wsrep_sync_wait=0;
+SHOW STATUS LIKE 'wsrep_ready';
+Variable_name Value
+wsrep_ready OFF
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Disconnected
+SELECT * FROM t1;
+ERROR 08S01: WSREP has not yet prepared node for application use
+SELECT 1 FROM t1;
+ERROR 08S01: WSREP has not yet prepared node for application use
+SET @@session.wsrep_dirty_reads=ON;
+SELECT * FROM t1;
+i
+1
+SELECT 1 FROM t1;
+1
+1
+SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
+i variable_name variable_value
+1 WSREP_DIRTY_READS ON
+SET @@session.wsrep_dirty_reads=OFF;
+SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
+ERROR 08S01: WSREP has not yet prepared node for application use
+SELECT 1;
+1
+1
+USE information_schema;
+SELECT * FROM information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads";
+VARIABLE_NAME VARIABLE_VALUE
+WSREP_DIRTY_READS OFF
+SELECT COUNT(*) >= 10 FROM performance_schema.events_statements_history;
+COUNT(*) >= 10
+1
+connection node_1;
+USE test;
+SELECT * FROM t1;
+i
+1
+DROP TABLE t1;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_var_fkchecks.result b/mysql-test/suite/galera/r/galera_var_fkchecks.result
new file mode 100644
index 00000000..42f8085e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_fkchecks.result
@@ -0,0 +1,30 @@
+connection node_2;
+connection node_1;
+CREATE TABLE parent (
+id INT PRIMARY KEY,
+KEY (id)
+) ENGINE=InnoDB;
+CREATE TABLE child (
+id INT PRIMARY KEY,
+parent_id INT,
+FOREIGN KEY (parent_id)
+REFERENCES parent(id)
+) ENGINE=InnoDB;
+INSERT INTO parent VALUES (1);
+INSERT INTO child VALUES (1,1);
+SET SESSION foreign_key_checks = 0;
+INSERT INTO child VALUES (2,2);
+connection node_2;
+SELECT COUNT(*) = 1 FROM child WHERE id = 2;
+COUNT(*) = 1
+1
+INSERT INTO child VALUES (3,3);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
+SET SESSION foreign_key_checks = 0;
+DELETE FROM parent;
+connection node_1;
+SELECT COUNT(*) = 0 FROM parent;
+COUNT(*) = 0
+1
+DROP TABLE child;
+DROP TABLE parent;
diff --git a/mysql-test/suite/galera/r/galera_var_gtid_domain_id.result b/mysql-test/suite/galera/r/galera_var_gtid_domain_id.result
new file mode 100644
index 00000000..0edfdf47
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_gtid_domain_id.result
@@ -0,0 +1,96 @@
+connection node_2;
+connection node_1;
+# On node_1
+connection node_1;
+list of GTID variables :
+gtid_domain_id 1
+gtid_binlog_pos
+gtid_binlog_state
+gtid_current_pos
+gtid_slave_pos
+wsrep_gtid_domain_id 9999
+wsrep_gtid_mode 1
+# On node_2
+connection node_2;
+list of GTID variables :
+gtid_domain_id 2
+gtid_binlog_pos
+gtid_binlog_state
+gtid_current_pos
+gtid_slave_pos
+wsrep_gtid_domain_id 9999
+wsrep_gtid_mode 1
+# On node_1
+connection node_1;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+CREATE TABLE t2(i INT) ENGINE=MEMORY;
+INSERT INTO t1 VALUES(1);
+SELECT * FROM t1;
+i
+1
+SELECT * FROM t2;
+i
+list of GTID variables :
+gtid_domain_id 1
+gtid_binlog_pos 9999-1-3
+gtid_binlog_state 9999-1-3
+gtid_current_pos 9999-1-3
+gtid_slave_pos
+wsrep_gtid_domain_id 9999
+wsrep_gtid_mode 1
+# On node_2
+connection node_2;
+SELECT * FROM t1;
+i
+1
+list of GTID variables :
+gtid_domain_id 2
+gtid_binlog_pos 9999-1-3
+gtid_binlog_state 9999-1-3
+gtid_current_pos
+gtid_slave_pos
+wsrep_gtid_domain_id 9999
+wsrep_gtid_mode 1
+# On node_1
+connection node_1;
+INSERT INTO t2 VALUES(1);
+SELECT * FROM t2;
+i
+1
+list of GTID variables :
+gtid_domain_id 1
+gtid_binlog_pos 1-1-1,9999-1-3
+gtid_binlog_state 1-1-1,9999-1-3
+gtid_current_pos 1-1-1,9999-1-3
+gtid_slave_pos
+wsrep_gtid_domain_id 9999
+wsrep_gtid_mode 1
+# On node_2
+connection node_2;
+SELECT * FROM t2;
+i
+list of GTID variables :
+gtid_domain_id 2
+gtid_binlog_pos 9999-1-3
+gtid_binlog_state 9999-1-3
+gtid_current_pos
+gtid_slave_pos
+wsrep_gtid_domain_id 9999
+wsrep_gtid_mode 1
+# On node_1
+connection node_1;
+DROP TABLE t1, t2;
+#cleanup
+connection node_1;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_2;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_2;
+CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result
new file mode 100644
index 00000000..082d2e8e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result
@@ -0,0 +1,186 @@
+connection node_2;
+connection node_1;
+connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors = 1;
+connection node_1;
+SET GLOBAL wsrep_on = OFF;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = ON;
+DROP TABLE t1;
+SET GLOBAL wsrep_on = OFF;
+CREATE SCHEMA s1;
+SET GLOBAL wsrep_on = ON;
+DROP SCHEMA s1;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+CREATE INDEX idx1 ON t1 (f1);
+SET GLOBAL wsrep_on = ON;
+DROP INDEX idx1 ON t1;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+CREATE INDEX idx1 ON t1 (f1);
+SET GLOBAL wsrep_on = ON;
+ALTER TABLE t1 DROP INDEX idx1;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+SET GLOBAL wsrep_on = ON;
+ALTER TABLE t1 DROP COLUMN f2;
+DROP TABLE t1;
+connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors = 2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = OFF;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_on = ON;
+DELETE FROM t1 WHERE f1 = 1;
+connection node_1;
+SELECT COUNT(*) as expect_0 FROM t1;
+expect_0
+0
+connection node_2;
+SELECT COUNT(*) as expect_0 FROM t1;
+expect_0
+0
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES (2);
+SET GLOBAL wsrep_on = OFF;
+INSERT INTO t1 VALUES (1);
+SET GLOBAL wsrep_on = ON;
+START TRANSACTION;
+INSERT INTO t1 VALUES (3);
+DELETE FROM t1 WHERE f1 = 1;
+DELETE FROM t1 WHERE f1 = 2;
+COMMIT;
+connection node_1;
+SELECT COUNT(*) as expect_1 FROM t1;
+expect_1
+1
+connection node_2;
+SELECT COUNT(*) as expect_1 FROM t1;
+expect_1
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+connection node_2;
+SET SESSION wsrep_on = OFF;
+DELETE FROM t1 WHERE f1 = 3;
+SET SESSION wsrep_on = ON;
+connection node_1;
+DELETE FROM t1;
+SELECT COUNT(*) as expect_0 FROM t1;
+expect_0
+0
+connection node_2;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) as expect_0 FROM t1;
+expect_0
+0
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
+connection node_2;
+SET SESSION wsrep_on = OFF;
+DELETE FROM t1 WHERE f1 = 3;
+SET SESSION wsrep_on = ON;
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+DELETE FROM t1 WHERE f1 = 1;
+DELETE FROM t1 WHERE f1 = 2;
+DELETE FROM t1 WHERE f1 = 3;
+DELETE FROM t1 WHERE f1 = 4;
+DELETE FROM t1 WHERE f1 = 5;
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) as expect_0 FROM t1;
+expect_0
+0
+connection node_2;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) as expect_0 FROM t1;
+expect_0
+0
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(2),(3);
+connection node_2;
+SET SESSION wsrep_on = OFF;
+DELETE FROM t2 WHERE f1 = 2;
+DELETE FROM t1 WHERE f1 = 3;
+SET SESSION wsrep_on = ON;
+connection node_1;
+DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1;
+SELECT COUNT(*) as expect_0 FROM t1;
+expect_0
+0
+connection node_2;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) as expect_0 FROM t1;
+expect_0
+0
+DROP TABLE t1,t2;
+connection node_1;
+CREATE TABLE parent (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+INSERT INTO parent VALUES (1),(2),(3);
+CREATE TABLE child (id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE CASCADE) ENGINE=INNODB;
+INSERT INTO child VALUES (1,1),(2,2),(3,3);
+connection node_2;
+SET SESSION wsrep_on = OFF;
+DELETE FROM child WHERE parent_id = 2;
+SET SESSION wsrep_on = ON;
+connection node_1;
+DELETE FROM parent;
+SELECT COUNT(*) as expect_0 FROM parent;
+expect_0
+0
+SELECT COUNT(*) as expect_0 FROM child;
+expect_0
+0
+connection node_2;
+SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE = 'Primary'
+1
+SELECT COUNT(*) as expect_0 FROM parent;
+expect_0
+0
+SELECT COUNT(*) as expect_0 FROM child;
+expect_0
+0
+DROP TABLE child, parent;
+connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors = 4;
+connection node_2;
+SET GLOBAL wsrep_on = OFF;
+CREATE TABLE t1 (f1 INTEGER);
+SET GLOBAL wsrep_on = ON;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER, f2 INTEGER);
+DROP TABLE t1;
+connection node_2;
+SET GLOBAL wsrep_ignore_apply_errors = 7;
+CALL mtr.add_suppression("Can't find record in 't.*'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event");
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test.t1'' on query. Default database: 'test'. Query: 'DROP TABLE t1', Error_code: 1051");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't drop database 's1'; database doesn't exist' on query. Default database: 'test'. Query: 'DROP SCHEMA s1', Error_code: 1008");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query. Default database: 'test'. Query: 'DROP INDEX idx1 ON t1', Error_code: 1091");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t1 DROP INDEX idx1', Error_code: 1091");
+CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'f2'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t1 DROP COLUMN f2', Error_code: 1091");
+CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query.");
diff --git a/mysql-test/suite/galera/r/galera_var_load_data_splitting.result b/mysql-test/suite/galera/r/galera_var_load_data_splitting.result
new file mode 100644
index 00000000..66bc6bc4
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_load_data_splitting.result
@@ -0,0 +1,22 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SET GLOBAL wsrep_load_data_splitting = TRUE;
+Warnings:
+Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release
+connection node_2;
+SELECT COUNT(*) = 95000 FROM t1;
+COUNT(*) = 95000
+1
+wsrep_last_committed_diff
+1
+connection node_1;
+SET GLOBAL wsrep_load_data_splitting = 0;;
+Warnings:
+Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release
+connection node_2;
+SET GLOBAL wsrep_load_data_splitting = 0;;
+Warnings:
+Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_log_bin.result b/mysql-test/suite/galera/r/galera_var_log_bin.result
new file mode 100644
index 00000000..80fe2fb6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_log_bin.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+UPDATE t1 SET f1 = 2 WHERE f1 = 1;
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_max_ws_rows.result b/mysql-test/suite/galera/r/galera_var_max_ws_rows.result
new file mode 100644
index 00000000..72d16d19
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_max_ws_rows.result
@@ -0,0 +1,142 @@
+connection node_2;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
+SET GLOBAL wsrep_max_ws_rows = 4;
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (2);
+INSERT INTO t1 (f2) VALUES (3);
+INSERT INTO t1 (f2) VALUES (4);
+INSERT INTO t1 (f2) VALUES (5);
+ERROR HY000: wsrep_max_ws_rows exceeded
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (2);
+INSERT INTO t1 (f2) VALUES (3);
+INSERT INTO t1 (f2) VALUES (4);
+UPDATE t1 SET f2 = 10 WHERE f2 = 4;
+ERROR HY000: wsrep_max_ws_rows exceeded
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (2);
+INSERT INTO t1 (f2) VALUES (3);
+INSERT INTO t1 (f2) VALUES (4);
+DELETE FROM t1 WHERE f2 = 1;
+ERROR HY000: wsrep_max_ws_rows exceeded
+COMMIT;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SET GLOBAL wsrep_max_ws_rows = 5;
+INSERT INTO t1 (f2) VALUES (1),(2),(3),(4),(5);
+SET GLOBAL wsrep_max_ws_rows = 4;
+UPDATE t1 SET f2 = f2 + 10;
+ERROR HY000: wsrep_max_ws_rows exceeded
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+DELETE FROM t1 WHERE f2 < 10;
+ERROR HY000: wsrep_max_ws_rows exceeded
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+INSERT INTO t1 (f2) SELECT * FROM ten;
+ERROR HY000: wsrep_max_ws_rows exceeded
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+INSERT INTO t1 (f2) VALUES (10),(20),(30),(40),(50);
+ERROR HY000: wsrep_max_ws_rows exceeded
+SELECT COUNT(*) = 5 FROM t1;
+COUNT(*) = 5
+1
+SET GLOBAL wsrep_max_ws_rows = 10;
+DELETE FROM t1 WHERE f2 < 10;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SET GLOBAL wsrep_max_ws_rows = 100;
+SELECT COUNT(*) = 100 FROM t1;
+COUNT(*) = 100
+1
+DELETE FROM t1 WHERE f2 < 101;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SET GLOBAL wsrep_max_ws_rows = 9999;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+ERROR HY000: wsrep_max_ws_rows exceeded
+SET GLOBAL wsrep_max_ws_rows = 10000;
+INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
+SET GLOBAL wsrep_max_ws_rows = 9999;
+UPDATE t1 SET f2 = 2 WHERE f2 = 1;
+ERROR HY000: wsrep_max_ws_rows exceeded
+SET GLOBAL wsrep_max_ws_rows = 10000;
+UPDATE t1 SET f2 = 2 WHERE f2 = 1;
+SET GLOBAL wsrep_max_ws_rows = 9999;
+DELETE FROM t1 WHERE f2 = 2;
+ERROR HY000: wsrep_max_ws_rows exceeded
+SET GLOBAL wsrep_max_ws_rows = 10000;
+DELETE FROM t1 WHERE f2 = 2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SET AUTOCOMMIT = ON;
+SET GLOBAL wsrep_max_ws_rows = 1;
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (2);
+ERROR HY000: wsrep_max_ws_rows exceeded
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (2);
+SET AUTOCOMMIT = OFF;
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (2);
+ERROR HY000: wsrep_max_ws_rows exceeded
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (2);
+ERROR HY000: wsrep_max_ws_rows exceeded
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES (1);
+START TRANSACTION;
+INSERT INTO t1 (f2) VALUES (1);
+INSERT INTO t1 (f2) VALUES (2);
+ERROR HY000: wsrep_max_ws_rows exceeded
+DROP TABLE t1;
+DROP TABLE ten;
+#
+# MDEV-11817: Altering a table with more rows than
+# wsrep_max_ws_rows causes cluster to break when running
+# Galera cluster in TOI mode
+#
+connection node_1;
+CREATE TABLE t1(c1 INT)ENGINE = INNODB;
+SET GLOBAL wsrep_max_ws_rows= DEFAULT;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t1 SELECT * FROM t1;
+SET GLOBAL wsrep_max_ws_rows= 1;
+ALTER TABLE t1 CHANGE COLUMN c1 c1 BIGINT;
+connection node_2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+DROP TABLE t1;
+connection node_1;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/galera_var_max_ws_size.result b/mysql-test/suite/galera/r/galera_var_max_ws_size.result
new file mode 100644
index 00000000..bd712ef9
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_max_ws_size.result
@@ -0,0 +1,20 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine=InnoDB;
+SET GLOBAL wsrep_max_ws_size = 1024;
+INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024));
+ERROR HY000: Maximum writeset size exceeded
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=10000';
+SELECT @@wsrep_max_ws_size = 10000;
+@@wsrep_max_ws_size = 10000
+1
+SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=20000';
+SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=10000';
+SET GLOBAL wsrep_max_ws_size = 20000;
+provider_options_match
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result b/mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result
new file mode 100644
index 00000000..d7a38d24
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_mysql_replication_bundle.result
@@ -0,0 +1,19 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
+SET GLOBAL wsrep_mysql_replication_bundle = 2;
+connection node_1;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+0
+connection node_1;
+INSERT INTO t1 VALUES (2);
+connection node_2;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+connection node_1;
+SET GLOBAL wsrep_mysql_replication_bundle = 0;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_node_address.result b/mysql-test/suite/galera/r/galera_var_node_address.result
new file mode 100644
index 00000000..6b91a9f3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_node_address.result
@@ -0,0 +1,22 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: Stray state UUID msg: .*");
+call mtr.add_suppression("WSREP: Protocol violation. JOIN message sender .*");
+call mtr.add_suppression("WSREP: Sending JOIN failed: .*");
+flush tables;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE
+4
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB;
+connection node_2;
+set global wsrep_sync_wait=15;
+INSERT INTO t1 VALUES (1);
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+set global wsrep_sync_wait=15;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_notify_cmd.result b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
new file mode 100644
index 00000000..432d6c0a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership;
+EXPECT_2
+2
+SELECT MAX(size) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+EXPECT_2
+2
+SELECT COUNT(DISTINCT idx) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+EXPECT_2
+2
+DROP SCHEMA mtr_wsrep_notify;
diff --git a/mysql-test/suite/galera/r/galera_var_notify_ssl_ipv6.result b/mysql-test/suite/galera/r/galera_var_notify_ssl_ipv6.result
new file mode 100644
index 00000000..432d6c0a
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_notify_ssl_ipv6.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership;
+EXPECT_2
+2
+SELECT MAX(size) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+EXPECT_2
+2
+SELECT COUNT(DISTINCT idx) AS EXPECT_2 FROM mtr_wsrep_notify.status;
+EXPECT_2
+2
+DROP SCHEMA mtr_wsrep_notify;
diff --git a/mysql-test/suite/galera/r/galera_var_reject_queries.result b/mysql-test/suite/galera/r/galera_var_reject_queries.result
new file mode 100644
index 00000000..33ee9262
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_reject_queries.result
@@ -0,0 +1,28 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+SET SESSION wsrep_reject_queries = ALL;
+ERROR HY000: Variable 'wsrep_reject_queries' is a GLOBAL variable and should be set with SET GLOBAL
+SET GLOBAL wsrep_reject_queries = ALL;
+SELECT * FROM t1;
+Got one of the listed errors
+SET GLOBAL wsrep_reject_queries = ALL_KILL;
+connection node_1a;
+SELECT * FROM t1;
+Got one of the listed errors
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SELECT * FROM t1;
+Got one of the listed errors
+connection node_2;
+SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 2
+1
+INSERT INTO t1 VALUES (1);
+connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET GLOBAL wsrep_reject_queries = NONE;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_replicate_aria_off.result b/mysql-test/suite/galera/r/galera_var_replicate_aria_off.result
new file mode 100644
index 00000000..550df8d3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_replicate_aria_off.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=Aria;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+f1
+1
+connection node_2;
+# Only DDL is replicated
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
+0
+SELECT * FROM t1;
+f1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_replicate_aria_on.result b/mysql-test/suite/galera/r/galera_var_replicate_aria_on.result
new file mode 100644
index 00000000..91c07ba6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_replicate_aria_on.result
@@ -0,0 +1,271 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET GLOBAL wsrep_mode = REPLICATE_ARIA;
+connection node_2;
+SET GLOBAL wsrep_mode = REPLICATE_ARIA;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=Aria;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2), (3);
+INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
+connection node_2;
+SELECT COUNT(*) AS EXPECT_5 FROM t1;
+EXPECT_5
+5
+connection node_1;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(100)) ENGINE=Aria;
+INSERT INTO t1 VALUES (1, 'abc'),(2,'abc'), (3, 'xxx');
+REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz');
+REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL;
+SELECT * FROM t1;
+f1 f2
+1 klm
+2 xyz
+3 yyy
+connection node_2;
+SELECT COUNT(*) AS EXPECT_3 FROM t1;
+EXPECT_3
+3
+SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 1 AND f2 = 'klm';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy';
+EXPECT_1
+1
+SELECT * FROM t1;
+f1 f2
+1 klm
+2 xyz
+3 yyy
+connection node_1;
+UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy';
+SELECT * FROM t1;
+f1 f2
+1 klm
+2 xyz
+3 zzz
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz';
+EXPECT_1
+1
+SELECT * FROM t1;
+f1 f2
+1 klm
+2 xyz
+3 zzz
+connection node_1;
+DELETE FROM t1 WHERE f2 = 'zzz';
+SELECT * FROM t1;
+f1 f2
+1 klm
+2 xyz
+connection node_2;
+SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz';
+EXPECT_0
+0
+SELECT * FROM t1;
+f1 f2
+1 klm
+2 xyz
+connection node_1;
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+f1 f2
+connection node_2;
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
+0
+SELECT * FROM t1;
+f1 f2
+connection node_1;
+DROP TABLE t1;
+connection node_1;
+SET GLOBAL wsrep_sync_wait=15;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=Aria;
+CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+connection node_2;
+SET GLOBAL wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_1 FROM t2;
+EXPECT_1
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2);
+INSERT INTO t2 VALUES (2);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+connection node_2;
+SELECT COUNT(*) AS EXPECT_2 FROM t1;
+EXPECT_2
+2
+SELECT COUNT(*) AS EXPECT_1 FROM t2;
+EXPECT_1
+1
+connection node_1;
+DROP TABLE t1,t2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=Aria;
+CREATE TABLE t2 (f2 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+connection node_2;
+INSERT INTO t1 VALUES (1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+connection node_1;
+COMMIT;
+ERROR HY000: Transactional commit not supported by involved engine(s)
+DROP TABLE t1,t2;
+connection node_1;
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+SELECT * FROM t1;
+i
+1
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=Aria;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
+PREPARE upd from 'update t1 set b = 100 where id = 5';
+PREPARE ins from 'insert into t1 values (11,11)';
+PREPARE del from 'delete from t1 where id = 4';
+PREPARE rep from 'replace into t1 values (12,12),(6,600)';
+EXECUTE upd;
+EXECUTE ins;
+EXECUTE del;
+EXECUTE rep;
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 2
+3 3
+5 100
+6 600
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+connection node_2;
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 2
+3 3
+5 100
+6 600
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+connection node_1;
+DROP TABLE t1;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=Aria;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
+CREATE PROCEDURE proc()
+BEGIN
+UPDATE t1 set b = 100 WHERE id = 5;
+INSERT INTO t1 VALUES (11,11);
+DELETE FROM t1 WHERE id = 4;
+REPLACE INTO t1 VALUES (12,12),(6,600);
+COMMIT;
+END|
+CALL proc();
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 2
+3 3
+5 100
+6 600
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+connection node_2;
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 2
+3 3
+5 100
+6 600
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+connection node_1;
+DROP PROCEDURE proc;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=Aria;
+CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT) ENGINE=Aria;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, NEW.b);
+CREATE TRIGGER tr2 BEFORE UPDATE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, OLD.b),(NULL, NEW.b);
+CREATE TRIGGER tr3 BEFORE DELETE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, OLD.b);
+INSERT INTO t1 VALUES (11,11);
+UPDATE t1 SET b = 200 WHERE id = 2;
+DELETE FROM t1 where id = 5;
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 200
+3 3
+4 4
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+SELECT * FROM t2 ORDER BY id;
+id b
+1 11
+2 2
+3 200
+4 5
+connection node_2;
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 200
+3 3
+4 4
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+SELECT * FROM t2 ORDER BY id;
+id b
+1 11
+2 2
+3 200
+4 5
+connection node_1;
+DROP TRIGGER tr1;
+DROP TRIGGER tr2;
+DROP TRIGGER tr3;
+DROP TABLE t1,t2;
diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result
new file mode 100644
index 00000000..33722ba0
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result
@@ -0,0 +1,10 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
+0
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result
new file mode 100644
index 00000000..d8463f67
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result
@@ -0,0 +1,238 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
+connection node_2;
+SET GLOBAL wsrep_mode = REPLICATE_MYISAM;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2), (3);
+INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
+connection node_2;
+SELECT COUNT(*) AS EXPECT_5 FROM t1;
+EXPECT_5
+5
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(100)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1, 'abc'),(2,'abc'), (3, 'xxx');
+REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz');
+REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL;
+connection node_2;
+SELECT COUNT(*) AS EXPECT_3 FROM t1;
+EXPECT_3
+3
+SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 1 AND f2 = 'klm';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz';
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy';
+EXPECT_1
+1
+connection node_1;
+UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy';
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz';
+EXPECT_1
+1
+connection node_1;
+DELETE FROM t1 WHERE f2 = 'zzz';
+connection node_2;
+SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz';
+EXPECT_0
+0
+connection node_1;
+TRUNCATE TABLE t1;
+connection node_2;
+SELECT COUNT(*) AS EXPECT_0 FROM t1;
+EXPECT_0
+0
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
+CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+COMMIT;
+connection node_2;
+SELECT COUNT(*) AS EXPECT_1 FROM t1;
+EXPECT_1
+1
+SELECT COUNT(*) AS EXPECT_1 FROM t2;
+EXPECT_1
+1
+connection node_1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2);
+INSERT INTO t2 VALUES (2);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+connection node_2;
+SELECT COUNT(*) AS EXPECT_2 FROM t1;
+EXPECT_2
+2
+SELECT COUNT(*) AS EXPECT_1 FROM t2;
+EXPECT_1
+1
+DROP TABLE t1;
+DROP TABLE t2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE t2 (f2 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+connection node_2;
+INSERT INTO t1 VALUES (1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+connection node_1;
+COMMIT;
+DROP TABLE t1, t2;
+connection node_1;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=MyISAM;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
+PREPARE upd from 'update t1 set b = 100 where id = 5';
+PREPARE ins from 'insert into t1 values (11,11)';
+PREPARE del from 'delete from t1 where id = 4';
+PREPARE rep from 'replace into t1 values (12,12),(6,600)';
+EXECUTE upd;
+EXECUTE ins;
+EXECUTE del;
+EXECUTE rep;
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 2
+3 3
+5 100
+6 600
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+connection node_2;
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 2
+3 3
+5 100
+6 600
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=MyISAM;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
+CREATE PROCEDURE proc()
+BEGIN
+UPDATE t1 set b = 100 WHERE id = 5;
+INSERT INTO t1 VALUES (11,11);
+DELETE FROM t1 WHERE id = 4;
+REPLACE INTO t1 VALUES (12,12),(6,600);
+COMMIT;
+END|
+CALL proc();
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 2
+3 3
+5 100
+6 600
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+connection node_2;
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 2
+3 3
+5 100
+6 600
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+DROP PROCEDURE proc;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=MyISAM;
+CREATE TABLE t2 (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT) ENGINE=MyISAM;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10);
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, NEW.b);
+CREATE TRIGGER tr2 BEFORE UPDATE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, OLD.b),(NULL, NEW.b);
+CREATE TRIGGER tr3 BEFORE DELETE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NULL, OLD.b);
+INSERT INTO t1 VALUES (11,11);
+UPDATE t1 SET b = 200 WHERE id = 2;
+DELETE FROM t1 where id = 5;
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 200
+3 3
+4 4
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+SELECT * FROM t2 ORDER BY id;
+id b
+1 11
+2 2
+3 200
+4 5
+connection node_2;
+SELECT * FROM t1 ORDER BY id;
+id b
+1 1
+2 200
+3 3
+4 4
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+SELECT * FROM t2 ORDER BY id;
+id b
+1 11
+2 2
+3 200
+4 5
+DROP TRIGGER tr1;
+DROP TRIGGER tr2;
+DROP TRIGGER tr3;
+DROP TABLE t1,t2;
+#
+# MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO
+#
+connection node_1;
+CREATE TABLE t1 (i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+SELECT * FROM t1;
+i
+1
+DROP TABLE t1;
+connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
new file mode 100644
index 00000000..eee740b6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
@@ -0,0 +1,86 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_retry_autocommit = 0;
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
+INSERT INTO t1 (f1) VALUES (2);
+connection node_1a;
+SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
+connection node_2;
+TRUNCATE TABLE t1;
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SET DEBUG_SYNC = 'RESET';
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_retry_autocommit = 1;
+SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
+INSERT INTO t1 (f1) VALUES (3);
+connection node_1a;
+SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
+connection node_2;
+TRUNCATE TABLE t1;
+connection node_1a;
+SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SET DEBUG_SYNC = 'RESET';
+SET GLOBAL debug_dbug = NULL;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_retry_autocommit = 1;
+SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 2';
+INSERT INTO t1 VALUES (4);;
+connection node_1a;
+SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
+connection node_2;
+TRUNCATE TABLE t1;
+connection node_1a;
+SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_cert';
+connection node_2;
+TRUNCATE TABLE t1;
+connection node_1a;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+connection node_1;
+SET DEBUG_SYNC = 'RESET';
+SET GLOBAL debug_dbug = NULL;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+SET SESSION wsrep_retry_autocommit = 64;
+SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
+SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64';
+INSERT INTO t1 VALUES (5);
+connection node_2;
+connection node_1;
+connection node_1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SET DEBUG_SYNC = 'RESET';
+SET GLOBAL debug_dbug = NULL;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_var_slave_threads.result b/mysql-test/suite/galera/r/galera_var_slave_threads.result
new file mode 100644
index 00000000..36dc79bd
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result
@@ -0,0 +1,60 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
+CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;
+connection node_2;
+CALL mtr.add_suppression("WSREP: Refusing exit for the last slave thread.");
+SET GLOBAL wsrep_slave_threads = 0;
+Warnings:
+Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
+SHOW WARNINGS;
+Level Code Message
+Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
+SELECT @@wsrep_slave_threads = 1;
+@@wsrep_slave_threads = 1
+1
+SET GLOBAL wsrep_slave_threads = 1;
+SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%wsrep aborter%';
+COUNT(*)
+1
+connection node_1;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SET GLOBAL wsrep_slave_threads = 64;
+SET GLOBAL wsrep_slave_threads = 1;
+connection node_1;
+connection node_2;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+70
+SET GLOBAL wsrep_slave_threads = 1;
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# lp:1372840 - Changing wsrep_slave_threads causes future connections to hang
+#
+connection node_1;
+CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY) ENGINE=INNODB;
+connection node_2;
+SET GLOBAL wsrep_slave_threads = 4;
+SET GLOBAL wsrep_slave_threads = 1;
+connection node_1;
+INSERT INTO t1 VALUES (DEFAULT);
+INSERT INTO t1 VALUES (DEFAULT);
+INSERT INTO t1 VALUES (DEFAULT);
+INSERT INTO t1 VALUES (DEFAULT);
+INSERT INTO t1 VALUES (DEFAULT);
+INSERT INTO t1 VALUES (DEFAULT);
+INSERT INTO t1 VALUES (DEFAULT);
+INSERT INTO t1 VALUES (DEFAULT);
+DROP TABLE t1;
+connection node_2;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+NAME
+# End of tests
diff --git a/mysql-test/suite/galera/r/galera_var_sst_auth.result b/mysql-test/suite/galera/r/galera_var_sst_auth.result
new file mode 100644
index 00000000..98d683c3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_sst_auth.result
@@ -0,0 +1,22 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+SELECT @@global.wsrep_sst_auth;
+@@global.wsrep_sst_auth
+********
+SET @@global.wsrep_sst_auth='foo:bar';
+SELECT @@global.wsrep_sst_auth;
+@@global.wsrep_sst_auth
+********
+connection node_2;
+SET @@global.wsrep_sst_auth= 'abcdefghijklmnopqrstuvwxyz';
+SELECT @@global.wsrep_sst_auth;
+@@global.wsrep_sst_auth
+********
+Shutdown node_2
+connection node_1;
+connection node_2;
+SELECT @@global.wsrep_sst_auth;
+@@global.wsrep_sst_auth
+********
diff --git a/mysql-test/suite/galera/r/galera_var_sync_wait.result b/mysql-test/suite/galera/r/galera_var_sync_wait.result
new file mode 100644
index 00000000..80fbd3f3
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_sync_wait.result
@@ -0,0 +1,36 @@
+connection node_2;
+connection node_1;
+#
+# MDEV-10161: wsrep_sync_wait not enabled when set to 1 in config file
+#
+SELECT @@global.wsrep_sync_wait;
+@@global.wsrep_sync_wait
+15
+SELECT @@global.wsrep_causal_reads;
+@@global.wsrep_causal_reads
+1
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
+connection node_2;
+SET GLOBAL wsrep_sync_wait = 1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection node_1;
+CREATE TABLE t2 (f1 INT PRIMARY KEY) Engine=InnoDB;
+connection node_2;
+SET GLOBAL wsrep_sync_wait = 4;
+INSERT INTO t2 VALUES (1);
+connection node_1;
+CREATE TABLE t3 (f1 INT PRIMARY KEY) Engine=InnoDB;
+INSERT INTO t3 VALUES (1);
+connection node_2;
+SET GLOBAL wsrep_sync_wait = 2;
+UPDATE t3 SET f1 = 2;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+connection node_2;
+SET GLOBAL wsrep_sync_wait = 15;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
diff --git a/mysql-test/suite/galera/r/galera_var_trx_fragment_size.result b/mysql-test/suite/galera/r/galera_var_trx_fragment_size.result
new file mode 100644
index 00000000..be14c535
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_trx_fragment_size.result
@@ -0,0 +1,95 @@
+connection node_2;
+connection node_1;
+SET SESSION wsrep_trx_fragment_size=DEFAULT;
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SET SESSION wsrep_trx_fragment_size=0;
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SET GLOBAL wsrep_trx_fragment_size=DEFAULT;
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SET GLOBAL wsrep_trx_fragment_size=0;
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SET GLOBAL wsrep_trx_fragment_size=-1;
+Warnings:
+Warning 1292 Truncated incorrect wsrep_trx_fragment_size value: '-1'
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SET SESSION wsrep_trx_fragment_size=-1;
+Warnings:
+Warning 1292 Truncated incorrect wsrep_trx_fragment_size value: '-1'
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SET GLOBAL wsrep_trx_fragment_size=100;
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 0
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 100
+SET SESSION wsrep_trx_fragment_size=100;
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 100
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 100
+SET GLOBAL wsrep_trx_fragment_size='A';
+ERROR 42000: Incorrect argument type to variable 'wsrep_trx_fragment_size'
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 100
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 100
+SET SESSION wsrep_trx_fragment_size='A';
+ERROR 42000: Incorrect argument type to variable 'wsrep_trx_fragment_size'
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 100
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 100
+SET GLOBAL wsrep_trx_fragment_size=NULL;
+ERROR 42000: Incorrect argument type to variable 'wsrep_trx_fragment_size'
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 100
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 100
+SET SESSION wsrep_trx_fragment_size=NULL;
+ERROR 42000: Incorrect argument type to variable 'wsrep_trx_fragment_size'
+SHOW SESSION VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 100
+SHOW GLOBAL VARIABLES LIKE 'wsrep_trx_fragment_size';
+Variable_name Value
+wsrep_trx_fragment_size 100
+SET GLOBAL wsrep_trx_fragment_size=DEFAULT;
diff --git a/mysql-test/suite/galera/r/galera_var_wsrep_mode.result b/mysql-test/suite/galera/r/galera_var_wsrep_mode.result
new file mode 100644
index 00000000..b5b33fe8
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_wsrep_mode.result
@@ -0,0 +1,79 @@
+connection node_2;
+connection node_1;
+SELECT @@wsrep_mode;
+@@wsrep_mode
+
+SET GLOBAL wsrep_mode=DEFAULT;
+SELECT @@wsrep_mode;
+@@wsrep_mode
+
+SET SESSION wsrep_mode=DEFAULT;
+ERROR HY000: Variable 'wsrep_mode' is a GLOBAL variable and should be set with SET GLOBAL
+SELECT @@global.wsrep_mode;
+@@global.wsrep_mode
+
+SELECT @@session.wsrep_mode;
+ERROR HY000: Variable 'wsrep_mode' is a GLOBAL variable
+SET GLOBAL wsrep_mode=A;
+ERROR 42000: Variable 'wsrep_mode' can't be set to the value of 'A'
+SET GLOBAL wsrep_mode='A';
+ERROR 42000: Variable 'wsrep_mode' can't be set to the value of 'A'
+SET GLOBAL wsrep_mode=NULL;
+ERROR 42000: Variable 'wsrep_mode' can't be set to the value of 'NULL'
+SET GLOBAL wsrep_mode=128;
+ERROR 42000: Variable 'wsrep_mode' can't be set to the value of '128'
+SET GLOBAL wsrep_mode=REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
+SET GLOBAL wsrep_mode=1;
+SELECT @@wsrep_mode;
+@@wsrep_mode
+STRICT_REPLICATION
+SET GLOBAL wsrep_mode=32;
+SELECT @@wsrep_mode;
+@@wsrep_mode
+DISALLOW_LOCAL_GTID
+SET GLOBAL wsrep_mode='';
+SELECT @@wsrep_mode;
+@@wsrep_mode
+
+SET GLOBAL wsrep_mode=STRICT_REPLICATION;
+SELECT @@wsrep_mode;
+@@wsrep_mode
+STRICT_REPLICATION
+SET GLOBAL wsrep_mode=BINLOG_ROW_FORMAT_ONLY;
+SELECT @@wsrep_mode;
+@@wsrep_mode
+BINLOG_ROW_FORMAT_ONLY
+SET GLOBAL wsrep_mode=REQUIRED_PRIMARY_KEY;
+SELECT @@wsrep_mode;
+@@wsrep_mode
+REQUIRED_PRIMARY_KEY
+SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
+SELECT @@wsrep_mode;
+@@wsrep_mode
+REPLICATE_MYISAM
+SET GLOBAL wsrep_mode=REPLICATE_ARIA;
+SELECT @@wsrep_mode;
+@@wsrep_mode
+REPLICATE_ARIA
+SET GLOBAL wsrep_mode=DISALLOW_LOCAL_GTID;
+SELECT @@wsrep_mode;
+@@wsrep_mode
+DISALLOW_LOCAL_GTID
+SET GLOBAL wsrep_mode='STRICT_REPLICATION,BINLOG_ROW_FORMAT_ONLY';
+SELECT @@wsrep_mode;
+@@wsrep_mode
+STRICT_REPLICATION,BINLOG_ROW_FORMAT_ONLY
+SET GLOBAL wsrep_mode='STRICT_REPLICATION,BINLOG_ROW_FORMAT_ONLY,REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM,REPLICATE_ARIA,DISALLOW_LOCAL_GTID';
+SELECT @@wsrep_mode;
+@@wsrep_mode
+STRICT_REPLICATION,BINLOG_ROW_FORMAT_ONLY,REQUIRED_PRIMARY_KEY,REPLICATE_MYISAM,REPLICATE_ARIA,DISALLOW_LOCAL_GTID
+SET GLOBAL wsrep_mode='BINLOG_ROW_FORMAT_ONLY,STRICT_REPLICATION';
+SELECT @@wsrep_mode;
+@@wsrep_mode
+STRICT_REPLICATION,BINLOG_ROW_FORMAT_ONLY
+SET GLOBAL wsrep_mode='STRICT_REPLICATION,REQUIRED_PRIMARY_KEY,REPLICATE_ARIA,DISALLOW_LOCAL_GTID';
+SELECT @@wsrep_mode;
+@@wsrep_mode
+STRICT_REPLICATION,REQUIRED_PRIMARY_KEY,REPLICATE_ARIA,DISALLOW_LOCAL_GTID
+SET GLOBAL wsrep_mode=DEFAULT;
diff --git a/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result b/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result
new file mode 100644
index 00000000..98cda088
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_wsrep_on_off.result
@@ -0,0 +1,132 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+SET SESSION wsrep_on = FALSE;
+INSERT INTO t1 VALUES (2);
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+connection node_1;
+SET GLOBAL wsrep_on = TRUE;
+INSERT INTO t1 VALUES (3);
+connection node_2;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 2;
+COUNT(*) = 0
+1
+SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3;
+COUNT(*) = 1
+1
+DROP TABLE t1;
+connection node_1;
+connection node_1;
+START TRANSACTION;
+SET SESSION wsrep_on=OFF;
+ERROR 25000: You are not allowed to execute this command in a transaction
+SET GLOBAL wsrep_on=OFF;
+ERROR 25000: You are not allowed to execute this command in a transaction
+COMMIT;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;;
+connection node_1a;
+SET GLOBAL wsrep_on = OFF;
+connection node_1;
+SHOW SESSION VARIABLES LIKE 'wsrep_on';
+Variable_name Value
+wsrep_on ON
+SHOW GLOBAL VARIABLES LIKE 'wsrep_on';
+Variable_name Value
+wsrep_on OFF
+INSERT INTO t1 VALUES (2);
+COMMIT;
+connection node_2;
+SET SESSION wsrep_sync_wait = 15;
+SELECT * FROM t1;
+f1
+1
+2
+connection node_1a;
+SET GLOBAL wsrep_on = ON;
+DROP TABLE t1;
+connection node_2;
+connection node_1;
+SET GLOBAL wsrep_on = OFF;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;;
+connection node_1b;
+SHOW SESSION VARIABLES LIKE 'wsrep_on';
+Variable_name Value
+wsrep_on OFF
+SHOW GLOBAL VARIABLES LIKE 'wsrep_on';
+Variable_name Value
+wsrep_on OFF
+CREATE TABLE t2 (f1 INTEGER);
+DROP TABLE t2;
+SET GLOBAL wsrep_on = ON;
+SHOW SESSION VARIABLES LIKE 'wsrep_on';
+Variable_name Value
+wsrep_on ON
+disconnect node_1b;
+connection node_2;
+connection node_1;
+SET GLOBAL wsrep_on = OFF;
+SET SESSION wsrep_on = ON;
+ERROR HY000: Can't enable @@session.wsrep_on, while @@global.wsrep_on is disabled
+SET GLOBAL wsrep_on = ON;
+SET SESSION wsrep_on = ON;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+SET GLOBAL wsrep_on = OFF;
+connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;;
+connection node_1b;
+SHOW SESSION VARIABLES LIKE 'wsrep_on';
+Variable_name Value
+wsrep_on OFF
+SHOW GLOBAL VARIABLES LIKE 'wsrep_on';
+Variable_name Value
+wsrep_on OFF
+SET GLOBAL wsrep_on = ON;
+START TRANSACTION;
+INSERT INTO t1 VALUES(1);
+COMMIT;
+SELECT * FROM t1;
+f1
+1
+connection node_2;
+SELECT * FROM t1;
+f1
+1
+DROP TABLE t1;
+connection node_1;
+connection node_1;
+SET SESSION wsrep_on = OFF;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+START TRANSACTION;
+INSERT INTO t1 VALUES (2);
+COMMIT;
+DROP TABLE t1;
+connection node_2;
+SHOW TABLES;
+Tables_in_test
+connection node_1;
+SET SESSION wsrep_on = ON;
+SET GLOBAL wsrep_on = OFF;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+INSERT INTO t1 VALUES (1);
+START TRANSACTION;
+INSERT INTO t1 VALUES (2);
+COMMIT;
+connection node_2;
+SHOW TABLES;
+Tables_in_test
+connection node_1;
+DROP TABLE t1;
+SET GLOBAL wsrep_on = ON;
+connection node_2;
diff --git a/mysql-test/suite/galera/r/galera_var_wsrep_provider_options.result b/mysql-test/suite/galera/r/galera_var_wsrep_provider_options.result
new file mode 100644
index 00000000..5ef4a23f
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_wsrep_provider_options.result
@@ -0,0 +1,10 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: Unknown parameter 'a'");
+call mtr.add_suppression("WSREP: Set options returned 7");
+SET GLOBAL wsrep_provider_options=NULL;
+ERROR HY000: Incorrect arguments to SET
+SET GLOBAL wsrep_provider_options='';
+SET GLOBAL wsrep_provider_options=' ';
+SET GLOBAL wsrep_provider_options='a=1';
+ERROR HY000: Incorrect arguments to SET
diff --git a/mysql-test/suite/galera/r/galera_var_wsrep_start_position.result b/mysql-test/suite/galera/r/galera_var_wsrep_start_position.result
new file mode 100644
index 00000000..3d409f90
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_var_wsrep_start_position.result
@@ -0,0 +1,105 @@
+connection node_2;
+connection node_1;
+#
+# wsrep_start_position
+#
+CALL mtr.add_suppression("WSREP: SST failed for position .*");
+SET @wsrep_start_position_global_saved = @@global.wsrep_start_position;
+# default
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+
+# scope
+SELECT @@session.wsrep_start_position;
+ERROR HY000: Variable 'wsrep_start_position' is a GLOBAL variable
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+
+# valid values
+SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1';
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+
+SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:0';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '00000000-0000-0000-0000-000000000000:0'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+# invalid values
+SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '00000000-0000-0000-0000-000000000000:-2'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2A';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '00000000-0000-0000-0000-000000000000:-2A'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:0A';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '00000000-0000-0000-0000-000000000000:0A'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position='000000000000000-0000-0000-0000-000000000000:-1';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '000000000000000-0000-0000-0000-000000000000:-1'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-12345-123456789012:100'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-123-12345-123456789012:0'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:_99999'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:a'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position='OFF';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'OFF'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position=ON;
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'ON'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position='';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of ''
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position=NULL;
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'NULL'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET @@global.wsrep_start_position='junk';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'junk'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+
+# restore the initial value
+SET @@global.wsrep_start_position = @wsrep_start_position_global_saved;
+# End of test
diff --git a/mysql-test/suite/galera/r/galera_view.result b/mysql-test/suite/galera/r/galera_view.result
new file mode 100644
index 00000000..c9a827c6
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_view.result
@@ -0,0 +1,5 @@
+connection node_2;
+connection node_1;
+CREATE VIEW v AS SELECT 1;
+RENAME TABLE v TO v2;
+DROP VIEW v2;
diff --git a/mysql-test/suite/galera/r/galera_virtual_blob.result b/mysql-test/suite/galera/r/galera_virtual_blob.result
new file mode 100644
index 00000000..fd1c84f7
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_virtual_blob.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t (f INT GENERATED ALWAYS AS (a+b)VIRTUAL,a INT,b INT,h BLOB);
+INSERT INTO t (a,b)VALUES(0,0), (0,0), (0,0), (0,0), (0,0);
+SELECT * from t;
+f a b h
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+connection node_2;
+SELECT * from t;
+f a b h
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+0 0 0 NULL
+connection node_1;
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/r/galera_virtual_column.result b/mysql-test/suite/galera/r/galera_virtual_column.result
new file mode 100644
index 00000000..71820ed8
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_virtual_column.result
@@ -0,0 +1,19 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE p (id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT) ENGINE = InnoDB;
+CREATE TABLE c (id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, pid INT UNSIGNED, bitmap TINYINT UNSIGNED NOT NULL DEFAULT 0, bitmap5 TINYINT UNSIGNED GENERATED ALWAYS AS (bitmap&(1<<5)) VIRTUAL, FOREIGN KEY (pid) REFERENCES p (id) ON DELETE CASCADE ON UPDATE CASCADE);
+CREATE INDEX bitmap5 ON c(bitmap5) USING BTREE;
+INSERT INTO p VALUES(1);
+INSERT INTO c(pid) VALUES(1);
+connection node_2;
+connection node_1;
+DELETE FROM p WHERE id=1;
+SELECT * FROM p;
+id
+SELECT * FROM c;
+id pid bitmap bitmap5
+connection node_2;
+connection node_1;
+DROP TABLE c;
+DROP TABLE p;
diff --git a/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result b/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result
new file mode 100644
index 00000000..c6b3d8fa
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_vote_rejoin_ddl.result
@@ -0,0 +1,66 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_4;
+connection node_3;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
+connection node_1;
+connection node_4;
+SET SESSION wsrep_on=OFF;
+CREATE TABLE t1 (f1 INTEGER);
+SET SESSION wsrep_on=ON;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t2 (f1 INTEGER);
+connection node_3;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
+connection node_1;
+connection node_3;
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+expect_0
+0
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+expect_1
+1
+connection node_4;
+SET SESSION wsrep_on=OFF;
+Killing server ...
+Starting mysqld
+connection node_1;
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+expect_0
+0
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+expect_1
+1
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+connection node_2;
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+expect_0
+0
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+expect_1
+1
+CALL mtr.add_suppression("Slave SQL: Error 'Unknown table");
+connection node_3;
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+expect_0
+0
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+expect_1
+1
+connection node_4;
+SELECT COUNT(*) AS expect_0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+expect_0
+0
+SELECT COUNT(*) AS expect_1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
+expect_1
+1
+CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with group. Leaving cluster.");
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result b/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result
new file mode 100644
index 00000000..bf73fe73
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_vote_rejoin_dml.result
@@ -0,0 +1,73 @@
+connection node_4;
+connection node_3;
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_4;
+connection node_3;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 'A');
+connection node_4;
+SET SESSION wsrep_on=OFF;
+INSERT INTO t1 VALUES (2, 'B');
+SET SESSION wsrep_on=ON;
+DELETE FROM t1 WHERE f1 = 2;
+connection node_1;
+connection node_3;
+SET SESSION wsrep_on = ON;
+SET SESSION wsrep_sync_wait = 15;
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
+connection node_1;
+connection node_3;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+COUNT(*) = 0
+1
+connection node_4;
+SET SESSION wsrep_on=OFF;
+Killing server ...
+Starting mysqld
+connection node_1;
+connection node_1;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+COUNT(*) = 0
+1
+CALL mtr.add_suppression("mariadbd: Can't find record in 't1'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows");
+CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*");
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+COUNT(*) = 0
+1
+CALL mtr.add_suppression("mariadbd: Can't find record in 't1'");
+CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows");
+CALL mtr.add_suppression("WSREP: Event 3 Delete_rows_v1 apply failed: 120, seqno [0-9]*");
+connection node_3;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+COUNT(*) = 0
+1
+connection node_4;
+SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'A';
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'B';
+COUNT(*) = 0
+1
+CALL mtr.add_suppression("inconsistent with group");
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_wan.result b/mysql-test/suite/galera/r/galera_wan.result
new file mode 100644
index 00000000..bc4113ff
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wan.result
@@ -0,0 +1,23 @@
+connection node_2;
+connection node_1;
+CALL mtr.add_suppression("WSREP: Stray state UUID msg:.*");
+CALL mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
+call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 4
+1
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_3;
+INSERT INTO t1 VALUES (1);
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_4;
+SELECT VARIABLE_VALUE LIKE '%gmcast.segment = 3%' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options';
+VARIABLE_VALUE LIKE '%gmcast.segment = 3%'
+1
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_wan_restart_ist.result b/mysql-test/suite/galera/r/galera_wan_restart_ist.result
new file mode 100644
index 00000000..46865a9c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wan_restart_ist.result
@@ -0,0 +1,109 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_4;
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_4
+4
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+INSERT INTO t1 VALUES (2);
+connection node_3;
+INSERT INTO t1 VALUES (3);
+connection node_4;
+INSERT INTO t1 VALUES (4);
+connection node_3;
+INSERT INTO t1 VALUES (13);
+Shutting down server ...
+connection node_1;
+SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_3
+3
+INSERT INTO t1 VALUES (11);
+connection node_2;
+INSERT INTO t1 VALUES (12);
+connection node_4;
+INSERT INTO t1 VALUES (14);
+connection node_3;
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_4
+4
+INSERT INTO t1 VALUES (131);
+connection node_2;
+INSERT INTO t1 VALUES (22);
+Shutting down server ...
+connection node_1;
+SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_3
+3
+INSERT INTO t1 VALUES (21);
+connection node_3;
+INSERT INTO t1 VALUES (23);
+connection node_4;
+INSERT INTO t1 VALUES (24);
+connection node_2;
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_4
+4
+INSERT INTO t1 VALUES (221);
+connection node_4;
+INSERT INTO t1 VALUES (34);
+Shutting down server ...
+connection node_1;
+SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_3
+3
+INSERT INTO t1 VALUES (31);
+connection node_2;
+INSERT INTO t1 VALUES (32);
+connection node_3;
+INSERT INTO t1 VALUES (33);
+connection node_4;
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_4
+4
+INSERT INTO t1 VALUES (341);
+connection node_1;
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
+connection node_2;
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 4
+1
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
+connection node_3;
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 4
+1
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
+connection node_4;
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 4
+1
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
+connection node_1;
+DROP TABLE t1;
+CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
+connection node_2;
+CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
+connection node_3;
+CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
+CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
+connection node_4;
+CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
+connection node_1;
+disconnect node_3;
+disconnect node_4;
diff --git a/mysql-test/suite/galera/r/galera_wan_restart_sst.result b/mysql-test/suite/galera/r/galera_wan_restart_sst.result
new file mode 100644
index 00000000..2433a1d9
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wan_restart_sst.result
@@ -0,0 +1,94 @@
+connection node_2;
+connection node_1;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_4;
+SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+EXPECT_4
+4
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER);
+INSERT INTO t1 VALUES (1);
+connection node_2;
+INSERT INTO t1 VALUES (2);
+connection node_3;
+INSERT INTO t1 VALUES (3);
+connection node_4;
+INSERT INTO t1 VALUES (4);
+connection node_3;
+INSERT INTO t1 VALUES (13);
+Killing server ...
+connection node_1;
+INSERT INTO t1 VALUES (11);
+connection node_2;
+INSERT INTO t1 VALUES (12);
+connection node_4;
+INSERT INTO t1 VALUES (14);
+connection node_3;
+INSERT INTO t1 VALUES (131);
+connection node_2;
+INSERT INTO t1 VALUES (22);
+Killing server ...
+connection node_1;
+INSERT INTO t1 VALUES (21);
+connection node_3;
+INSERT INTO t1 VALUES (23);
+connection node_4;
+INSERT INTO t1 VALUES (24);
+connection node_2;
+INSERT INTO t1 VALUES (221);
+connection node_4;
+INSERT INTO t1 VALUES (34);
+Killing server ...
+connection node_1;
+INSERT INTO t1 VALUES (31);
+connection node_2;
+INSERT INTO t1 VALUES (32);
+connection node_3;
+INSERT INTO t1 VALUES (33);
+connection node_4;
+INSERT INTO t1 VALUES (341);
+connection node_1;
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
+connection node_2;
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 4
+1
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
+connection node_3;
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 4
+1
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
+connection node_4;
+SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+VARIABLE_VALUE = 4
+1
+SELECT COUNT(*) AS EXPECT_19 FROM t1;
+EXPECT_19
+19
+connection node_1;
+DROP TABLE t1;
+CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
+CALL mtr.add_suppression("WSREP: gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)");
+connection node_2;
+CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
+CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
+connection node_3;
+CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
+CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
+connection node_4;
+CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
+CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
+connection node_1;
+disconnect node_3;
+disconnect node_4;
diff --git a/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result
new file mode 100644
index 00000000..e01825fd
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wsrep_desync_wsrep_on.result
@@ -0,0 +1,43 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE ten (f1 INTEGER);
+INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
+INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+connection node_2;
+SELECT COUNT(*) = 100000 FROM t1;
+COUNT(*) = 100000
+1
+SET GLOBAL wsrep_desync = TRUE;
+SET SESSION wsrep_on = FALSE;
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_on = TRUE;
+SET GLOBAL wsrep_desync = FALSE;
+INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
+SELECT COUNT(*) = 200000 FROM t1;
+COUNT(*) = 200000
+1
+SELECT MAX(f1) = 199999 FROM t1;
+MAX(f1) = 199999
+1
+connection node_1;
+SELECT COUNT(*) = 200000 FROM t1;
+COUNT(*) = 200000
+1
+SELECT MAX(f1) = 199999 FROM t1;
+MAX(f1) = 199999
+1
+SET GLOBAL wsrep_desync = TRUE;
+SET SESSION wsrep_on = FALSE;
+ALTER TABLE t1 ADD PRIMARY KEY (f1);
+SET SESSION wsrep_on = TRUE;
+SET GLOBAL wsrep_desync = FALSE;
+connection node_2;
+INSERT INTO t1 (f1) VALUES (1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+connection node_1;
+INSERT INTO t1 (f1) VALUES (100);
+ERROR 23000: Duplicate entry '100' for key 'PRIMARY'
+DROP TABLE t1;
+DROP TABLE ten;
diff --git a/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result b/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result
new file mode 100644
index 00000000..59883f1c
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (
+f1 VARCHAR(255) PRIMARY KEY
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES ('abc');
+connection node_2;
+SELECT f1 = 'abc' FROM t1;
+f1 = 'abc'
+1
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'klm';
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+UPDATE t1 SET f1 = 'xyz';
+connection node_1;
+COMMIT;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+connection node_2;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+include/assert_grep.inc [cluster conflict due to high priority abort for threads]
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_wsrep_mode.result b/mysql-test/suite/galera/r/galera_wsrep_mode.result
new file mode 100644
index 00000000..89fd4c1b
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wsrep_mode.result
@@ -0,0 +1,16 @@
+connection node_2;
+connection node_1;
+SET GLOBAL wsrep_mode = REQUIRED_PRIMARY_KEY;
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+ERROR HY000: Galera replication not supported
+SHOW WARNINGS;
+Level Code Message
+Error 4165 Galera replication not supported
+Warning 1290 WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table should have PRIMARY KEY defined.
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+DROP TABLE t1;
+SET GLOBAL wsrep_mode = default;
+SET GLOBAL wsrep_mode = STRICT_REPLICATION;
+CREATE VIEW v AS SELECT * FROM JSON_TABLE ('{"a":0}',"$" COLUMNS (a DECIMAL(1,1) path '$.a')) foo;
+DROP VIEW v;
+SET GLOBAL wsrep_mode = default;
diff --git a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
new file mode 100644
index 00000000..143dee3e
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
@@ -0,0 +1,52 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+Shutting down server ...
+connection node_1;
+connection node_2;
+Cleaning grastate.dat file ...
+Starting server ...
+connection node_1;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE
+Primary
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+VARIABLE_VALUE
+ON
+SELECT (VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 ) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+(VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 )
+1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE
+ON
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE
+4
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE
+Synced
+connection node_2;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+VARIABLE_VALUE
+Primary
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
+VARIABLE_VALUE
+ON
+SELECT (VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 ) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
+(VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 )
+1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+VARIABLE_VALUE
+ON
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
+VARIABLE_VALUE
+4
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
+VARIABLE_VALUE
+Synced
+Shutting down server ...
+Cleaning var directory ...
+Starting server ...
+connection node_1;
diff --git a/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result b/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result
new file mode 100644
index 00000000..0f7cd134
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result
@@ -0,0 +1,7 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP\: Unknown parameter 'gmcasts\.segment'");
+call mtr.add_suppression("WSREP\: Set options returned 7");
+SET GLOBAL wsrep_provider_options="gmcasts.segment=1";
+ERROR HY000: Incorrect arguments to SET
+Unhandled exceptions: 0
diff --git a/mysql-test/suite/galera/r/galera_zero_length_column.result b/mysql-test/suite/galera/r/galera_zero_length_column.result
new file mode 100644
index 00000000..fa292647
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_zero_length_column.result
@@ -0,0 +1,43 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY , f2 VARCHAR(0)) ENGINE=InnoDB;
+CREATE TABLE t2 (f1 VARCHAR(0)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (2, '');
+INSERT INTO t2 VALUES (NULL);
+INSERT INTO t2 VALUES ('');
+connection node_2;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT f2 IS NULL FROM t1 WHERE f1 = 1;
+f2 IS NULL
+1
+SELECT f2 = '' FROM t1 WHERE f1 = 2;
+f2 = ''
+1
+SELECT COUNT(*) = 2 FROM t2;
+COUNT(*) = 2
+1
+SELECT f1 IS NULL FROM t2 WHERE f1 IS NULL;
+f1 IS NULL
+1
+SELECT f1 = '' FROM t2 WHERE f1 IS NOT NULL;
+f1 = ''
+1
+UPDATE t1 SET f2 = '' WHERE f1 = 1;
+UPDATE t1 SET f2 = NULL WHERE f1 = 2;
+UPDATE t2 SET f1 = '' WHERE f1 IS NULL;
+connection node_1;
+SELECT f2 = '' FROM t1 WHERE f1 = 1;
+f2 = ''
+1
+SELECT f2 IS NULL FROM t1 WHERE f1 = 2;
+f2 IS NULL
+1
+SELECT COUNT(*) = 2 FROM t2 WHERE f1 = '';
+COUNT(*) = 2
+1
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/grant.result b/mysql-test/suite/galera/r/grant.result
new file mode 100644
index 00000000..56f56d3b
--- /dev/null
+++ b/mysql-test/suite/galera/r/grant.result
@@ -0,0 +1,23 @@
+connection node_2;
+connection node_1;
+#
+# MDEV#6266: Changing password fails on galera cluster
+#
+
+# On node_1
+connection node_1;
+GRANT SELECT ON *.* TO 'user_6266'@'localhost' IDENTIFIED BY 'pass';
+
+# Now, try changing password for 'user_6266'. This command should also
+# execute successfully on the other node.
+SET PASSWORD FOR 'user_6266'@'localhost' = PASSWORD('newpass');
+
+# On node_2
+connection node_2;
+SELECT user FROM mysql.user WHERE user='user_6266';
+User
+user_6266
+DROP USER 'user_6266'@'localhost';
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/have_wsrep_replicate_myisam.require b/mysql-test/suite/galera/r/have_wsrep_replicate_myisam.require
new file mode 100644
index 00000000..c55610fd
--- /dev/null
+++ b/mysql-test/suite/galera/r/have_wsrep_replicate_myisam.require
@@ -0,0 +1,2 @@
+Variable_name Value
+wsrep_replicate_myisam ON
diff --git a/mysql-test/suite/galera/r/lp1276424.result b/mysql-test/suite/galera/r/lp1276424.result
new file mode 100644
index 00000000..be27ee53
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1276424.result
@@ -0,0 +1,14 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT DEFAULT NULL, UNIQUE KEY i1 (f1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (NULL);
+connection node_2;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SELECT f1 IS NULL FROM t1;
+f1 IS NULL
+1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/lp1347768.result b/mysql-test/suite/galera/r/lp1347768.result
new file mode 100644
index 00000000..49c8894c
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1347768.result
@@ -0,0 +1,19 @@
+connection node_2;
+connection node_1;
+CREATE TABLE `r8kmb_redirect_links` (
+`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`old_url` varchar(255) DEFAULT NULL,
+`new_url` varchar(255) NOT NULL,
+`referer` varchar(150) NOT NULL,
+`comment` varchar(255) NOT NULL,
+`published` tinyint(4) NOT NULL,
+`created_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+`modified_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+PRIMARY KEY (`id`),
+UNIQUE KEY `idx_link_old` (`old_url`),
+KEY `idx_link_modifed` (`modified_date`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT IGNORE INTO r8kmb_redirect_links VALUES (550,'http://mysite.com/images/download/ßуñûічýøù_ôþóþòір_þфõÑ.doc','','','',0,'2013-07-15 14:29:42','0000-00-00 00:00:00');
+Warnings:
+Warning 1265 Data truncated for column 'old_url' at row 1
+DROP TABLE r8kmb_redirect_links;
diff --git a/mysql-test/suite/galera/r/lp1376747-2.result b/mysql-test/suite/galera/r/lp1376747-2.result
new file mode 100644
index 00000000..950606ee
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1376747-2.result
@@ -0,0 +1,28 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+NAME
+test/t1
+FLUSH TABLES t1 FOR EXPORT;
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2,3);
+connection node_2;
+UNLOCK TABLES;
+### t1 should have column f2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `f2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * from t1;
+id f2
+1 NULL
+2 3
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/lp1376747-3.result b/mysql-test/suite/galera/r/lp1376747-3.result
new file mode 100644
index 00000000..916c3d80
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1376747-3.result
@@ -0,0 +1,29 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+FLUSH TABLE WITH READ LOCK;
+### This shouldn't block.
+FLUSH TABLES t1 FOR EXPORT;
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+connection node_2;
+UNLOCK TABLES;
+### t1 should have column f2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `f2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_1;
+INSERT INTO t1 VALUES (2,3);
+connection node_2;
+SELECT * from t1;
+id f2
+1 NULL
+2 3
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/lp1376747-4.result b/mysql-test/suite/galera/r/lp1376747-4.result
new file mode 100644
index 00000000..16141f02
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1376747-4.result
@@ -0,0 +1,48 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SET session wsrep_sync_wait=0;
+FLUSH TABLES WITH READ LOCK;
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2,3);
+connection node_2a;
+SET session wsrep_sync_wait=0;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SET debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked2 WAIT_FOR go2';
+FLUSH TABLES t1 WITH READ LOCK;;
+connection node_2;
+SET debug_sync='now WAIT_FOR parked2';
+SET debug_sync='now SIGNAL go2';
+UNLOCK TABLES;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_2a;
+set debug_sync= 'RESET';
+UNLOCK TABLES;
+SET SESSION wsrep_sync_wait = DEFAULT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `f2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * from t1;
+id f2
+1 NULL
+2 3
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/lp1376747.result b/mysql-test/suite/galera/r/lp1376747.result
new file mode 100644
index 00000000..ec7e0bc4
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1376747.result
@@ -0,0 +1,28 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+connection node_2;
+SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
+NAME
+test/t1
+FLUSH TABLES t1 WITH READ LOCK;
+connection node_1;
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;
+INSERT INTO t1 VALUES (2,3);
+connection node_2;
+UNLOCK TABLES;
+### t1 should have column f2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `f2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * from t1;
+id f2
+1 NULL
+2 3
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/lp1438990.result b/mysql-test/suite/galera/r/lp1438990.result
new file mode 100644
index 00000000..a324121d
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp1438990.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY);
+CREATE TABLE t3 (f1 INTEGER PRIMARY KEY);
+CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CALL p1(NEW.f1);
+CREATE PROCEDURE p1 (IN x INT)
+BEGIN
+DECLARE EXIT HANDLER FOR SQLEXCEPTION
+BEGIN
+ROLLBACK TO event_logging;
+INSERT t3 VALUES (x);
+END;
+SAVEPOINT event_logging;
+INSERT INTO t2 VALUES (x);
+RELEASE SAVEPOINT event_logging;
+END|
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+DROP PROCEDURE p1;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
diff --git a/mysql-test/suite/galera/r/lp959512.result b/mysql-test/suite/galera/r/lp959512.result
new file mode 100644
index 00000000..58903000
--- /dev/null
+++ b/mysql-test/suite/galera/r/lp959512.result
@@ -0,0 +1,26 @@
+connection node_2;
+connection node_1;
+DROP TABLE IF EXISTS variable;
+Warnings:
+Note 1051 Unknown table 'test.variable'
+DROP TABLE IF EXISTS foo;
+Warnings:
+Note 1051 Unknown table 'test.foo'
+CREATE TABLE variable (
+name varchar(128) NOT NULL DEFAULT '' COMMENT 'The name of the variable.',
+value longblob NOT NULL COMMENT 'The value of the variable.',
+PRIMARY KEY (name)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Named variable/value pairs created by Drupal core or any...';
+CREATE TABLE foo (a int);
+INSERT INTO variable (name, value) VALUES ('menu_expanded', 'a:0:{}');
+START TRANSACTION;
+SELECT 1 AS expression FROM variable variable
+WHERE ( (name = 'menu_expanded') ) FOR UPDATE;
+expression
+1
+UPDATE variable SET value='a:0:{}' WHERE ( (name = 'menu_expanded') );
+COMMIT;
+INSERT INTO foo VALUES (1);
+UPDATE foo SET a = 2 WHERE a = 1;
+DROP TABLE foo;
+DROP TABLE variable;
diff --git a/mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result b/mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result
new file mode 100644
index 00000000..9750c97a
--- /dev/null
+++ b/mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result
@@ -0,0 +1,257 @@
+connection node_2;
+connection node_1;
+#
+# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
+#
+
+# On node_1
+connection node_1;
+CREATE TABLE time_zone LIKE mysql.time_zone;
+CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
+CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
+CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
+CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
+ALTER TABLE time_zone_name ENGINE=MyISAM;
+ALTER TABLE time_zone_transition_type ENGINE=MyISAM;
+SET @save_wsrep_mode=@@WSREP_MODE;
+#
+# Run on zoneinfo directory --skip-write-binlog
+#
+
+# Apply on node_1
+
+'binlog stationary as expected'
+SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
+@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN
+1 0 1 1 1 1
+SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
+FROM information_schema.global_status g
+JOIN baseline b USING (VARIABLE_NAME)
+ORDER BY g.VARIABLE_NAME;
+VARIABLE_NAME diff
+COM_ALTER_TABLE 2
+COM_BEGIN 0
+COM_INSERT 6
+COM_LOCK_TABLES 1
+COM_TRUNCATE 4
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+
+# On node_2 (not replicated)
+
+connection node_2;
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+
+# Apply on node_1
+
+connection node_1;
+SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM';
+'binlog stationary as expected'
+SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
+@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN
+1 0 1 1 1 1
+SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
+FROM information_schema.global_status g
+JOIN baseline b USING (VARIABLE_NAME)
+ORDER BY g.VARIABLE_NAME;
+VARIABLE_NAME diff
+COM_ALTER_TABLE 2
+COM_BEGIN 0
+COM_INSERT 6
+COM_LOCK_TABLES 1
+COM_TRUNCATE 4
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+
+# On node_2 (not replicated)
+
+connection node_2;
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+#
+# Run on zoneinfo directory without --skip-write-binlog
+#
+
+# Apply on node_1
+
+connection node_1;
+'binlog advanced as expected'
+SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
+@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN
+1 0 1 1 1 1
+SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
+FROM information_schema.global_status g
+JOIN baseline b USING (VARIABLE_NAME)
+ORDER BY g.VARIABLE_NAME;
+VARIABLE_NAME diff
+COM_ALTER_TABLE 2
+COM_BEGIN 0
+COM_INSERT 6
+COM_LOCK_TABLES 1
+COM_TRUNCATE 4
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+
+# On node_2 (replicated via ARIA)
+
+connection node_2;
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+TRUNCATE TABLE time_zone;
+TRUNCATE TABLE time_zone_name;
+TRUNCATE TABLE time_zone_transition;
+TRUNCATE TABLE time_zone_transition_type;
+TRUNCATE TABLE time_zone_leap_second;
+
+# Apply on node_1
+
+connection node_1;
+SET GLOBAL WSREP_MODE='';
+'binlog advanced as expected'
+SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN;
+@wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN
+1 1 1 1 1 1
+SELECT g.VARIABLE_NAME, g.VARIABLE_VALUE - b.VARIABLE_VALUE AS diff
+FROM information_schema.global_status g
+JOIN baseline b USING (VARIABLE_NAME)
+ORDER BY g.VARIABLE_NAME;
+VARIABLE_NAME diff
+COM_ALTER_TABLE 8
+COM_BEGIN 1
+COM_INSERT 6
+COM_LOCK_TABLES 0
+COM_TRUNCATE 4
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES
+WHERE
+TABLE_SCHEMA = DATABASE()
+AND TABLE_NAME LIKE 'time_zone%' ORDER BY TABLE_NAME;
+TABLE_NAME ENGINE
+time_zone Aria
+time_zone_leap_second Aria
+time_zone_name MyISAM
+time_zone_transition Aria
+time_zone_transition_type MyISAM
+
+# On node_2 (replicated via InnoDB)
+
+connection node_2;
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+connection node_1;
+SET GLOBAL WSREP_MODE=@save_wsrep_mode;
+DROP TABLE baseline;
+DROP TABLE time_zone;
+DROP TABLE time_zone_name;
+DROP TABLE time_zone_transition;
+DROP TABLE time_zone_transition_type;
+DROP TABLE time_zone_leap_second;
+#
+# End of 10.6 tests
+#
diff --git a/mysql-test/suite/galera/r/mdev-22543.result b/mysql-test/suite/galera/r/mdev-22543.result
new file mode 100644
index 00000000..9386b740
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev-22543.result
@@ -0,0 +1,19 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT);
+INSERT INTO t1 VALUES (1, 1);
+SET DEBUG_SYNC = "before_lock_tables_takes_lock SIGNAL sync_point_reached WAIT_FOR sync_point_continue";
+UPDATE t1 SET f2 = 2 WHERE f1 = 1;
+connection node_1_ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR sync_point_reached";
+connection node_2;
+connection node_1_ctrl;
+SET DEBUG_SYNC = "now SIGNAL sync_point_continue";
+connection node_1;
+SET DEBUG_SYNC = "RESET";
+connection node_2;
+connection node_1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/mdev-26175.result b/mysql-test/suite/galera/r/mdev-26175.result
new file mode 100644
index 00000000..f84244fe
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev-26175.result
@@ -0,0 +1,24 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET sql_mode="no_zero_date";
+SET GLOBAL wsrep_max_ws_rows=1;
+CREATE TABLE t2 (a INT);
+CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+CREATE TRIGGER tgr BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0);
+INSERT INTO t1 VALUES (0),(1);
+ERROR HY000: wsrep_max_ws_rows exceeded
+SELECT * FROM t1;
+a
+SELECT * FROM t2;
+a
+connection node_2;
+SELECT * FROM t1;
+a
+SELECT * FROM t2;
+a
+connection node_1;
+SET sql_mode=DEFAULT;
+SET GLOBAL wsrep_max_ws_rows=DEFAULT;
+DROP TRIGGER tgr;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/galera/r/mdev-28433.result b/mysql-test/suite/galera/r/mdev-28433.result
new file mode 100644
index 00000000..c2dde648
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev-28433.result
@@ -0,0 +1,25 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_2;
+SET @@global.wsrep_sst_donor = NULL;
+ERROR 42000: Variable 'wsrep_sst_donor' can't be set to the value of 'NULL'
+SET @@global.wsrep_cluster_address='NULL';
+SET SESSION wsrep_sync_wait=0;
+SELECT @@wsrep_sst_donor;
+@@wsrep_sst_donor
+
+SELECT @@wsrep_cluster_address;
+@@wsrep_cluster_address
+NULL
+SHOW STATUS LIKE 'wsrep_ready';
+Variable_name Value
+wsrep_ready OFF
+SHOW STATUS LIKE 'wsrep_cluster_status';
+Variable_name Value
+wsrep_cluster_status Disconnected
+call mtr.add_suppression("WSREP: .*Invalid backend URI.*");
+call mtr.add_suppression("WSREP: gcs connect failed: Invalid argument");
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/mdev-30013.result b/mysql-test/suite/galera/r/mdev-30013.result
new file mode 100644
index 00000000..86016b09
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev-30013.result
@@ -0,0 +1,17 @@
+connection node_2;
+connection node_1;
+INSTALL PLUGIN ARCHIVE SONAME 'ha_archive.so';
+CREATE TABLE t (a CHAR(1)) ENGINE=ARCHIVE;
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `a` char(1) DEFAULT NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+INSERT INTO t VALUES ('A');
+UNINSTALL SONAME 'ha_archive';
+Warnings:
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+ALTER TABLE t CHANGE COLUMN a a CHAR(2);
+INSERT INTO t (a) VALUES ('AB');
+ERROR 42000: Unknown storage engine 'ARCHIVE'
+DROP TABLE t;
diff --git a/mysql-test/suite/galera/r/mdev-31285.result b/mysql-test/suite/galera/r/mdev-31285.result
new file mode 100644
index 00000000..228f62fa
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev-31285.result
@@ -0,0 +1,23 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t ENGINE=InnoDB WITH SYSTEM VERSIONING AS SELECT 1 AS i;
+SHOW CREATE TABLE t;
+Table Create Table
+t CREATE TABLE `t` (
+ `i` int(1) NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
+SELECT * from t;
+i
+1
+DROP TABLE IF EXISTS t;
+COMMIT;
+connection node_2;
+SET SESSION wsrep_sync_wait=0;
+Killing server ...
+Starting server ...
+connection node_2;
+call mtr.add_suppression("WSREP: Event .*Write_rows_v1 apply failed:.*");
+call mtr.add_suppression("SREP: Failed to apply write set: gtid:.*");
diff --git a/mysql-test/suite/galera/r/mdev-31651.result b/mysql-test/suite/galera/r/mdev-31651.result
new file mode 100644
index 00000000..f715aa89
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev-31651.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("BINLOG_BASE64_EVENT: Could not read field.*");
+call mtr.add_suppression("BINLOG_BASE64_EVENT: Could not execute Write_rows_v1 event on table.*");
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b INT, KEY(b)) engine=innodb;
+BINLOG 'AMqaOw8BAAAAdAAAAHgAAAAAAAQANS42LjM0LTc5LjEtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXAAEGggAAAAICAgCAAAACgoKGRkAAYVx w2w=';
+BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA=';
+ERROR HY000: Got error 171 "The event was corrupt, leading to illegal data being read" from storage engine InnoDB
+SELECT * FROM t1;
+a b
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/mdev_10518.result b/mysql-test/suite/galera/r/mdev_10518.result
new file mode 100644
index 00000000..8426cd31
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev_10518.result
@@ -0,0 +1,96 @@
+connection node_2;
+connection node_1;
+# On node_1
+connection node_1;
+list of GTID variables :
+gtid_domain_id 1
+gtid_binlog_pos
+gtid_binlog_state
+gtid_current_pos
+gtid_slave_pos
+wsrep_gtid_domain_id 4294967295
+wsrep_gtid_mode 1
+# On node_2
+connection node_2;
+list of GTID variables :
+gtid_domain_id 2
+gtid_binlog_pos
+gtid_binlog_state
+gtid_current_pos
+gtid_slave_pos
+wsrep_gtid_domain_id 4294967295
+wsrep_gtid_mode 1
+# On node_1
+connection node_1;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+CREATE TABLE t2(i INT) ENGINE=MEMORY;
+INSERT INTO t1 VALUES(1);
+SELECT * FROM t1;
+i
+1
+SELECT * FROM t2;
+i
+list of GTID variables :
+gtid_domain_id 1
+gtid_binlog_pos 4294967295-1-3
+gtid_binlog_state 4294967295-1-3
+gtid_current_pos 4294967295-1-3
+gtid_slave_pos
+wsrep_gtid_domain_id 4294967295
+wsrep_gtid_mode 1
+# On node_2
+connection node_2;
+SELECT * FROM t1;
+i
+1
+list of GTID variables :
+gtid_domain_id 2
+gtid_binlog_pos 4294967295-1-3
+gtid_binlog_state 4294967295-1-3
+gtid_current_pos
+gtid_slave_pos
+wsrep_gtid_domain_id 4294967295
+wsrep_gtid_mode 1
+# On node_1
+connection node_1;
+INSERT INTO t2 VALUES(1);
+SELECT * FROM t2;
+i
+1
+list of GTID variables :
+gtid_domain_id 1
+gtid_binlog_pos 1-1-1,4294967295-1-3
+gtid_binlog_state 1-1-1,4294967295-1-3
+gtid_current_pos 1-1-1,4294967295-1-3
+gtid_slave_pos
+wsrep_gtid_domain_id 4294967295
+wsrep_gtid_mode 1
+# On node_2
+connection node_2;
+SELECT * FROM t2;
+i
+list of GTID variables :
+gtid_domain_id 2
+gtid_binlog_pos 4294967295-1-3
+gtid_binlog_state 4294967295-1-3
+gtid_current_pos
+gtid_slave_pos
+wsrep_gtid_domain_id 4294967295
+wsrep_gtid_mode 1
+# On node_1
+connection node_1;
+DROP TABLE t1, t2;
+#cleanup
+connection node_1;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_2;
+set global wsrep_on=OFF;
+reset master;
+set global wsrep_on=ON;
+connection node_2;
+CALL mtr.add_suppression("Ignoring server id for non bootstrap node");
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/mdev_18730.result b/mysql-test/suite/galera/r/mdev_18730.result
new file mode 100644
index 00000000..ff0a934b
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev_18730.result
@@ -0,0 +1,27 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY);
+connection node_1;
+SET DEBUG_SYNC = "wsrep_after_commit_order_leave SIGNAL acol_reached WAIT_FOR acol_continue";
+INSERT INTO t1 VALUES (1);
+connection ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR acol_reached";
+connection node_1_sr;
+SET SESSION wsrep_sync_wait = 0;
+SET SESSION wsrep_trx_fragment_unit = 'rows';
+SET SESSION wsrep_trx_fragment_size = 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (2);
+connection ctrl;
+SET DEBUG_SYNC = "now SIGNAL acol_continue";
+connection node_1;
+connection node_1_sr;
+ROLLBACK;
+connection ctrl;
+SET DEBUG_SYNC = "RESET";
+disconnect ctrl;
+disconnect node_1_sr;
+connection node_1;
+DROP TABLE t1;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/mdev_21025.result b/mysql-test/suite/galera/r/mdev_21025.result
new file mode 100644
index 00000000..6a8d5ac8
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev_21025.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+START TRANSACTION;
+INSERT INTO t1 (f1) VALUES (1);
+START TRANSACTION;
+INSERT IGNORE INTO t1 (f1) VALUES (1);
+Warnings:
+Warning 1062 Duplicate entry '1' for key 'PRIMARY'
+START TRANSACTION;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/mdev_21718.result b/mysql-test/suite/galera/r/mdev_21718.result
new file mode 100644
index 00000000..ce938614
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev_21718.result
@@ -0,0 +1,16 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+connection node_1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SET DEBUG_SYNC = "wsrep_before_before_command SIGNAL reached WAIT_FOR continue";
+COMMIT;
+connection node_1_ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR reached";
+connection node_2;
+INSERT INTO t1 VALUES (1);
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+DROP TABLE t1;
+SET DEBUG_SYNC = "RESET";
diff --git a/mysql-test/suite/galera/r/mdev_9290.result b/mysql-test/suite/galera/r/mdev_9290.result
new file mode 100644
index 00000000..d8fc35b0
--- /dev/null
+++ b/mysql-test/suite/galera/r/mdev_9290.result
@@ -0,0 +1,21 @@
+connection node_2;
+connection node_1;
+#
+# MDEV-9290 : InnoDB: Assertion failure in file trx0sys.cc line 353
+# InnoDB: Failing assertion: xid_seqno > trx_sys_cur_xid_seqno
+#
+connection node_1;
+CREATE TABLE t1 (i INT) ENGINE=InnoDB;
+connection node_2;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+COMMIT;
+connection node_1;
+SELECT * FROM t1;
+i
+1
+2
+DROP TABLE t1;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#110.result b/mysql-test/suite/galera/r/mysql-wsrep#110.result
new file mode 100644
index 00000000..344185f4
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#110.result
@@ -0,0 +1,43 @@
+connection node_2;
+connection node_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
+CREATE TABLE t2 (f1 INTEGER PRIMARY KEY);
+CREATE TABLE t3 (f1 INTEGER PRIMARY KEY);
+CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CALL p1(NEW.f1);
+CREATE PROCEDURE p1 (IN x INT)
+BEGIN
+DECLARE EXIT HANDLER FOR SQLEXCEPTION
+BEGIN
+ROLLBACK TO event_logging;
+INSERT t3 VALUES (x);
+END;
+SAVEPOINT event_logging;
+INSERT INTO t2 VALUES (x);
+END|
+INSERT INTO t2 VALUES (1);
+INSERT INTO t1 VALUES (1);
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t3;
+COUNT(*) = 1
+1
+connection node_2;
+SELECT COUNT(*) = 1 FROM t1;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t2;
+COUNT(*) = 1
+1
+SELECT COUNT(*) = 1 FROM t3;
+COUNT(*) = 1
+1
+connection node_1;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP PROCEDURE p1;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#198.result b/mysql-test/suite/galera/r/mysql-wsrep#198.result
new file mode 100644
index 00000000..5b569ffa
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#198.result
@@ -0,0 +1,33 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB;
+connection node_2;
+SELECT 1 FROM DUAL;
+1
+1
+LOCK TABLE t2 WRITE;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+OPTIMIZE TABLE t1,t2;;
+connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2b;
+REPAIR TABLE t1,t2;;
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+connection node_1;
+INSERT INTO t2 VALUES (1);
+connection node_2;
+UNLOCK TABLES;
+connection node_2a;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t2 optimize status OK
+connection node_2b;
+Table Op Msg_type Msg_text
+test.t1 repair note The storage engine for the table doesn't support repair
+test.t2 repair note The storage engine for the table doesn't support repair
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#201.result b/mysql-test/suite/galera/r/mysql-wsrep#201.result
new file mode 100644
index 00000000..e55c38ea
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#201.result
@@ -0,0 +1,6 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (DEFAULT);
+connection node_2;
+SET GLOBAL query_cache_size=1355776;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#237.result b/mysql-test/suite/galera/r/mysql-wsrep#237.result
new file mode 100644
index 00000000..bc348613
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#237.result
@@ -0,0 +1,20 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+connection node_1;
+SET DEBUG_SYNC = 'wsrep_before_certification WAIT_FOR continue';
+INSERT INTO t values (1);;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+connection node_2;
+FLUSH TABLES;
+connection node_1a;
+SELECT SLEEP(1);
+SLEEP(1)
+0
+SET DEBUG_SYNC= 'now SIGNAL continue';
+connection node_1;
+DROP TABLE t;
+connection node_1a;
+SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#247.result b/mysql-test/suite/galera/r/mysql-wsrep#247.result
new file mode 100644
index 00000000..704f0ba9
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#247.result
@@ -0,0 +1,14 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET GLOBAL wsrep_desync=1;
+SET wsrep_OSU_method=RSU;
+CREATE TABLE t1 (i int primary key);
+SHOW VARIABLES LIKE 'wsrep_desync';
+Variable_name Value
+wsrep_desync ON
+SET GLOBAL wsrep_desync=0;
+DROP TABLE t1;
+SHOW VARIABLES LIKE 'wsrep_desync';
+Variable_name Value
+wsrep_desync OFF
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#31.result b/mysql-test/suite/galera/r/mysql-wsrep#31.result
new file mode 100644
index 00000000..d1d2861e
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#31.result
@@ -0,0 +1,20 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES('test');
+CREATE DATABASE db;
+connection node_2;
+Shutting down server 2 ...
+Recovering server 2 ...
+Performing --wsrep-recover ...
+Restarting server ...
+Using --wsrep-start-position when starting mysqld ...
+connection node_1;
+DROP TABLE t1;
+DROP DATABASE db;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+disconnect node_2;
+disconnect node_1;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff b/mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff
new file mode 100644
index 00000000..82c20961
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff
@@ -0,0 +1,201 @@
+--- r/mysql-wsrep#33.result
++++ r/mysql-wsrep#33,debug.reject
+@@ -698,12 +698,196 @@
+ 1
+ DROP TABLE t1;
+ COMMIT;
++Performing State Transfer on a server that has been killed and restarted
++while a DDL was in progress on it
++connection node_1;
++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 VALUES (1,'node1_committed_before');
++INSERT INTO t1 VALUES (2,'node1_committed_before');
++INSERT INTO t1 VALUES (3,'node1_committed_before');
++INSERT INTO t1 VALUES (4,'node1_committed_before');
++INSERT INTO t1 VALUES (5,'node1_committed_before');
++connection node_2;
++START TRANSACTION;
++INSERT INTO t1 VALUES (6,'node2_committed_before');
++INSERT INTO t1 VALUES (7,'node2_committed_before');
++INSERT INTO t1 VALUES (8,'node2_committed_before');
++INSERT INTO t1 VALUES (9,'node2_committed_before');
++INSERT INTO t1 VALUES (10,'node2_committed_before');
++COMMIT;
++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
++connection node_1;
++ALTER TABLE t1 ADD COLUMN f2 INTEGER;
++connection node_2;
++SET wsrep_sync_wait = 0;
++Killing server ...
++connection node_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
++COMMIT;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
++connection node_2;
++Performing --wsrep-recover ...
++connection node_2;
++Starting server ...
++Using --wsrep-start-position when starting mysqld ...
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
++COMMIT;
++connection node_1;
++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
++COMMIT;
++SET AUTOCOMMIT=OFF;
++START TRANSACTION;
++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
++COMMIT;
++connection node_1a_galera_st_kill_slave_ddl;
++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
++ROLLBACK;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++COMMIT;
++connection node_1;
++SET AUTOCOMMIT=ON;
++SET SESSION wsrep_sync_wait=15;
++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
++EXPECT_3
++3
++SELECT COUNT(*) AS EXPECT_35 FROM t1;
++EXPECT_35
++35
++SELECT * FROM t1;
++id f1 f2
++1 node1_committed_before NULL
++2 node1_committed_before NULL
++3 node1_committed_before NULL
++4 node1_committed_before NULL
++5 node1_committed_before NULL
++6 node2_committed_before NULL
++7 node2_committed_before NULL
++8 node2_committed_before NULL
++9 node2_committed_before NULL
++10 node2_committed_before NULL
++11 node1_committed_during NULL
++12 node1_committed_during NULL
++13 node1_committed_during NULL
++14 node1_committed_during NULL
++15 node1_committed_during NULL
++16 node1_to_be_committed_after NULL
++17 node1_to_be_committed_after NULL
++18 node1_to_be_committed_after NULL
++19 node1_to_be_committed_after NULL
++20 node1_to_be_committed_after NULL
++26 node2_committed_after NULL
++27 node2_committed_after NULL
++28 node2_committed_after NULL
++29 node2_committed_after NULL
++30 node2_committed_after NULL
++31 node1_to_be_committed_after NULL
++32 node1_to_be_committed_after NULL
++33 node1_to_be_committed_after NULL
++34 node1_to_be_committed_after NULL
++35 node1_to_be_committed_after NULL
++36 node1_committed_after NULL
++37 node1_committed_after NULL
++38 node1_committed_after NULL
++39 node1_committed_after NULL
++40 node1_committed_after NULL
++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
++COUNT(*) = 0
++1
++DROP TABLE t1;
++COMMIT;
++SET GLOBAL debug_dbug = $debug_orig;
+ connection node_2;
+ connection node_1;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ DROP USER sst;
+ connection node_2;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+ CALL mtr.add_suppression("Can't open and lock time zone table");
+ CALL mtr.add_suppression("Can't open and lock privilege tables");
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33,release.rdiff b/mysql-test/suite/galera/r/mysql-wsrep#33,release.rdiff
new file mode 100644
index 00000000..afbfc023
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#33,release.rdiff
@@ -0,0 +1,15 @@
+--- r/mysql-wsrep#33.result
++++ r/mysql-wsrep#33.reject
+@@ -700,10 +700,10 @@
+ COMMIT;
+ connection node_2;
+ connection node_1;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ DROP USER sst;
+ connection node_2;
+-CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
++CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+ CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+ CALL mtr.add_suppression("Can't open and lock time zone table");
+ CALL mtr.add_suppression("Can't open and lock privilege tables");
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result
new file mode 100644
index 00000000..2c116347
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result
@@ -0,0 +1,714 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+Setting SST method to mysqldump ...
+call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'");
+call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
+connection node_1;
+CREATE USER 'sst';
+GRANT ALL PRIVILEGES ON *.* TO 'sst';
+SET GLOBAL wsrep_sst_auth = 'sst:';
+connection node_2;
+SET GLOBAL wsrep_sst_method = 'mysqldump';
+Performing State Transfer on a server that has been temporarily disconnected
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Unloading wsrep provider ...
+SET GLOBAL wsrep_cluster_address = '';
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Loading wsrep provider ...
+disconnect node_2;
+connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_disconnect_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been shut down cleanly and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_shutdown_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_15 FROM t1;
+EXPECT_15
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that starts from a clean var directory
+This is accomplished by shutting down node #2 and removing its var directory before restarting it
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Shutting down server ...
+connection node_1;
+Cleaning var directory ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_clean_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * from t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+Performing State Transfer on a server that has been killed and restarted
+connection node_1;
+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1,'node1_committed_before');
+INSERT INTO t1 VALUES (2,'node1_committed_before');
+INSERT INTO t1 VALUES (3,'node1_committed_before');
+INSERT INTO t1 VALUES (4,'node1_committed_before');
+INSERT INTO t1 VALUES (5,'node1_committed_before');
+COMMIT;
+connection node_2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (6,'node2_committed_before');
+INSERT INTO t1 VALUES (7,'node2_committed_before');
+INSERT INTO t1 VALUES (8,'node2_committed_before');
+INSERT INTO t1 VALUES (9,'node2_committed_before');
+INSERT INTO t1 VALUES (10,'node2_committed_before');
+COMMIT;
+Killing server ...
+connection node_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (11,'node1_committed_during');
+INSERT INTO t1 VALUES (12,'node1_committed_during');
+INSERT INTO t1 VALUES (13,'node1_committed_during');
+INSERT INTO t1 VALUES (14,'node1_committed_during');
+INSERT INTO t1 VALUES (15,'node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
+connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
+connection node_2;
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (26,'node2_committed_after');
+INSERT INTO t1 VALUES (27,'node2_committed_after');
+INSERT INTO t1 VALUES (28,'node2_committed_after');
+INSERT INTO t1 VALUES (29,'node2_committed_after');
+INSERT INTO t1 VALUES (30,'node2_committed_after');
+COMMIT;
+connection node_1;
+INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
+INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES (36,'node1_committed_after');
+INSERT INTO t1 VALUES (37,'node1_committed_after');
+INSERT INTO t1 VALUES (38,'node1_committed_after');
+INSERT INTO t1 VALUES (39,'node1_committed_after');
+INSERT INTO t1 VALUES (40,'node1_committed_after');
+COMMIT;
+connection node_1a_galera_st_kill_slave;
+INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after');
+ROLLBACK;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+connection node_1;
+SET AUTOCOMMIT=ON;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(*) AS EXPECT_35 FROM t1;
+EXPECT_35
+35
+SELECT * FROM t1;
+id f1
+1 node1_committed_before
+2 node1_committed_before
+3 node1_committed_before
+4 node1_committed_before
+5 node1_committed_before
+6 node2_committed_before
+7 node2_committed_before
+8 node2_committed_before
+9 node2_committed_before
+10 node2_committed_before
+11 node1_committed_during
+12 node1_committed_during
+13 node1_committed_during
+14 node1_committed_during
+15 node1_committed_during
+16 node1_to_be_committed_after
+17 node1_to_be_committed_after
+18 node1_to_be_committed_after
+19 node1_to_be_committed_after
+20 node1_to_be_committed_after
+26 node2_committed_after
+27 node2_committed_after
+28 node2_committed_after
+29 node2_committed_after
+30 node2_committed_after
+31 node1_to_be_committed_after
+32 node1_to_be_committed_after
+33 node1_to_be_committed_after
+34 node1_to_be_committed_after
+35 node1_to_be_committed_after
+36 node1_committed_after
+37 node1_committed_after
+38 node1_committed_after
+39 node1_committed_after
+40 node1_committed_after
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+connection node_2;
+connection node_1;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+DROP USER sst;
+connection node_2;
+CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
+CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
+CALL mtr.add_suppression("Can't open and lock time zone table");
+CALL mtr.add_suppression("Can't open and lock privilege tables");
+CALL mtr.add_suppression("Info table is not ready to be used");
+CALL mtr.add_suppression("Native table .* has the wrong structure");
+CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
+SET GLOBAL general_log = ON;
+SET GLOBAL slow_query_log = ON;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#332.result b/mysql-test/suite/galera/r/mysql-wsrep#332.result
new file mode 100644
index 00000000..565979a9
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#332.result
@@ -0,0 +1,141 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER) ENGINE=INNODB;
+INSERT INTO p VALUES (1, 0);
+INSERT INTO p VALUES (2, 0);
+INSERT INTO c VALUES (1, 1);
+INSERT INTO c VALUES (2, 2);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE p SET f1 = f1 + 100;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+ALTER TABLE c ADD FOREIGN KEY (p_id) REFERENCES p(f1);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p;
+f1 f2
+1 0
+2 0
+SELECT * FROM c;
+f1 p_id
+1 1
+2 2
+DROP TABLE c;
+DROP TABLE p;
+connection node_1;
+CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id1 INTEGER, p_id2 INTEGER) ENGINE=INNODB;
+INSERT INTO p1 VALUES (1, 0), (2, 0);
+INSERT INTO p2 VALUES (1, 0), (2, 0);
+INSERT INTO c VALUES (1, 1, 1);
+INSERT INTO c VALUES (2, 2, 2);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE p1 SET f1 = f1 + 100;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p1;
+f1 f2
+1 0
+2 0
+SELECT * FROM p2;
+f1 f2
+1 0
+2 0
+SELECT * FROM c;
+f1 p_id1 p_id2
+1 1 1
+2 2 2
+DROP TABLE c;
+DROP TABLE p1;
+DROP TABLE p2;
+connection node_1;
+CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB;
+CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id1 INTEGER, p_id2 INTEGER) ENGINE=INNODB;
+INSERT INTO p1 VALUES (1, 0), (2, 0);
+INSERT INTO p2 VALUES (1, 0), (2, 0);
+INSERT INTO c VALUES (1, 1, 1);
+INSERT INTO c VALUES (2, 2, 2);
+connection node_1;
+SET AUTOCOMMIT=ON;
+START TRANSACTION;
+UPDATE p2 SET f1 = f1 + 100;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
+connection node_2;
+ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1);
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'dbug=';
+SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync';
+connection node_1;
+COMMIT;
+connection node_1a;
+SET SESSION wsrep_on = 0;
+SET SESSION wsrep_on = 1;
+SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
+SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync';
+SET GLOBAL wsrep_provider_options = 'dbug=';
+connection node_1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+connection node_2;
+SELECT * FROM p1;
+f1 f2
+1 0
+2 0
+SELECT * FROM p2;
+f1 f2
+1 0
+2 0
+SELECT * FROM c;
+f1 p_id1 p_id2
+1 1 1
+2 2 2
+DROP TABLE c;
+DROP TABLE p1;
+DROP TABLE p2;
diff --git a/mysql-test/suite/galera/r/mysql-wsrep#90.result b/mysql-test/suite/galera/r/mysql-wsrep#90.result
new file mode 100644
index 00000000..b0fa06ff
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep#90.result
@@ -0,0 +1,46 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+connection node_1;
+SET GLOBAL wsrep_OSU_method = "RSU";
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_OSU_method = "TOI";
+SET DEBUG_SYNC= 'now SIGNAL continue';
+connection node_1;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+connection node_2;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+connection node_1;
+DROP TABLE t1;
+SET DEBUG_SYNC = 'RESET';
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
+connection node_1;
+SET GLOBAL wsrep_OSU_method = "TOI";
+SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue';
+ALTER TABLE t1 ADD COLUMN f2 INTEGER;;
+connection node_1a;
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL wsrep_OSU_method = "RSU";
+SET DEBUG_SYNC= 'now SIGNAL continue';
+connection node_1;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+INSERT INTO t1 VALUES (1,2);
+connection node_2;
+SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
+COUNT(*) = 2
+1
+INSERT INTO t1 VALUES (3,4);
+connection node_1;
+DROP TABLE t1;
+SET GLOBAL WSREP_OSU_METHOD = TOI;
+SET DEBUG_SYNC = 'RESET';
diff --git a/mysql-test/suite/galera/r/mysql-wsrep-bugs-607.result b/mysql-test/suite/galera/r/mysql-wsrep-bugs-607.result
new file mode 100644
index 00000000..9d9614ff
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql-wsrep-bugs-607.result
@@ -0,0 +1,31 @@
+connection node_2;
+connection node_1;
+#
+# test the order of wsrep XID storage after certifiation failure
+#
+connection node_1;
+set session wsrep_sync_wait=0;
+create table t1 (i int primary key, j int);
+insert into t1 values (4, 0);
+connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2b;
+set session wsrep_sync_wait=0;
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_1;
+UPDATE test.t1 set j=1 where i=4;
+connection node_2b;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_2;
+set session wsrep_sync_wait=0;
+set session wsrep_retry_autocommit=0;
+UPDATE test.t1 SET j=2 WHERE i=4;
+connection node_2b;
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+SET GLOBAL debug_dbug = "";
+SET DEBUG_SYNC = "RESET";
+connection node_2;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+select * from t1;
+i j
+4 1
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result b/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result
new file mode 100644
index 00000000..e0cee3a5
--- /dev/null
+++ b/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result
@@ -0,0 +1,154 @@
+connection node_2;
+connection node_1;
+#
+# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
+#
+
+# On node_1
+connection node_1;
+CREATE TABLE time_zone LIKE mysql.time_zone;
+CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
+CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
+CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
+CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
+#
+# Run on zoneinfo directory --skip-write-binlog
+#
+
+# Apply on node_1
+
+load timezones
+'binlog stationary as expected'
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+
+# On node_2 (not replicated)
+
+connection node_2;
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+#
+# Run on zoneinfo directory without --skip-write-binlog
+#
+
+# Apply on node_1
+
+connection node_1;
+load timezones
+'binlog advanced as expected'
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+
+# On node_2 (replicated via InnoDB)
+
+connection node_2;
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+TRUNCATE TABLE time_zone;
+TRUNCATE TABLE time_zone_name;
+TRUNCATE TABLE time_zone_transition;
+TRUNCATE TABLE time_zone_transition_type;
+TRUNCATE TABLE time_zone_leap_second;
+
+# Apply on node_1 (with wsrep_on=OFF)
+
+connection node_1;
+SET GLOBAL WSREP_ON=OFF;
+load timezones
+SET GLOBAL WSREP_ON=ON;
+'binlog advanced as expected'
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+2
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+
+# On node_2 (Should not have been replicated)
+
+connection node_2;
+SELECT COUNT(*) FROM time_zone;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_name;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_transition_type;
+COUNT(*)
+0
+SELECT COUNT(*) FROM time_zone_leap_second;
+COUNT(*)
+0
+connection node_1;
+DROP TABLE time_zone;
+DROP TABLE time_zone_name;
+DROP TABLE time_zone_transition;
+DROP TABLE time_zone_transition_type;
+DROP TABLE time_zone_leap_second;
+#
+# End of 10.2 tests
+#
diff --git a/mysql-test/suite/galera/r/partition.result b/mysql-test/suite/galera/r/partition.result
new file mode 100644
index 00000000..9d649fce
--- /dev/null
+++ b/mysql-test/suite/galera/r/partition.result
@@ -0,0 +1,167 @@
+connection node_2;
+connection node_1;
+#
+# MDEV#4953 Galera: DELETE from a partitioned table is not replicated
+#
+USE test;
+CREATE TABLE t1 (pk INT PRIMARY KEY, i INT) ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
+INSERT INTO t1 VALUES (1,100), (2,200);
+SELECT * FROM t1;
+pk i
+2 200
+1 100
+DELETE FROM t1;
+SELECT * FROM t1;
+pk i
+
+# On node_1
+connection node_1;
+SELECT * FROM t1;
+pk i
+
+# On node_2
+connection node_2;
+SELECT * FROM t1;
+pk i
+DROP TABLE t1;
+#
+# MDEV#7501 : alter table exchange partition is not replicated in
+# galera cluster
+#
+
+# On node_1
+connection node_1;
+CREATE TABLE test.t1 (
+i INT UNSIGNED NOT NULL AUTO_INCREMENT,
+PRIMARY KEY (i)
+) ENGINE=INNODB
+PARTITION BY RANGE (i)
+(PARTITION p1 VALUES LESS THAN (10) ENGINE = INNODB,
+PARTITION p2 VALUES LESS THAN (20) ENGINE = INNODB,
+PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = INNODB);
+INSERT INTO test.t1 (i) VALUE (9),(19);
+CREATE TABLE test.p1 LIKE test.t1;
+ALTER TABLE test.p1 REMOVE PARTITIONING;
+ALTER TABLE test.t1 EXCHANGE PARTITION p1 WITH TABLE test.p1;
+SELECT * FROM test.t1;
+i
+19
+SELECT * FROM test.p1;
+i
+9
+
+# On node_2
+connection node_2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`i`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = InnoDB,
+ PARTITION `p2` VALUES LESS THAN (20) ENGINE = InnoDB,
+ PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
+SHOW CREATE TABLE p1;
+Table Create Table
+p1 CREATE TABLE `p1` (
+ `i` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+SELECT * FROM test.t1;
+i
+19
+SELECT * FROM test.p1;
+i
+9
+
+# On node_1
+connection node_1;
+ALTER TABLE t1 TRUNCATE PARTITION p2;
+SELECT * FROM test.t1;
+i
+
+# On node_2
+connection node_2;
+SELECT * FROM test.t1;
+i
+
+# On node_1
+connection node_1;
+ALTER TABLE t1 DROP PARTITION p2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`i`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = InnoDB,
+ PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
+
+# On node_2
+connection node_2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`i`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+ PARTITION BY RANGE (`i`)
+(PARTITION `p1` VALUES LESS THAN (10) ENGINE = InnoDB,
+ PARTITION `pMax` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
+DROP TABLE t1, p1;
+#
+# MDEV-5146: Bulk loads into partitioned table not working
+#
+connection node_1;
+# Case 1: wsrep_load_data_splitting = ON & LOAD DATA with 20002
+# entries.
+SET GLOBAL wsrep_load_data_splitting = ON;
+Warnings:
+Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release
+CREATE TABLE t1 (pk INT PRIMARY KEY)
+ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+20002
+wsrep_last_committed_diff
+AS_EXPECTED_3_or_5
+DROP TABLE t1;
+# Case 2: wsrep_load_data_splitting = ON & LOAD DATA with 101 entries.
+connection node_1;
+SET GLOBAL wsrep_load_data_splitting = ON;
+Warnings:
+Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release
+CREATE TABLE t1 (pk INT PRIMARY KEY)
+ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+101
+wsrep_last_committed_diff
+1
+DROP TABLE t1;
+# Case 3: wsrep_load_data_splitting = OFF & LOAD DATA with 20002
+# entries.
+connection node_1;
+SET GLOBAL wsrep_load_data_splitting = OFF;
+Warnings:
+Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release
+CREATE TABLE t1 (pk INT PRIMARY KEY)
+ENGINE=INNODB PARTITION BY HASH(pk) PARTITIONS 2;
+connection node_2;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+20002
+wsrep_last_committed_diff
+AS_EXPECTED_1_or_2
+DROP TABLE t1;
+connection node_1;
+SET GLOBAL wsrep_load_data_splitting = 0;;
+Warnings:
+Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/rename.result b/mysql-test/suite/galera/r/rename.result
new file mode 100644
index 00000000..c4a70a61
--- /dev/null
+++ b/mysql-test/suite/galera/r/rename.result
@@ -0,0 +1,48 @@
+connection node_2;
+connection node_1;
+#
+# MDEV-8598 : Failed MySQL DDL commands and Galera replication
+#
+# On node 1
+connection node_1;
+USE test;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUE(1);
+SELECT * FROM t1;
+i
+1
+# Create a new user 'foo' with limited privileges
+CREATE USER foo@localhost;
+GRANT SELECT on test.* TO foo@localhost;
+# Open connection to the 1st node using 'test_user1' user.
+connect foo_node_1,localhost,foo,,test,$port_1,;
+connection foo_node_1;
+SELECT * FROM t1;
+i
+1
+# Following RENAME should not replicate to other node.
+RENAME TABLE t1 TO t2;
+ERROR 42000: DROP, ALTER command denied to user 'foo'@'localhost' for table `test`.`t1`
+# On node 2
+connection node_2;
+USE test;
+SELECT * FROM t1;
+i
+1
+# On node_1
+connection node_1;
+RENAME TABLE t1 TO t2;
+SHOW TABLES;
+Tables_in_test
+t2
+# On node 2
+connection node_2;
+USE test;
+SELECT * FROM t2;
+i
+1
+connection node_1;
+DROP USER foo@localhost;
+DROP TABLE t2;
+# End of tests
diff --git a/mysql-test/suite/galera/r/rpl_row_annotate.result b/mysql-test/suite/galera/r/rpl_row_annotate.result
new file mode 100644
index 00000000..61fa2bc2
--- /dev/null
+++ b/mysql-test/suite/galera/r/rpl_row_annotate.result
@@ -0,0 +1,77 @@
+connection node_2;
+connection node_1;
+# On node_2
+connection node_2;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+# On node_1
+connection node_1;
+SET GLOBAL wsrep_on=OFF;
+RESET MASTER;
+SET GLOBAL wsrep_on=ON;
+CREATE TABLE t1(i INT)ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+DELETE FROM t1 WHERE i = 1;
+# On node_2
+connection node_2;
+INSERT INTO t1 VALUES(2);
+DELETE FROM t1 WHERE i = 2;
+# On node_1
+connection node_1;
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM <start_pos>;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid_list 1 # []
+mysqld-bin.000001 # Binlog_checkpoint 1 # mysqld-bin.000001
+mysqld-bin.000001 # Gtid 1 # GTID 0-1-1
+mysqld-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(i INT)ENGINE=INNODB
+mysqld-bin.000001 # Gtid 1 # BEGIN GTID 0-1-2
+mysqld-bin.000001 # Annotate_rows 1 # INSERT INTO t1 VALUES(1)
+mysqld-bin.000001 # Table_map 1 # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 1 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 1 # BEGIN GTID 0-1-3
+mysqld-bin.000001 # Annotate_rows 1 # DELETE FROM t1 WHERE i = 1
+mysqld-bin.000001 # Table_map 1 # table_id: # (test.t1)
+mysqld-bin.000001 # Delete_rows_v1 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 1 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 2 # BEGIN GTID 0-2-4
+mysqld-bin.000001 # Annotate_rows 2 # INSERT INTO t1 VALUES(2)
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 2 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 2 # BEGIN GTID 0-2-5
+mysqld-bin.000001 # Annotate_rows 2 # DELETE FROM t1 WHERE i = 2
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
+mysqld-bin.000001 # Delete_rows_v1 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 2 # COMMIT /* xid= */
+# On node_2
+connection node_2;
+SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM <start_pos>;
+Log_name Pos Event_type Server_id End_log_pos Info
+mysqld-bin.000001 # Gtid_list 2 # []
+mysqld-bin.000001 # Binlog_checkpoint 2 # mysqld-bin.000001
+mysqld-bin.000001 # Gtid 1 # GTID 0-1-1
+mysqld-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(i INT)ENGINE=INNODB
+mysqld-bin.000001 # Gtid 1 # BEGIN GTID 0-1-2
+mysqld-bin.000001 # Annotate_rows 1 # INSERT INTO t1 VALUES(1)
+mysqld-bin.000001 # Table_map 1 # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 1 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 1 # BEGIN GTID 0-1-3
+mysqld-bin.000001 # Annotate_rows 1 # DELETE FROM t1 WHERE i = 1
+mysqld-bin.000001 # Table_map 1 # table_id: # (test.t1)
+mysqld-bin.000001 # Delete_rows_v1 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 1 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 2 # BEGIN GTID 0-2-4
+mysqld-bin.000001 # Annotate_rows 2 # INSERT INTO t1 VALUES(2)
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
+mysqld-bin.000001 # Write_rows_v1 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 2 # COMMIT /* xid= */
+mysqld-bin.000001 # Gtid 2 # BEGIN GTID 0-2-5
+mysqld-bin.000001 # Annotate_rows 2 # DELETE FROM t1 WHERE i = 2
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
+mysqld-bin.000001 # Delete_rows_v1 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Xid 2 # COMMIT /* xid= */
+DROP TABLE t1;
+# End of test
diff --git a/mysql-test/suite/galera/r/sql_log_bin.result b/mysql-test/suite/galera/r/sql_log_bin.result
new file mode 100644
index 00000000..6efd70ca
--- /dev/null
+++ b/mysql-test/suite/galera/r/sql_log_bin.result
@@ -0,0 +1,59 @@
+connection node_2;
+connection node_1;
+
+# On node_1
+connection node_1;
+USE test;
+CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1);
+# Disable binary logging for current session
+SET SQL_LOG_BIN=OFF;
+INSERT INTO t1 VALUES (2);
+FLUSH BINARY LOGS;
+CREATE TABLE t2(c1 INT PRIMARY KEY) ENGINE=INNODB;
+INSERT INTO t2 VALUES (1);
+CREATE TABLE test.t3 AS SELECT * from t1;
+# Enable binary logging for current session
+SET SQL_LOG_BIN=ON;
+INSERT INTO t2 VALUES (2);
+CREATE TABLE t4 AS SELECT * from t2;
+SELECT * FROM t1;
+c1
+1
+2
+SELECT * FROM t2;
+c1
+1
+2
+SELECT * FROM t3;
+c1
+1
+2
+SELECT * FROM t4;
+c1
+1
+2
+
+# On node_2
+connection node_2;
+USE test;
+SELECT * FROM t1;
+c1
+1
+2
+SELECT * FROM t2;
+c1
+1
+2
+SELECT * FROM t3;
+c1
+1
+2
+SELECT * FROM t4;
+c1
+1
+2
+DROP TABLE t1, t2, t3, t4;
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/unique_key.result b/mysql-test/suite/galera/r/unique_key.result
new file mode 100644
index 00000000..bb7e2201
--- /dev/null
+++ b/mysql-test/suite/galera/r/unique_key.result
@@ -0,0 +1,57 @@
+connection node_2;
+connection node_1;
+#
+# MDEV#5552 Deadlock when inserting NULL column value in column with
+# UNIQUE index
+#
+USE test;
+
+# On node_1
+connection node_1;
+CREATE TABLE t1(c1 INT DEFAULT NULL, UNIQUE KEY c1(c1)) ENGINE=INNODB;
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM test.t1;
+c1
+NULL
+NULL
+
+# On node_2
+connection node_2;
+SELECT * FROM test.t1;
+c1
+NULL
+NULL
+
+# On node_1
+connection node_1;
+INSERT INTO t1 VALUES (1);
+UPDATE t1 SET c1=NULL WHERE c1=1;
+SELECT * FROM test.t1;
+c1
+NULL
+NULL
+NULL
+
+# On node_2
+connection node_2;
+SELECT * FROM test.t1;
+c1
+NULL
+NULL
+NULL
+
+# On node_1
+connection node_1;
+DELETE FROM t1 WHERE c1<=>NULL;
+SELECT * FROM test.t1;
+c1
+
+# On node_2
+connection node_2;
+SELECT * FROM test.t1;
+c1
+DROP TABLE t1;
+disconnect node_2;
+disconnect node_1;
+# End of test
diff --git a/mysql-test/suite/galera/r/versioning_trx_id.result b/mysql-test/suite/galera/r/versioning_trx_id.result
new file mode 100644
index 00000000..df92d088
--- /dev/null
+++ b/mysql-test/suite/galera/r/versioning_trx_id.result
@@ -0,0 +1,57 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("Sending JOIN failed:.*");
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+create table t1 (a int, s bigint unsigned as row start, e bigint unsigned as row end, period for system_time(s,e)) engine=InnoDB with system versioning;
+insert into t1 (a) values (1),(2);
+connection node_2;
+set session wsrep_sync_wait=15;
+insert into t1 (a) values (3),(4);
+select a from t1;
+a
+1
+2
+3
+4
+select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0';
+count(*)
+0
+select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp;
+count(*)
+0
+connection node_3;
+set session wsrep_sync_wait=15;
+insert into t1 (a) values (5),(6);
+select a from t1;
+a
+1
+2
+3
+4
+5
+6
+select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0';
+count(*)
+0
+select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp;
+count(*)
+0
+connection node_1;
+set session wsrep_sync_wait=15;
+select a from t1;
+a
+1
+2
+3
+4
+5
+6
+select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0';
+count(*)
+0
+select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp;
+count(*)
+0
+drop table t1;
+disconnect node_3;
diff --git a/mysql-test/suite/galera/r/view.result b/mysql-test/suite/galera/r/view.result
new file mode 100644
index 00000000..45d5b422
--- /dev/null
+++ b/mysql-test/suite/galera/r/view.result
@@ -0,0 +1,58 @@
+connection node_2;
+connection node_1;
+#
+# MDEV-7222: Cluster Node Crash at CREATE DEFINER statement
+#
+USE test;
+CREATE DEFINER=CURRENT_USER VIEW v1 AS SELECT 1;
+DROP VIEW v1;
+#
+# MDEV-8464 : ALTER VIEW not replicated in some cases
+#
+# On node_1
+connection node_1;
+USE test;
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+CREATE DEFINER=CURRENT_USER VIEW v1 AS SELECT * FROM t1;
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t1;
+CREATE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t1;
+CREATE ALGORITHM=UNDEFINED DEFINER=CURRENT_USER VIEW v4 AS SELECT * FROM t1;
+# On node_2
+connection node_2;
+USE test;
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v4;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+# On node_1
+connection node_1;
+ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
+ALTER ALGORITHM=UNDEFINED VIEW v2 AS SELECT * FROM t1;
+ALTER DEFINER=CURRENT_USER VIEW v3 AS SELECT * FROM t1;
+ALTER ALGORITHM=TEMPTABLE DEFINER=CURRENT_USER VIEW v4 AS SELECT * FROM t1;
+# On node_2
+connection node_2;
+SHOW CREATE VIEW v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v2;
+View Create View character_set_client collation_connection
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v3;
+View Create View character_set_client collation_connection
+v3 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+SHOW CREATE VIEW v4;
+View Create View character_set_client collation_connection
+v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
+# Cleanup
+DROP VIEW v1, v2, v3, v4;
+DROP TABLE t1;
+# End of tests
diff --git a/mysql-test/suite/galera/r/wsrep_mode_strict_replication.result b/mysql-test/suite/galera/r/wsrep_mode_strict_replication.result
new file mode 100644
index 00000000..cf2ab0ee
--- /dev/null
+++ b/mysql-test/suite/galera/r/wsrep_mode_strict_replication.result
@@ -0,0 +1,194 @@
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
+connection node_1;
+SET GLOBAL binlog_format='ROW';
+create table before_t1(a int, count int, b int, key(b)) engine=Aria;
+INSERT INTO before_t1 values (1,1,1);
+SET @@global.wsrep_mode=STRICT_REPLICATION;
+select @@global.wsrep_mode;
+@@global.wsrep_mode
+STRICT_REPLICATION
+connection node_2;
+SET @@global.wsrep_mode=STRICT_REPLICATION;
+select @@global.wsrep_mode;
+@@global.wsrep_mode
+STRICT_REPLICATION
+connection node_1;
+CREATE TABLE t1(a int) engine=Aria;
+ERROR HY000: Galera replication not supported
+SHOW WARNINGS;
+Level Code Message
+Error 4165 Galera replication not supported
+Warning 1031 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria not supported.
+connection node_2;
+SHOW CREATE TABLE t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+connection node_1;
+CREATE TABLE t2(a int not null primary key) engine=InnoDB;
+ALTER TABLE t2 engine=MyISAM;
+ERROR HY000: Galera replication not supported
+SHOW WARNINGS;
+Level Code Message
+Error 4165 Galera replication not supported
+Warning 1031 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM not supported.
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_2;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
+connection node_1;
+TRUNCATE TABLE before_t1;
+ERROR HY000: Galera replication not supported
+SELECT * FROM before_t1;
+a count b
+1 1 1
+connection node_2;
+SET SESSION wsrep_sync_wait=15;
+SELECT @@wsrep_sync_wait;
+@@wsrep_sync_wait
+15
+SELECT * FROM before_t1;
+a count b
+connection node_1;
+CREATE VIEW x1 AS SELECT * FROM before_t1;
+ERROR HY000: Galera replication not supported
+SHOW CREATE VIEW x1;
+ERROR 42S02: Table 'test.x1' doesn't exist
+connection node_2;
+SHOW CREATE VIEW x1;
+ERROR 42S02: Table 'test.x1' doesn't exist
+connection node_1;
+CREATE DEFINER=`root`@`localhost` TRIGGER increment_before_t1
+AFTER INSERT ON before_t1 FOR EACH ROW
+UPDATE before_t1 SET before_t1.count = before_t1.count+1;
+ERROR HY000: Galera replication not supported
+SHOW CREATE TRIGGER increment_before_t1;
+ERROR HY000: Trigger does not exist
+connection node_2;
+SHOW CREATE TRIGGER increment_before_t1;
+ERROR HY000: Trigger does not exist
+connection node_1;
+CREATE INDEX xx2 ON before_t1(a);
+ERROR HY000: Galera replication not supported
+SHOW CREATE TABLE before_t1;
+Table Create Table
+before_t1 CREATE TABLE `before_t1` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+connection node_2;
+SHOW CREATE TABLE before_t1;
+Table Create Table
+before_t1 CREATE TABLE `before_t1` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+connection node_1;
+DROP INDEX b ON before_t1;
+ERROR HY000: Galera replication not supported
+SHOW CREATE TABLE before_t1;
+Table Create Table
+before_t1 CREATE TABLE `before_t1` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+connection node_2;
+SHOW CREATE TABLE before_t1;
+Table Create Table
+before_t1 CREATE TABLE `before_t1` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+connection node_1;
+ALTER TABLE before_t1 ADD COLUMN f int;
+ERROR HY000: Galera replication not supported
+SHOW CREATE TABLE before_t1;
+Table Create Table
+before_t1 CREATE TABLE `before_t1` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+connection node_2;
+SHOW CREATE TABLE before_t1;
+Table Create Table
+before_t1 CREATE TABLE `before_t1` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+connection node_1;
+RENAME TABLE before_t1 to after_t1;
+ERROR HY000: Galera replication not supported
+SHOW CREATE TABLE before_t1;
+Table Create Table
+before_t1 CREATE TABLE `before_t1` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+SHOW CREATE TABLE after_t1;
+ERROR 42S02: Table 'test.after_t1' doesn't exist
+connection node_2;
+SHOW CREATE TABLE before_t1;
+Table Create Table
+before_t1 CREATE TABLE `before_t1` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+SHOW CREATE TABLE after_t1;
+ERROR 42S02: Table 'test.after_t1' doesn't exist
+connection node_1;
+DROP TABLE before_t1;
+ERROR HY000: Galera replication not supported
+SHOW CREATE TABLE before_t1;
+Table Create Table
+before_t1 CREATE TABLE `before_t1` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+connection node_2;
+SHOW CREATE TABLE before_t1;
+Table Create Table
+before_t1 CREATE TABLE `before_t1` (
+ `a` int(11) DEFAULT NULL,
+ `count` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL,
+ KEY `b` (`b`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1
+connection node_1;
+set @@global.wsrep_mode=default;
+select @@global.wsrep_mode;
+@@global.wsrep_mode
+
+connection node_2;
+set @@global.wsrep_mode=default;
+select @@global.wsrep_mode;
+@@global.wsrep_mode
+
+DROP TABLE t2;
+DROP TABLE before_t1;
diff --git a/mysql-test/suite/galera/r/wsrep_slave_threads_basic.result b/mysql-test/suite/galera/r/wsrep_slave_threads_basic.result
new file mode 100644
index 00000000..edfb4747
--- /dev/null
+++ b/mysql-test/suite/galera/r/wsrep_slave_threads_basic.result
@@ -0,0 +1,51 @@
+connection node_2;
+connection node_1;
+#
+# wsrep_slave_threads
+#
+# save the initial value
+SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
+# default
+SELECT @@global.wsrep_slave_threads;
+@@global.wsrep_slave_threads
+1
+
+# scope
+SELECT @@session.wsrep_slave_threads;
+ERROR HY000: Variable 'wsrep_slave_threads' is a GLOBAL variable
+SET @@global.wsrep_slave_threads=1;
+SELECT @@global.wsrep_slave_threads;
+@@global.wsrep_slave_threads
+1
+
+# valid values
+SET @@global.wsrep_slave_threads=10;
+SELECT @@global.wsrep_slave_threads;
+@@global.wsrep_slave_threads
+10
+SET @@global.wsrep_slave_threads=0;
+Warnings:
+Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
+SELECT @@global.wsrep_slave_threads;
+@@global.wsrep_slave_threads
+1
+SET @@global.wsrep_slave_threads=default;
+SELECT @global.wsrep_slave_threads;
+@global.wsrep_slave_threads
+NULL
+
+# invalid values
+SET @@global.wsrep_slave_threads=NULL;
+ERROR 42000: Incorrect argument type to variable 'wsrep_slave_threads'
+SET @@global.wsrep_slave_threads='junk';
+ERROR 42000: Incorrect argument type to variable 'wsrep_slave_threads'
+SET @@global.wsrep_slave_threads=-1;
+Warnings:
+Warning 1292 Truncated incorrect wsrep_slave_threads value: '-1'
+SELECT @global.wsrep_slave_threads;
+@global.wsrep_slave_threads
+NULL
+
+# restore the initial value
+SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved;
+# End of test
diff --git a/mysql-test/suite/galera/r/wsrep_trx_fragment_size_sr.result b/mysql-test/suite/galera/r/wsrep_trx_fragment_size_sr.result
new file mode 100644
index 00000000..4139ecd6
--- /dev/null
+++ b/mysql-test/suite/galera/r/wsrep_trx_fragment_size_sr.result
@@ -0,0 +1,15 @@
+connection node_2;
+connection node_1;
+SELECT variable_value FROM information_schema.session_variables
+WHERE variable_name = 'wsrep_trx_fragment_size';
+variable_value
+0
+SET SESSION wsrep_trx_fragment_size = 0;
+SET SESSION wsrep_trx_fragment_size = 123;
+SELECT variable_value FROM information_schema.global_variables
+WHERE variable_name = 'wsrep_trx_fragment_size';
+variable_value
+0
+SET GLOBAL wsrep_trx_fragment_size = 0;
+SET GLOBAL wsrep_trx_fragment_size = 123;
+SET GLOBAL wsrep_trx_fragment_size = default;