summaryrefslogtreecommitdiff
path: root/sql/log_event.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/log_event.h')
-rw-r--r--sql/log_event.h344
1 files changed, 202 insertions, 142 deletions
diff --git a/sql/log_event.h b/sql/log_event.h
index 4e43822cb38..0c66d1b190f 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -13,6 +13,15 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+/**
+ @addtogroup Replication
+ @{
+
+ @file
+
+ Binary log event definitions.
+*/
+
#ifndef _log_event_h
#define _log_event_h
@@ -23,6 +32,10 @@
#include <my_bitmap.h>
#include "rpl_constants.h"
+#ifndef MYSQL_CLIENT
+#include "rpl_record.h"
+#include "rpl_reporting.h"
+#endif
#define LOG_READ_EOF -1
#define LOG_READ_BOGUS -2
@@ -57,8 +70,8 @@
which increments every time we write an event to the binlog) (3 bytes).
Q: how do we handle when the counter is overflowed and restarts from 0 ?
- - Query and Load (Create or Execute) events may have a more precise timestamp
- (with microseconds), number of matched/affected/warnings rows
+ - Query and Load (Create or Execute) events may have a more precise
+ timestamp (with microseconds), number of matched/affected/warnings rows
and fields of session variables: SQL_MODE,
FOREIGN_KEY_CHECKS, UNIQUE_CHECKS, SQL_AUTO_IS_NULL, the collations and
charsets, the PASSWORD() version (old/new/...).
@@ -520,9 +533,7 @@ class THD;
#endif
class Format_description_log_event;
-
-struct st_relay_log_info;
-typedef st_relay_log_info RELAY_LOG_INFO;
+class Relay_log_info;
#ifdef MYSQL_CLIENT
/*
@@ -708,7 +719,8 @@ public:
*/
static Log_event* read_log_event(IO_CACHE* file,
pthread_mutex_t* log_lock,
- const Format_description_log_event *description_event);
+ const Format_description_log_event
+ *description_event);
static int read_log_event(IO_CACHE* file, String* packet,
pthread_mutex_t* log_lock);
/*
@@ -736,7 +748,8 @@ public:
Log_event() : temp_buf(0) {}
/* avoid having to link mysqlbinlog against libpthread */
static Log_event* read_log_event(IO_CACHE* file,
- const Format_description_log_event *description_event);
+ const Format_description_log_event
+ *description_event);
/* print*() functions are used by mysqlbinlog */
virtual void print(FILE* file, PRINT_EVENT_INFO* print_event_info) = 0;
void print_timestamp(IO_CACHE* file, time_t *ts = 0);
@@ -753,7 +766,7 @@ public:
static void operator delete(void *ptr, size_t size)
{
- my_free((gptr) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR));
}
/* Placement version of the above operators */
@@ -772,12 +785,24 @@ public:
{ return 0; }
virtual bool write_data_body(IO_CACHE* file __attribute__((unused)))
{ return 0; }
+ inline time_t get_time()
+ {
+ THD *tmp_thd;
+ if (when)
+ return when;
+ if (thd)
+ return thd->start_time;
+ if ((tmp_thd= current_thd))
+ return tmp_thd->start_time;
+ return my_time(0);
+ }
#endif
virtual Log_event_type get_type_code() = 0;
virtual bool is_valid() const = 0;
virtual bool is_artificial_event() { return 0; }
inline bool get_cache_stmt() const { return cache_stmt; }
- Log_event(const char* buf, const Format_description_log_event* description_event);
+ Log_event(const char* buf, const Format_description_log_event
+ *description_event);
virtual ~Log_event() { free_temp_buf();}
void register_temp_buf(char* buf) { temp_buf = buf; }
void free_temp_buf()
@@ -800,6 +825,8 @@ public:
/* returns the human readable name of the event's type */
const char* get_type_str();
+ /* Return start of query time or current time */
+
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
public:
@@ -811,7 +838,8 @@ public:
@see do_apply_event
*/
- int apply_event(RELAY_LOG_INFO const *rli) {
+ int apply_event(Relay_log_info const *rli)
+ {
return do_apply_event(rli);
}
@@ -824,7 +852,7 @@ public:
@see do_update_pos
*/
- int update_pos(RELAY_LOG_INFO *rli)
+ int update_pos(Relay_log_info *rli)
{
return do_update_pos(rli);
}
@@ -835,7 +863,7 @@ public:
@see do_shall_skip
*/
- enum_skip_reason shall_skip(RELAY_LOG_INFO *rli)
+ enum_skip_reason shall_skip(Relay_log_info *rli)
{
return do_shall_skip(rli);
}
@@ -857,7 +885,7 @@ protected:
@retval 0 Event applied successfully
@retval errno Error code if event application failed
*/
- virtual int do_apply_event(RELAY_LOG_INFO const *rli)
+ virtual int do_apply_event(Relay_log_info const *rli)
{
return 0; /* Default implementation does nothing */
}
@@ -886,7 +914,7 @@ protected:
1). Observe that handler errors are returned by the
do_apply_event() function, and not by this one.
*/
- virtual int do_update_pos(RELAY_LOG_INFO *rli);
+ virtual int do_update_pos(Relay_log_info *rli);
/**
@@ -918,8 +946,7 @@ protected:
The event shall be skipped because the slave skip counter was
non-zero. The caller shall decrease the counter by one.
*/
- virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli);
-
+ virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
};
@@ -1023,7 +1050,8 @@ public:
#ifndef MYSQL_CLIENT
Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
- bool using_trans, bool suppress_use);
+ bool using_trans, bool suppress_use,
+ THD::killed_state killed_err_arg= THD::KILLED_NO_VALUE);
const char* get_db() { return db; }
#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
@@ -1040,7 +1068,7 @@ public:
~Query_log_event()
{
if (data_buf)
- my_free((gptr) data_buf, MYF(0));
+ my_free((uchar*) data_buf, MYF(0));
}
Log_event_type get_type_code() { return QUERY_EVENT; }
#ifndef MYSQL_CLIENT
@@ -1058,10 +1086,10 @@ public:
public: /* !!! Public in this patch to allow old usage */
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
- virtual int do_update_pos(RELAY_LOG_INFO *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
+ virtual int do_update_pos(Relay_log_info *rli);
- int do_apply_event(RELAY_LOG_INFO const *rli,
+ int do_apply_event(Relay_log_info const *rli,
const char *query_arg,
uint32 q_len_arg);
#endif /* HAVE_REPLICATION */
@@ -1113,7 +1141,7 @@ public:
uint16 master_port;
#ifndef MYSQL_CLIENT
- Slave_log_event(THD* thd_arg, RELAY_LOG_INFO* rli);
+ Slave_log_event(THD* thd_arg, Relay_log_info* rli);
void pack_info(Protocol* protocol);
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
@@ -1130,7 +1158,7 @@ public:
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const* rli);
+ virtual int do_apply_event(Relay_log_info const* rli);
#endif
};
@@ -1150,7 +1178,8 @@ private:
char **fn_start, char **fn_end);
protected:
int copy_log_event(const char *buf, ulong event_len,
- int body_offset, const Format_description_log_event* description_event);
+ int body_offset,
+ const Format_description_log_event* description_event);
public:
ulong thread_id;
@@ -1235,12 +1264,12 @@ public:
public: /* !!! Public in this patch to allow old usage */
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const* rli)
+ virtual int do_apply_event(Relay_log_info const* rli)
{
return do_apply_event(thd->slave_net,rli,0);
}
- int do_apply_event(NET *net, RELAY_LOG_INFO const *rli,
+ int do_apply_event(NET *net, Relay_log_info const *rli,
bool use_rli_only_for_errors);
#endif
};
@@ -1295,6 +1324,11 @@ public:
setting log_event == 0 (for now).
*/
bool artificial_event;
+ /*
+ We set this to 1 if we don't want to have the created time in the log,
+ which is the case when we rollover to a new log.
+ */
+ bool dont_set_created;
#ifndef MYSQL_CLIENT
Start_log_event_v3();
@@ -1322,8 +1356,8 @@ public:
protected:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
- virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO*)
+ virtual int do_apply_event(Relay_log_info const *rli);
+ virtual enum_skip_reason do_shall_skip(Relay_log_info*)
{
/*
Events from ourself should be skipped, but they should not
@@ -1361,8 +1395,9 @@ public:
Format_description_log_event(uint8 binlog_ver, const char* server_ver=0);
Format_description_log_event(const char* buf, uint event_len,
- const Format_description_log_event* description_event);
- ~Format_description_log_event() { my_free((gptr)post_header_len, MYF(0)); }
+ const Format_description_log_event
+ *description_event);
+ ~Format_description_log_event() { my_free((uchar*)post_header_len, MYF(0)); }
Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;}
#ifndef MYSQL_CLIENT
bool write(IO_CACHE* file);
@@ -1387,9 +1422,9 @@ public:
protected:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
- virtual int do_update_pos(RELAY_LOG_INFO *rli);
- virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
+ virtual int do_update_pos(Relay_log_info *rli);
+ virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
};
@@ -1419,7 +1454,8 @@ public:
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
#endif
- Intvar_log_event(const char* buf, const Format_description_log_event* description_event);
+ Intvar_log_event(const char* buf,
+ const Format_description_log_event *description_event);
~Intvar_log_event() {}
Log_event_type get_type_code() { return INTVAR_EVENT;}
const char* get_var_type_name();
@@ -1431,9 +1467,9 @@ public:
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
- virtual int do_update_pos(RELAY_LOG_INFO *rli);
- virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
+ virtual int do_update_pos(Relay_log_info *rli);
+ virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
};
@@ -1466,7 +1502,8 @@ class Rand_log_event: public Log_event
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
#endif
- Rand_log_event(const char* buf, const Format_description_log_event* description_event);
+ Rand_log_event(const char* buf,
+ const Format_description_log_event *description_event);
~Rand_log_event() {}
Log_event_type get_type_code() { return RAND_EVENT;}
int get_data_size() { return 16; /* sizeof(ulonglong) * 2*/ }
@@ -1477,9 +1514,9 @@ class Rand_log_event: public Log_event
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
- virtual int do_update_pos(RELAY_LOG_INFO *rli);
- virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
+ virtual int do_update_pos(Relay_log_info *rli);
+ virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
};
@@ -1509,7 +1546,8 @@ class Xid_log_event: public Log_event
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
#endif
- Xid_log_event(const char* buf, const Format_description_log_event* description_event);
+ Xid_log_event(const char* buf,
+ const Format_description_log_event *description_event);
~Xid_log_event() {}
Log_event_type get_type_code() { return XID_EVENT;}
int get_data_size() { return sizeof(xid); }
@@ -1520,7 +1558,7 @@ class Xid_log_event: public Log_event
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
#endif
};
@@ -1555,7 +1593,8 @@ public:
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
#endif
- User_var_log_event(const char* buf, const Format_description_log_event* description_event);
+ User_var_log_event(const char* buf,
+ const Format_description_log_event *description_event);
~User_var_log_event() {}
Log_event_type get_type_code() { return USER_VAR_EVENT;}
#ifndef MYSQL_CLIENT
@@ -1565,9 +1604,9 @@ public:
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
- virtual int do_update_pos(RELAY_LOG_INFO *rli);
- virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
+ virtual int do_update_pos(Relay_log_info *rli);
+ virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
};
@@ -1587,7 +1626,8 @@ public:
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
#endif
- Stop_log_event(const char* buf, const Format_description_log_event* description_event):
+ Stop_log_event(const char* buf,
+ const Format_description_log_event *description_event):
Log_event(buf, description_event)
{}
~Stop_log_event() {}
@@ -1596,8 +1636,8 @@ public:
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_update_pos(RELAY_LOG_INFO *rli);
- virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli)
+ virtual int do_update_pos(Relay_log_info *rli);
+ virtual enum_skip_reason do_shall_skip(Relay_log_info *rli)
{
/*
Events from ourself should be skipped, but they should not
@@ -1645,7 +1685,7 @@ public:
~Rotate_log_event()
{
if (flags & DUP_NAME)
- my_free((gptr) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((uchar*) new_log_ident, MYF(MY_ALLOW_ZERO_PTR));
}
Log_event_type get_type_code() { return ROTATE_EVENT;}
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
@@ -1656,8 +1696,8 @@ public:
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_update_pos(RELAY_LOG_INFO *rli);
- virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli);
+ virtual int do_update_pos(Relay_log_info *rli);
+ virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
};
@@ -1696,7 +1736,8 @@ public:
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
- void print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool enable_local);
+ void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
+ bool enable_local);
#endif
Create_file_log_event(const char* buf, uint event_len,
@@ -1729,7 +1770,7 @@ public:
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
#endif
};
@@ -1771,7 +1812,8 @@ public:
#endif
Append_block_log_event(const char* buf, uint event_len,
- const Format_description_log_event* description_event);
+ const Format_description_log_event
+ *description_event);
~Append_block_log_event() {}
Log_event_type get_type_code() { return APPEND_BLOCK_EVENT;}
int get_data_size() { return block_len + APPEND_BLOCK_HEADER_LEN ;}
@@ -1783,7 +1825,7 @@ public:
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
#endif
};
@@ -1807,7 +1849,8 @@ public:
#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
- void print(FILE* file, PRINT_EVENT_INFO* print_event_info, bool enable_local);
+ void print(FILE* file, PRINT_EVENT_INFO* print_event_info,
+ bool enable_local);
#endif
Delete_file_log_event(const char* buf, uint event_len,
@@ -1823,7 +1866,7 @@ public:
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
#endif
};
@@ -1850,7 +1893,8 @@ public:
#endif
Execute_load_log_event(const char* buf, uint event_len,
- const Format_description_log_event* description_event);
+ const Format_description_log_event
+ *description_event);
~Execute_load_log_event() {}
Log_event_type get_type_code() { return EXEC_LOAD_EVENT;}
int get_data_size() { return EXEC_LOAD_HEADER_LEN ;}
@@ -1862,7 +1906,7 @@ public:
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
#endif
};
@@ -1889,7 +1933,8 @@ public:
#endif /* HAVE_REPLICATION */
#endif
Begin_load_query_log_event(const char* buf, uint event_len,
- const Format_description_log_event* description_event);
+ const Format_description_log_event
+ *description_event);
~Begin_load_query_log_event() {}
Log_event_type get_type_code() { return BEGIN_LOAD_QUERY_EVENT; }
};
@@ -1941,7 +1986,8 @@ public:
const char *local_fname);
#endif
Execute_load_query_log_event(const char* buf, uint event_len,
- const Format_description_log_event *description_event);
+ const Format_description_log_event
+ *description_event);
~Execute_load_query_log_event() {}
Log_event_type get_type_code() { return EXECUTE_LOAD_QUERY_EVENT; }
@@ -1954,7 +2000,7 @@ public:
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
#endif
};
@@ -1968,7 +2014,8 @@ public:
Log_event's ctor, this way we can extract maximum information from the
event's header (the unique ID for example).
*/
- Unknown_log_event(const char* buf, const Format_description_log_event* description_event):
+ Unknown_log_event(const char* buf,
+ const Format_description_log_event *description_event):
Log_event(buf, description_event)
{}
~Unknown_log_event() {}
@@ -2048,6 +2095,7 @@ public:
virtual int get_data_size() { return m_data_size; }
#ifndef MYSQL_CLIENT
+ virtual int save_field_metadata();
virtual bool write_data_header(IO_CACHE *file);
virtual bool write_data_body(IO_CACHE *file);
virtual const char *get_db() { return m_dbnam; }
@@ -2064,25 +2112,34 @@ public:
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
- virtual int do_update_pos(RELAY_LOG_INFO *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
+ virtual int do_update_pos(Relay_log_info *rli);
+ virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
#endif
#ifndef MYSQL_CLIENT
- TABLE *m_table;
+ TABLE *m_table;
#endif
char const *m_dbnam;
- my_size_t m_dblen;
+ size_t m_dblen;
char const *m_tblnam;
- my_size_t m_tbllen;
+ size_t m_tbllen;
ulong m_colcnt;
- unsigned char *m_coltype;
+ uchar *m_coltype;
- gptr m_memory;
+ uchar *m_memory;
ulong m_table_id;
flag_set m_flags;
- my_size_t m_data_size;
+ size_t m_data_size;
+
+ uchar *m_field_metadata; // buffer for field metadata
+ /*
+ The size of field metadata buffer set by calling save_field_metadata()
+ */
+ ulong m_field_metadata_size;
+ uchar *m_null_bits;
+ uchar *m_meta_memory;
};
@@ -2133,7 +2190,13 @@ public:
NO_FOREIGN_KEY_CHECKS_F = (1U << 1),
/* Value of the OPTION_RELAXED_UNIQUE_CHECKS flag in thd->options */
- RELAXED_UNIQUE_CHECKS_F = (1U << 2)
+ RELAXED_UNIQUE_CHECKS_F = (1U << 2),
+
+ /**
+ Indicates that rows in this event are complete, that is contain
+ values for all columns of the table.
+ */
+ COMPLETE_ROWS_F = (1U << 3)
};
typedef uint16 flag_set;
@@ -2160,7 +2223,7 @@ public:
#endif
#ifndef MYSQL_CLIENT
- int add_row_data(byte *data, my_size_t length)
+ int add_row_data(uchar *data, size_t length)
{
return do_add_row_data(data,length);
}
@@ -2170,7 +2233,7 @@ public:
virtual int get_data_size();
MY_BITMAP const *get_cols() const { return &m_cols; }
- my_size_t get_width() const { return m_width; }
+ size_t get_width() const { return m_width; }
ulong get_table_id() const { return m_table_id; }
#ifndef MYSQL_CLIENT
@@ -2209,7 +2272,7 @@ protected:
#endif
#ifndef MYSQL_CLIENT
- virtual int do_add_row_data(byte *data, my_size_t length);
+ virtual int do_add_row_data(uchar *data, size_t length);
#endif
#ifndef MYSQL_CLIENT
@@ -2233,17 +2296,37 @@ protected:
uint32 m_bitbuf[128/(sizeof(uint32)*8)];
uint32 m_bitbuf_ai[128/(sizeof(uint32)*8)];
- byte *m_rows_buf; /* The rows in packed format */
- byte *m_rows_cur; /* One-after the end of the data */
- byte *m_rows_end; /* One-after the end of the allocated space */
+ uchar *m_rows_buf; /* The rows in packed format */
+ uchar *m_rows_cur; /* One-after the end of the data */
+ uchar *m_rows_end; /* One-after the end of the allocated space */
- flag_set m_flags; /* Flags for row-level events */
+ flag_set m_flags; /* Flags for row-level events */
+
+ /* helper functions */
+
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+ const uchar *m_curr_row; /* Start of the row being processed */
+ const uchar *m_curr_row_end; /* One-after the end of the current row */
+ uchar *m_key; /* Buffer to keep key value during searches */
+
+ int find_row(const Relay_log_info *const);
+ int write_row(const Relay_log_info *const, const bool);
+
+ // Unpack the current row into m_table->record[0]
+ int unpack_current_row(const Relay_log_info *const rli)
+ {
+ DBUG_ASSERT(m_table);
+ return ::unpack_row(rli, m_table, m_width, m_curr_row, &m_cols,
+ &m_curr_row_end, &m_master_reclength);
+ }
+#endif
private:
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
- virtual int do_update_pos(RELAY_LOG_INFO *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
+ virtual int do_update_pos(Relay_log_info *rli);
+ virtual enum_skip_reason do_shall_skip(Relay_log_info *rli);
/*
Primitive to prepare for a sequence of row executions.
@@ -2261,7 +2344,8 @@ private:
The member function will return 0 if all went OK, or a non-zero
error code otherwise.
*/
- virtual int do_before_row_operations(TABLE *table) = 0;
+ virtual
+ int do_before_row_operations(const Slave_reporting_capability *const log) = 0;
/*
Primitive to clean up after a sequence of row executions.
@@ -2271,44 +2355,33 @@ private:
After doing a sequence of do_prepare_row() and do_exec_row(),
this member function should be called to clean up and release
any allocated buffers.
+
+ The error argument, if non-zero, indicates an error which happened during
+ row processing before this function was called. In this case, even if
+ function is successful, it should return the error code given in the argument.
*/
- virtual int do_after_row_operations(TABLE *table, int error) = 0;
-
- /*
- Primitive to prepare for handling one row in a row-level event.
-
- DESCRIPTION
-
- The member function prepares for execution of operations needed for one
- row in a row-level event by reading up data from the buffer containing
- the row. No specific interpretation of the data is normally done here,
- since SQL thread specific data is not available: that data is made
- available for the do_exec function.
-
- A pointer to the start of the next row, or NULL if the preparation
- failed. Currently, preparation cannot fail, but don't rely on this
- behavior.
-
- RETURN VALUE
- Error code, if something went wrong, 0 otherwise.
- */
- virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*,
- char const *row_start, char const **row_end) = 0;
+ virtual
+ int do_after_row_operations(const Slave_reporting_capability *const log,
+ int error) = 0;
/*
Primitive to do the actual execution necessary for a row.
DESCRIPTION
The member function will do the actual execution needed to handle a row.
+ The row is located at m_curr_row. When the function returns,
+ m_curr_row_end should point at the next row (one byte after the end
+ of the current row).
RETURN VALUE
0 if execution succeeded, 1 if execution failed.
*/
- virtual int do_exec_row(TABLE *table) = 0;
+ virtual int do_exec_row(const Relay_log_info *const rli) = 0;
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
-};
+ friend class Old_rows_log_event;
+};
/*****************************************************************************
@@ -2341,9 +2414,9 @@ public:
bool is_transactional,
MY_BITMAP *cols,
uint fields,
- const byte *before_record
+ const uchar *before_record
__attribute__((unused)),
- const byte *after_record)
+ const uchar *after_record)
{
return thd->binlog_write_row(table, is_transactional,
cols, fields, after_record);
@@ -2358,14 +2431,9 @@ private:
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- gptr m_memory;
- byte *m_after_image;
-
- virtual int do_before_row_operations(TABLE *table);
- virtual int do_after_row_operations(TABLE *table, int error);
- virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*,
- char const *row_start, char const **row_end);
- virtual int do_exec_row(TABLE *table);
+ virtual int do_before_row_operations(const Slave_reporting_capability *const);
+ virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
+ virtual int do_exec_row(const Relay_log_info *const);
#endif
};
@@ -2416,8 +2484,8 @@ public:
bool is_transactional,
MY_BITMAP *cols,
uint fields,
- const byte *before_record,
- const byte *after_record)
+ const uchar *before_record,
+ const uchar *after_record)
{
return thd->binlog_update_row(table, is_transactional,
cols, fields, before_record, after_record);
@@ -2437,15 +2505,9 @@ protected:
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- gptr m_memory;
- byte *m_key;
- byte *m_after_image;
-
- virtual int do_before_row_operations(TABLE *table);
- virtual int do_after_row_operations(TABLE *table, int error);
- virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*,
- char const *row_start, char const **row_end);
- virtual int do_exec_row(TABLE *table);
+ virtual int do_before_row_operations(const Slave_reporting_capability *const);
+ virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
+ virtual int do_exec_row(const Relay_log_info *const);
#endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */
};
@@ -2491,8 +2553,8 @@ public:
bool is_transactional,
MY_BITMAP *cols,
uint fields,
- const byte *before_record,
- const byte *after_record
+ const uchar *before_record,
+ const uchar *after_record
__attribute__((unused)))
{
return thd->binlog_delete_row(table, is_transactional,
@@ -2508,15 +2570,9 @@ protected:
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- gptr m_memory;
- byte *m_key;
- byte *m_after_image;
-
- virtual int do_before_row_operations(TABLE *table);
- virtual int do_after_row_operations(TABLE *table, int error);
- virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*,
- char const *row_start, char const **row_end);
- virtual int do_exec_row(TABLE *table);
+ virtual int do_before_row_operations(const Slave_reporting_capability *const);
+ virtual int do_after_row_operations(const Slave_reporting_capability *const,int);
+ virtual int do_exec_row(const Relay_log_info *const);
#endif
};
@@ -2535,7 +2591,7 @@ protected:
<caption>Incident event format</caption>
<tr>
<th>Symbol</th>
- <th>Size<br/>(bytes)</th>
+ <th>Size<br>(bytes)</th>
<th>Description</th>
</tr>
<tr>
@@ -2592,7 +2648,7 @@ public:
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- virtual int do_apply_event(RELAY_LOG_INFO const *rli);
+ virtual int do_apply_event(Relay_log_info const *rli);
#endif
virtual bool write_data_header(IO_CACHE *file);
@@ -2620,4 +2676,8 @@ static inline bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache,
reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
}
+/**
+ @} (end of group Replication)
+*/
+
#endif /* _log_event_h */