summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2015-04-02 19:31:51 +0300
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2015-06-30 13:17:09 +0300
commita7d181a023ae51a3bef40c3740ef38de89e06adc (patch)
treef1797c9e50447391f42a866ca90e0107c4d1f73e /sql
parentc096caee71b35198d9f1fb35d1fbd5ea796cf878 (diff)
downloadmariadb-git-a7d181a023ae51a3bef40c3740ef38de89e06adc.tar.gz
[MDEV-6877] Added a bitmap compare function for binlog_row_image
The function compares bitmaps according to the binlog_row_image variable setting.
Diffstat (limited to 'sql')
-rw-r--r--sql/log_event.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/sql/log_event.h b/sql/log_event.h
index b57ef35aad2..13d7242c98c 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -4264,9 +4264,58 @@ public:
virtual int get_data_size();
MY_BITMAP const *get_cols() const { return &m_cols; }
+ MY_BITMAP const *get_cols_ai() const { return &m_cols_ai; }
size_t get_width() const { return m_width; }
ulong get_table_id() const { return m_table_id; }
+#if defined(MYSQL_SERVER)
+ /*
+ This member function compares the table's read/write_set
+ with this event's m_cols and m_cols_ai. Comparison takes
+ into account what type of rows event is this: Delete, Write or
+ Update, therefore it uses the correct m_cols[_ai] according
+ to the event type code.
+
+ Note that this member function should only be called for the
+ following events:
+ - Delete_rows_log_event
+ - Write_rows_log_event
+ - Update_rows_log_event
+
+ @param[IN] table The table to compare this events bitmaps
+ against.
+
+ @return TRUE if sets match, FALSE otherwise. (following
+ bitmap_cmp return logic).
+
+ */
+ virtual bool read_write_bitmaps_cmp(TABLE *table)
+ {
+ bool res= FALSE;
+
+ switch (get_general_type_code())
+ {
+ case DELETE_ROWS_EVENT:
+ res= bitmap_cmp(get_cols(), table->read_set);
+ break;
+ case UPDATE_ROWS_EVENT:
+ res= (bitmap_cmp(get_cols(), table->read_set) &&
+ bitmap_cmp(get_cols_ai(), table->write_set));
+ break;
+ case WRITE_ROWS_EVENT:
+ res= bitmap_cmp(get_cols(), table->write_set);
+ break;
+ default:
+ /*
+ We should just compare bitmaps for Delete, Write
+ or Update rows events.
+ */
+ DBUG_ASSERT(0);
+ }
+ return res;
+ }
+#endif
+
#ifdef MYSQL_SERVER
virtual bool write_data_header(IO_CACHE *file);
virtual bool write_data_body(IO_CACHE *file);