1
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
1
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
3
3
This program is free software; you can redistribute it and/or modify
4
4
it under the terms of the GNU General Public License as published by
997
997
mysql_mutex_t* log_lock,
998
998
const Format_description_log_event
999
999
*description_event);
1002
Reads an event from a binlog or relay log. Used by the dump thread
1003
this method reads the event into a raw buffer without parsing it.
1005
@Note If mutex is 0, the read will proceed without mutex.
1007
@Note If a log name is given than the method will check if the
1008
given binlog is still active.
1010
@param[in] file log file to be read
1011
@param[out] packet packet to hold the event
1012
@param[in] lock the lock to be used upon read
1013
@param[in] log_file_name_arg the log's file name
1014
@param[out] is_binlog_active is the current log still active
1017
@retval LOG_READ_EOF end of file, nothing was read
1018
@retval LOG_READ_BOGUS malformed event
1019
@retval LOG_READ_IO io error while reading
1020
@retval LOG_READ_MEM packet memory allocation failed
1021
@retval LOG_READ_TRUNC only a partial event could be read
1022
@retval LOG_READ_TOO_LARGE event too large
1000
1024
static int read_log_event(IO_CACHE* file, String* packet,
1001
mysql_mutex_t* log_lock);
1025
mysql_mutex_t* log_lock,
1026
const char *log_file_name_arg= NULL,
1027
bool* is_binlog_active= NULL);
1003
1029
init_show_field_list() prepares the column names and types for the
1004
1030
output of SHOW BINLOG EVENTS; it is used only by SHOW BINLOG
1021
1047
return thd ? thd->db : 0;
1024
Log_event() : temp_buf(0) {}
1050
Log_event() : temp_buf(0), flags(0) {}
1025
1051
/* avoid having to link mysqlbinlog against libpthread */
1026
1052
static Log_event* read_log_event(IO_CACHE* file,
1027
1053
const Format_description_log_event
2320
2346
#ifdef MYSQL_SERVER
2321
2347
bool write(IO_CACHE* file);
2323
bool is_valid() const
2349
bool header_is_valid() const
2325
2351
return ((common_header_len >= ((binlog_version==1) ? OLD_HEADER_LEN :
2326
2352
LOG_EVENT_MINIMAL_HEADER_LEN)) &&
2327
2353
(post_header_len != NULL));
2356
bool version_is_valid() const
2358
/* It is invalid only when all version numbers are 0 */
2359
return !(server_version_split[0] == 0 &&
2360
server_version_split[1] == 0 &&
2361
server_version_split[2] == 0);
2364
bool is_valid() const
2366
return header_is_valid() && version_is_valid();
2329
2369
int get_data_size()