summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSujatha Sivakumar <sujatha.sivakumar@oracle.com>2012-04-12 11:07:39 +0530
committerSujatha Sivakumar <sujatha.sivakumar@oracle.com>2012-04-12 11:07:39 +0530
commit64e74d484fcbf6d348397b3ce4f32438754dc8bd (patch)
tree8a25a104bed5686805bd051d11174a86f386261a /sql
parent99b18a036cfb6d990e2f26bb43774735e2a9c7ab (diff)
downloadmariadb-git-64e74d484fcbf6d348397b3ce4f32438754dc8bd.tar.gz
BUG#12662190:COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS
PROBLEM: -------- When binary log statements are replayed on the slave, BEGIN is represented in com_counters but COMMIT is not. Similarly in 'ROW' based replication 'INSERT','UPDATE',and 'DELETE' com_counters are not getting incremented when the binary log statements are replayed at slave. ANALYSIS: --------- In 'ROW' based replication for COMMIT,INSERT,UPDATE and DELETE operations following special events are invoked. Xid_log_event,Write_rows_log_event,Update_rows_log_event,Update_rows_log_event. The above mentioned events doesn't go through the parser where the 'COM_COUNTERS' are incremented. FIX: ----- Increment statements are added at appropriate events. Respective functions are listed below. 'Xid_log_event::do_apply_event' 'Write_rows_log_event::do_before_row_operations' 'Update_rows_log_event::do_before_row_operations' 'Delete_rows_log_event::do_before_row_operations' sql/log_event.cc: Added code to increment counts for 'COM_INSERT','COM_UPDATE', 'COM_DELETE' and 'COM_COMMIT'during ROW based replicaiton
Diffstat (limited to 'sql')
-rw-r--r--sql/log_event.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 40969a11212..95d4fc96a4b 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -5594,6 +5594,11 @@ int Xid_log_event::do_apply_event(Relay_log_info const *rli)
res= trans_commit(thd); /* Automatically rolls back on error. */
thd->mdl_context.release_transactional_locks();
+ /*
+ Increment the global status commit count variable
+ */
+ status_var_increment(thd->status_var.com_stat[SQLCOM_COMMIT]);
+
return res;
}
@@ -8749,6 +8754,12 @@ Write_rows_log_event::do_before_row_operations(const Slave_reporting_capability
{
int error= 0;
+ /*
+ Increment the global status insert count variable
+ */
+ if (get_flags(STMT_END_F))
+ status_var_increment(thd->status_var.com_stat[SQLCOM_INSERT]);
+
/**
todo: to introduce a property for the event (handler?) which forces
applying the event in the replace (idempotent) fashion.
@@ -9682,6 +9693,12 @@ Delete_rows_log_event::Delete_rows_log_event(const char *buf, uint event_len,
int
Delete_rows_log_event::do_before_row_operations(const Slave_reporting_capability *const)
{
+ /*
+ Increment the global status delete count variable
+ */
+ if (get_flags(STMT_END_F))
+ status_var_increment(thd->status_var.com_stat[SQLCOM_DELETE]);
+
if ((m_table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) &&
m_table->s->primary_key < MAX_KEY)
{
@@ -9811,6 +9828,12 @@ Update_rows_log_event::Update_rows_log_event(const char *buf, uint event_len,
int
Update_rows_log_event::do_before_row_operations(const Slave_reporting_capability *const)
{
+ /*
+ Increment the global status update count variable
+ */
+ if (get_flags(STMT_END_F))
+ status_var_increment(thd->status_var.com_stat[SQLCOM_UPDATE]);
+
if (m_table->s->keys > 0)
{
// Allocate buffer for key searches