Commit 8b3d5263 authored by unknown's avatar unknown

BUG#21842: Exclude Rows_log_event members used in event application if

not compiled as a replication server - a fix from rpl clone now applied
to 5.1.22 tree.


sql/log_event.cc:
  Exclude Rows_log_event members used in event application if 
  not compiled as a replication server.
sql/log_event.h:
  Don't initialize Rows_log_event members used in event application if 
  not compiled as a replication server.
parent cd7d837b
...@@ -5653,9 +5653,10 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, ...@@ -5653,9 +5653,10 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
m_table(tbl_arg), m_table(tbl_arg),
m_table_id(tid), m_table_id(tid),
m_width(tbl_arg ? tbl_arg->s->fields : 1), m_width(tbl_arg ? tbl_arg->s->fields : 1),
m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_rows_buf(0), m_rows_cur(0), m_rows_end(0), m_flags(0)
m_curr_row(NULL), m_curr_row_end(NULL), #ifdef HAVE_REPLICATION
m_flags(0), m_key(NULL) ,m_key(NULL), m_curr_row(NULL), m_curr_row_end(NULL)
#endif
{ {
/* /*
We allow a special form of dummy event when the table, and cols We allow a special form of dummy event when the table, and cols
...@@ -5697,10 +5698,13 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, ...@@ -5697,10 +5698,13 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
*description_event) *description_event)
: Log_event(buf, description_event), : Log_event(buf, description_event),
m_row_count(0), m_row_count(0),
#ifndef MYSQL_CLIENT
m_table(NULL), m_table(NULL),
m_rows_buf(0), m_rows_cur(0), m_rows_end(0), #endif
m_curr_row(NULL), m_curr_row_end(NULL), m_table_id(0), m_rows_buf(0), m_rows_cur(0), m_rows_end(0)
m_key(NULL) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
,m_key(NULL), m_curr_row(NULL), m_curr_row_end(NULL)
#endif
{ {
DBUG_ENTER("Rows_log_event::Rows_log_event(const char*,...)"); DBUG_ENTER("Rows_log_event::Rows_log_event(const char*,...)");
uint8 const common_header_len= description_event->common_header_len; uint8 const common_header_len= description_event->common_header_len;
...@@ -5789,7 +5793,9 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, ...@@ -5789,7 +5793,9 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
m_rows_buf= (uchar*) my_malloc(data_size, MYF(MY_WME)); m_rows_buf= (uchar*) my_malloc(data_size, MYF(MY_WME));
if (likely((bool)m_rows_buf)) if (likely((bool)m_rows_buf))
{ {
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
m_curr_row= m_rows_buf; m_curr_row= m_rows_buf;
#endif
m_rows_end= m_rows_buf + data_size; m_rows_end= m_rows_buf + data_size;
m_rows_cur= m_rows_end; m_rows_cur= m_rows_end;
memcpy(m_rows_buf, ptr_rows_data, data_size); memcpy(m_rows_buf, ptr_rows_data, data_size);
...@@ -6187,8 +6193,8 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) ...@@ -6187,8 +6193,8 @@ int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli)
} // if (table) } // if (table)
/* /*
We need to delay this clear until the table def stored in m_table_def is no We need to delay this clear until here bacause unpack_current_row() uses
longer needed. It is used in unpack_current_row(). master-side table definitions stored in rli.
*/ */
if (rli->tables_to_lock && get_flags(STMT_END_F)) if (rli->tables_to_lock && get_flags(STMT_END_F))
const_cast<RELAY_LOG_INFO*>(rli)->clear_tables_to_lock(); const_cast<RELAY_LOG_INFO*>(rli)->clear_tables_to_lock();
...@@ -7825,8 +7831,7 @@ Delete_rows_log_event::do_before_row_operations(const Slave_reporting_capability ...@@ -7825,8 +7831,7 @@ Delete_rows_log_event::do_before_row_operations(const Slave_reporting_capability
m_table->s->primary_key < MAX_KEY) m_table->s->primary_key < MAX_KEY)
{ {
/* /*
We don't need to allocate any memory for m_after_image and We don't need to allocate any memory for m_key since it is not used.
m_key since they are not used.
*/ */
return 0; return 0;
} }
......
...@@ -2294,15 +2294,15 @@ class Rows_log_event : public Log_event ...@@ -2294,15 +2294,15 @@ class Rows_log_event : public Log_event
uchar *m_rows_cur; /* One-after the end of the data */ uchar *m_rows_cur; /* One-after the end of the data */
uchar *m_rows_end; /* One-after the end of the allocated space */ uchar *m_rows_end; /* One-after the end of the allocated space */
const uchar *m_curr_row; /* Start of the row being processed */ flag_set m_flags; /* Flags for row-level events */
const uchar *m_curr_row_end; /* One-after the end of the current row */
flag_set m_flags; /* Flags for row-level events */
uchar *m_key; /* Buffer to keep key value during searches */
/* helper functions */ /* helper functions */
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #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 find_row(const RELAY_LOG_INFO *const);
int write_row(const RELAY_LOG_INFO *const, const bool); int write_row(const RELAY_LOG_INFO *const, const bool);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment