List:Commits« Previous MessageNext Message »
From:Sujatha Sivakumar Date:April 12 2012 9:14am
Subject:bzr push into mysql-5.5 branch (sujatha.sivakumar:3785 to 3786) Bug#12662190
View as plain text  
 3786 Sujatha Sivakumar	2012-04-12
      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

    modified:
      mysql-test/extra/rpl_tests/rpl_row_basic.test
      mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
      mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
      sql/log_event.cc
 3785 gopal.shankar@stripped	2012-04-11
      Bug#11815557 60269: MYSQL SHOULD REJECT ATTEMPTS TO CREATE SYSTEM
                          TABLES IN INCORRECT ENGINE
      
      PROBLEM:
        CREATE/ALTER TABLE currently can move system tables like
      mysql.db, user, host etc, to engines other than MyISAM. This is not
      completely supported as of now, by mysqld. When some of system tables
      like plugin, servers, event, func, *_priv, time_zone* are moved
      to innodb, mysqld restart crashes. Currently system tables
      can be moved to BLACKHOLE also!!!.
      
      ANALYSIS:
        The problem is that there is no check before creating or moving
      a system table to some particular engine.
      
        System tables are suppose to be residing in MyISAM. We can think
      of restricting system tables to exist only in MyISAM. But, there could
      be future needs of these system tables to be part of other engines
      by design. For eg, NDB cluster expects some tables to be on innodb
      or ndb engine. This calls for a solution, by which system
      tables can be supported by any desired engine, with minimal effort.
      
      FIX:
        The solution provides a handlerton interface using which,
      mysqld server can query particular storage engine handlerton for
      system tables that it supports. This way each storage engine
      layer can define their own system database and system tables.
      
        The check_engine() function uses the new handlerton function
      ha_check_if_supported_system_table() to check if db.tablename
      provided in the DDL is supported by the SE.
      
      Note: This fix has modified a test in help.test, which was moving
      mysql.help_* to innodb. The primary intention of the test was not
      to move them between engines.

    modified:
      mysql-test/r/alter_table.result
      mysql-test/r/help.result
      mysql-test/t/alter_table.test
      mysql-test/t/help.test
      sql/handler.cc
      sql/handler.h
      sql/share/errmsg-utf8.txt
      sql/sql_table.cc
      storage/example/ha_example.cc
      storage/myisam/ha_myisam.cc
=== modified file 'mysql-test/extra/rpl_tests/rpl_row_basic.test'
--- a/mysql-test/extra/rpl_tests/rpl_row_basic.test	2011-02-23 11:54:58 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_row_basic.test	2012-04-12 05:37:39 +0000
@@ -6,6 +6,15 @@
 # First we test tables with only an index.
 #
 
+#BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS
+#Testing command counters -BEFORE 
+#Storing the before counts of Slave
+connection slave;
+let $slave_com_commit_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_commit', Value, 1);
+let $slave_com_insert_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_insert', Value, 1);
+let $slave_com_delete_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_delete', Value, 1);
+let $slave_com_update_before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_update', Value, 1);
+
 connection master;
 eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ;
 SELECT * FROM t1;
@@ -40,6 +49,32 @@ SELECT * FROM t1 ORDER BY C1,C2;
 sync_slave_with_master;
 SELECT * FROM t1 ORDER BY C1,C2;
 
+#BUG#12662190 - COM_COMMIT IS NOT INCREMENTED FROM THE BINARY LOGS ON SLAVE, COM_BEGIN IS
+#Testing command counters -AFTER 
+#Storing the after counts of Slave
+connection slave;
+let $slave_com_commit_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_commit', Value, 1);
+let $slave_com_insert_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_insert', Value, 1);
+let $slave_com_delete_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_delete', Value, 1);
+let $slave_com_update_after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_update', Value, 1);
+
+#Commit count check
+--let $assert_text= Counter for COM_COMMIT is consistent with the number of actual commits
+--let $assert_cond= $slave_com_commit_after - $slave_com_commit_before = 4
+--source include/assert.inc
+#Insert count check
+--let $assert_text= Counter for COM_INSERT is consistent with the number of actual inserts
+--let $assert_cond= $slave_com_insert_after - $slave_com_insert_before = 2
+--source include/assert.inc
+#Delete count check
+--let $assert_text= Counter for COM_DELETE is consistent with the number of actual deletes
+--let $assert_cond= $slave_com_delete_after - $slave_com_delete_before = 1
+--source include/assert.inc
+#Update count check
+--let $assert_text= Counter for COM_UPDATE is consistent with the number of actual updates
+--let $assert_cond= $slave_com_update_after - $slave_com_update_before = 1
+--source include/assert.inc
+
 # Testing update with a condition that does not match any rows, but
 # which has a match for the index.
 connection master;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result'
--- a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result	2011-02-23 11:54:58 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result	2012-04-12 05:37:39 +0000
@@ -49,6 +49,10 @@ A	B
 A	I
 X	Y
 X	Z
+include/assert.inc [Counter for COM_COMMIT is consistent with the number of actual commits]
+include/assert.inc [Counter for COM_INSERT is consistent with the number of actual inserts]
+include/assert.inc [Counter for COM_DELETE is consistent with the number of actual deletes]
+include/assert.inc [Counter for COM_UPDATE is consistent with the number of actual updates]
 UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
 SELECT * FROM t1 ORDER BY c1,c2;
 C1	C2

=== modified file 'mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result	2011-02-23 11:54:58 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result	2012-04-12 05:37:39 +0000
@@ -49,6 +49,10 @@ A	B
 A	I
 X	Y
 X	Z
+include/assert.inc [Counter for COM_COMMIT is consistent with the number of actual commits]
+include/assert.inc [Counter for COM_INSERT is consistent with the number of actual inserts]
+include/assert.inc [Counter for COM_DELETE is consistent with the number of actual deletes]
+include/assert.inc [Counter for COM_UPDATE is consistent with the number of actual updates]
 UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
 SELECT * FROM t1 ORDER BY c1,c2;
 C1	C2

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2012-02-29 08:45:15 +0000
+++ b/sql/log_event.cc	2012-04-12 05:37:39 +0000
@@ -5594,6 +5594,11 @@ int Xid_log_event::do_apply_event(Relay_
   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_oper
 {
   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_e
 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_e
 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

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5 branch (sujatha.sivakumar:3785 to 3786) Bug#12662190Sujatha Sivakumar12 Apr