summaryrefslogtreecommitdiff
path: root/sql/log_event.h
diff options
context:
space:
mode:
authorunknown <tsmith@sita.local>2007-08-29 15:28:38 -0600
committerunknown <tsmith@sita.local>2007-08-29 15:28:38 -0600
commit48193af48948acb84ddd3b488b6f8faa4a6d126b (patch)
tree81c00dc60322deeb0c094deef5d141509c980a60 /sql/log_event.h
parent024bd2f612825cd36c93775728f56856e5f28267 (diff)
parent053c9d1c473df4e1457992ee6a39da3e0cb39bdd (diff)
downloadmariadb-git-48193af48948acb84ddd3b488b6f8faa4a6d126b.tar.gz
Merge sita.local:/Users/tsmith/m/bk/maint/51-target22
into sita.local:/Users/tsmith/m/bk/maint/51 sql/field.cc: Auto merged sql/log_event_old.cc: Auto merged sql/rpl_record.h: Auto merged sql/rpl_utility.cc: Auto merged sql/rpl_utility.h: Auto merged sql/slave.h: Auto merged storage/innobase/handler/ha_innodb.cc: Auto merged sql/log_event.cc: Manual merge sql/log_event.h: Manual merge sql/log_event_old.h: Manual merge sql/rpl_record.cc: Manual merge sql/slave.cc: Manual merge
Diffstat (limited to 'sql/log_event.h')
-rw-r--r--sql/log_event.h109
1 files changed, 55 insertions, 54 deletions
diff --git a/sql/log_event.h b/sql/log_event.h
index 1f45e384e30..0c66d1b190f 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -32,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
@@ -2186,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;
@@ -2290,7 +2300,26 @@ protected:
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:
@@ -2315,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.
@@ -2325,45 +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*,
- uchar const *row_start,
- uchar 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;
+};
/*****************************************************************************
@@ -2413,14 +2431,9 @@ private:
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- uchar *m_memory;
- uchar *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*,
- uchar const *row_start, uchar 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
};
@@ -2492,15 +2505,9 @@ protected:
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- uchar *m_memory;
- uchar *m_key;
- uchar *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*,
- uchar const *row_start, uchar 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) */
};
@@ -2563,15 +2570,9 @@ protected:
#endif
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
- uchar *m_memory;
- uchar *m_key;
- uchar *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*,
- uchar const *row_start, uchar 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
};