| 2575 | } |
| 2576 | |
| 2577 | static int init_binlog_sender(binlog_send_info *info, |
| 2578 | LOG_INFO *linfo, |
| 2579 | const char *log_ident, |
| 2580 | my_off_t *pos) |
| 2581 | { |
| 2582 | THD *thd= info->thd; |
| 2583 | int error; |
| 2584 | char str_buf[128]; |
| 2585 | String connect_gtid_state(str_buf, sizeof(str_buf), system_charset_info); |
| 2586 | char str_buf2[128]; |
| 2587 | String slave_until_gtid_str(str_buf2, sizeof(str_buf2), system_charset_info); |
| 2588 | connect_gtid_state.length(0); |
| 2589 | |
| 2590 | if (opt_binlog_engine_hton && |
| 2591 | !(info->engine_binlog_reader= |
| 2592 | (*opt_binlog_engine_hton->get_binlog_reader)(true))) |
| 2593 | { |
| 2594 | LEX_CSTRING *engine_name= hton_name(opt_binlog_engine_hton); |
| 2595 | my_error(ER_CANNOT_INIT_ENGINE_BINLOG_READER, MYF(0), engine_name->str); |
| 2596 | info->errmsg= "Error while initializing engine binlog reader"; |
| 2597 | info->error= ER_CANNOT_INIT_ENGINE_BINLOG_READER; |
| 2598 | return 1; |
| 2599 | } |
| 2600 | |
| 2601 | /** save start file/pos that was requested by slave */ |
| 2602 | strmake(info->start_log_file_name, log_ident, |
| 2603 | sizeof(info->start_log_file_name)); |
| 2604 | info->start_pos= *pos; |
| 2605 | |
| 2606 | /** init last pos */ |
| 2607 | info->last_pos= *pos; |
| 2608 | |
| 2609 | info->current_checksum_alg= get_binlog_checksum_value_at_connect(thd); |
| 2610 | info->mariadb_slave_capability= get_mariadb_slave_capability(thd); |
| 2611 | info->using_gtid_state= get_slave_connect_state(thd, &connect_gtid_state); |
| 2612 | DBUG_EXECUTE_IF("simulate_non_gtid_aware_master", |
| 2613 | info->using_gtid_state= false;); |
| 2614 | |
| 2615 | if (info->using_gtid_state) |
| 2616 | { |
| 2617 | info->slave_gtid_strict_mode= get_slave_gtid_strict_mode(thd); |
| 2618 | info->slave_gtid_ignore_duplicates= get_slave_gtid_ignore_duplicates(thd); |
| 2619 | if (get_slave_until_gtid(thd, &slave_until_gtid_str)) |
| 2620 | { |
| 2621 | info->until_gtid_state= &info->until_gtid_state_obj; |
| 2622 | info->is_until_before_gtids= get_slave_gtid_until_before_gtids(thd); |
| 2623 | } |
| 2624 | } |
| 2625 | else if (opt_binlog_engine_hton) |
| 2626 | { |
| 2627 | my_error(ER_ENGINE_BINLOG_REQUIRES_GTID, MYF(0)); |
| 2628 | info->errmsg= |
| 2629 | "Slave must enable GTID mode when master uses --binlog-storage-engine"; |
| 2630 | info->error= ER_ENGINE_BINLOG_REQUIRES_GTID; |
| 2631 | return 1; |
| 2632 | } |
| 2633 | |
| 2634 | DBUG_EXECUTE_IF("binlog_force_reconnect_after_22_events", |
no test coverage detected