MCPcopy Create free account
hub / github.com/MariaDB/server / send_format_descriptor_event

Function send_format_descriptor_event

sql/sql_repl.cc:2773–3008  ·  view source on GitHub ↗

* send format descriptor event for one binlog file */

Source from the content-addressed store, hash-verified

2771 * send format descriptor event for one binlog file
2772 */
2773static int send_format_descriptor_event(binlog_send_info *info, IO_CACHE *log,
2774 LOG_INFO *linfo, my_off_t start_pos)
2775{
2776 int error;
2777 ulong ev_offset;
2778 THD *thd= info->thd;
2779 String *packet= info->packet;
2780 Log_event_type event_type;
2781 bool initial_log_pos= info->clear_initial_log_pos;
2782 DBUG_ENTER("send_format_descriptor_event");
2783
2784 /**
2785 * 1) reset fdev before each log-file
2786 * 2) read first event, should be the format descriptor
2787 * 3) read second event, *might* be start encryption event
2788 * if it's isn't, seek back to undo this read
2789 */
2790 if (info->fdev != NULL)
2791 delete info->fdev;
2792
2793 if (!(info->fdev= new Format_description_log_event(4)))
2794 {
2795 info->errmsg= "Out of memory initializing format_description event";
2796 info->error= ER_MASTER_FATAL_ERROR_READING_BINLOG;
2797 DBUG_RETURN(1);
2798 }
2799
2800 /* reset transmit packet for the event read from binary log file */
2801 if (reset_transmit_packet(info, info->flags, &ev_offset, &info->errmsg))
2802 DBUG_RETURN(1);
2803
2804 /*
2805 Try to find a Format_description_log_event at the beginning of
2806 the binlog
2807 */
2808 info->last_pos= my_b_tell(log);
2809 error= Log_event::read_log_event(log, packet, info->fdev,
2810 opt_master_verify_checksum
2811 ? info->current_checksum_alg
2812 : BINLOG_CHECKSUM_ALG_OFF);
2813 linfo->pos= my_b_tell(log);
2814
2815 if (unlikely(error))
2816 {
2817 set_read_error(info, error);
2818 DBUG_RETURN(1);
2819 }
2820
2821 event_type= static_cast<Log_event_type>(
2822 static_cast<unsigned char>((*packet)[ev_offset + EVENT_TYPE_OFFSET])
2823 );
2824
2825 /*
2826 The packet has offsets equal to the normal offsets in a
2827 binlog event + ev_offset (the first ev_offset characters are
2828 the header (default \0)).
2829 */
2830 DBUG_PRINT("info",

Callers 1

mysql_binlog_sendFunction · 0.85

Calls 14

reset_transmit_packetFunction · 0.85
my_b_tellFunction · 0.85
set_read_errorFunction · 0.85
get_checksum_algFunction · 0.85
is_slave_checksum_awareFunction · 0.85
int4storeFunction · 0.85
fix_checksumFunction · 0.85
my_net_writeFunction · 0.85
my_b_seekFunction · 0.85
is_pos_reachedMethod · 0.80
start_decryptionMethod · 0.80
sql_print_warningFunction · 0.70

Tested by

no test coverage detected