List:Commits« Previous MessageNext Message »
From:daogang.qu Date:January 21 2011 11:33am
Subject:bzr push into mysql-trunk branch (daogang.qu:3539 to 3540) Bug#58784
View as plain text  
 3540 daogang.qu@stripped	2011-01-21
      Bug #58784  	rpl_row_ignorable_event fails on PB2
      
      In RBR, The rows are inserted to a queue by the thread executing
      the 'INSERT DELAYED' statement, and are taken out from the queue
      by the handler thread to do the real insertion. Because these two
      threads are running in parallel, there is a possibility that they
      are run in an interleaved manner, and result in different number
      of table_map and rows events.
            
      Added 'wait' and 'signal' mechanism for the test to make the
      binlog of multi 'INSERT DELAYED ...' stmt stable by forcing
      every value is executed into one execution series, and then
      each value will be binlogged into a separate rows event with
      its table map event.
     @ mysql-test/suite/rpl/r/rpl_row_ignorable_event.result
        Updated for the patch of bug#58784.
     @ mysql-test/suite/rpl/t/rpl_row_ignorable_event.test
        Added debug option for making the binlog of
        multi 'INSERT DELAYED ...' stmt stable.
     @ sql/sql_insert.cc
        Added 'wait' and 'signal' mechanism to make 'INSERT DELAYED'
        thread wait to insert data into the queue until the signal
        is sent from 'HANDLER' thread, after the last row from the
        queue is taken out and executed.

    modified:
      mysql-test/suite/rpl/r/rpl_row_ignorable_event.result
      mysql-test/suite/rpl/t/rpl_row_ignorable_event.test
      sql/sql_insert.cc
 3539 Marc Alff	2011-01-21 [merge]
      Merge mysql-trunk-wl5379 --> mysql-trunk
      
      WL#5371 PERFORMANCE_SCHEMA Instrumenting Table Locks
      WL#5379 PERFORMANCE SCHEMA TABLE / INDEX IO SUMMARY
      WL#5420 PERFORMANCE SCHEMA TABLE LOCK WAIT SUMMARY

    added:
      mysql-test/suite/perfschema/include/event_aggregate_cleanup.inc
      mysql-test/suite/perfschema/include/event_aggregate_load.inc
      mysql-test/suite/perfschema/include/event_aggregate_setup.inc
      mysql-test/suite/perfschema/include/table_aggregate_cleanup.inc
      mysql-test/suite/perfschema/include/table_aggregate_load.inc
      mysql-test/suite/perfschema/include/table_aggregate_setup.inc
      mysql-test/suite/perfschema/r/ddl_tiws_by_index_usage.result
      mysql-test/suite/perfschema/r/ddl_tiws_by_table.result
      mysql-test/suite/perfschema/r/ddl_tlws_by_table.result
      mysql-test/suite/perfschema/r/dml_tiws_by_index_usage.result
      mysql-test/suite/perfschema/r/dml_tiws_by_table.result
      mysql-test/suite/perfschema/r/dml_tlws_by_table.result
      mysql-test/suite/perfschema/r/event_aggregate.result
      mysql-test/suite/perfschema/r/ortho_iter.result
      mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_off.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/t/ddl_tiws_by_index_usage.test
      mysql-test/suite/perfschema/t/ddl_tiws_by_table.test
      mysql-test/suite/perfschema/t/ddl_tlws_by_table.test
      mysql-test/suite/perfschema/t/dml_tiws_by_index_usage.test
      mysql-test/suite/perfschema/t/dml_tiws_by_table.test
      mysql-test/suite/perfschema/t/dml_tlws_by_table.test
      mysql-test/suite/perfschema/t/event_aggregate-master.opt
      mysql-test/suite/perfschema/t/event_aggregate.test
      mysql-test/suite/perfschema/t/ortho_iter.test
      mysql-test/suite/perfschema/t/table_aggregate_global_2u_2t.test
      mysql-test/suite/perfschema/t/table_aggregate_global_2u_3t.test
      mysql-test/suite/perfschema/t/table_aggregate_global_4u_2t.test
      mysql-test/suite/perfschema/t/table_aggregate_global_4u_3t.test
      mysql-test/suite/perfschema/t/table_aggregate_hist_2u_2t.test
      mysql-test/suite/perfschema/t/table_aggregate_hist_2u_3t.test
      mysql-test/suite/perfschema/t/table_aggregate_hist_4u_2t.test
      mysql-test/suite/perfschema/t/table_aggregate_hist_4u_3t.test
      mysql-test/suite/perfschema/t/table_aggregate_off.test
      mysql-test/suite/perfschema/t/table_aggregate_thread_2u_2t.test
      mysql-test/suite/perfschema/t/table_aggregate_thread_2u_3t.test
      mysql-test/suite/perfschema/t/table_aggregate_thread_4u_2t.test
      mysql-test/suite/perfschema/t/table_aggregate_thread_4u_3t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_global_2u_2t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_global_2u_3t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_global_4u_2t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_global_4u_3t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_hist_2u_2t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_hist_2u_3t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_hist_4u_2t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_hist_4u_3t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_thread_2u_2t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_thread_2u_3t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_thread_4u_2t.test
      mysql-test/suite/perfschema/t/table_io_aggregate_thread_4u_3t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_global_2u_2t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_global_2u_3t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_global_4u_2t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_global_4u_3t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_hist_2u_2t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_hist_2u_3t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_hist_4u_2t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_hist_4u_3t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_thread_2u_2t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_thread_2u_3t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_thread_4u_2t.test
      mysql-test/suite/perfschema/t/table_lock_aggregate_thread_4u_3t.test
      storage/perfschema/pfs_visitor.cc
      storage/perfschema/pfs_visitor.h
      storage/perfschema/table_tiws_by_index_usage.cc
      storage/perfschema/table_tiws_by_index_usage.h
      storage/perfschema/table_tiws_by_table.cc
      storage/perfschema/table_tiws_by_table.h
      storage/perfschema/table_tlws_by_table.cc
      storage/perfschema/table_tlws_by_table.h
    modified:
      include/mysql/psi/mysql_table.h
      include/mysql/psi/psi.h
      include/mysql/psi/psi_abi_v1.h.pp
      include/mysql/psi/psi_abi_v2.h.pp
      mysql-test/suite/perfschema/include/schema.inc
      mysql-test/suite/perfschema/include/start_server_common.inc
      mysql-test/suite/perfschema/r/func_file_io.result
      mysql-test/suite/perfschema/r/information_schema.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result
      mysql-test/suite/perfschema/r/schema_lc0.result
      mysql-test/suite/perfschema/r/schema_lc1.result
      mysql-test/suite/perfschema/r/schema_lc2.result
      mysql-test/suite/perfschema/r/start_server_no_cond_class.result
      mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
      mysql-test/suite/perfschema/r/start_server_no_file_class.result
      mysql-test/suite/perfschema/r/start_server_no_file_inst.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
      mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
      mysql-test/suite/perfschema/r/start_server_no_setup_objects.result
      mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
      mysql-test/suite/perfschema/r/start_server_no_table_inst.result
      mysql-test/suite/perfschema/r/start_server_no_thread_class.result
      mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
      mysql-test/suite/perfschema/r/start_server_nothing.result
      mysql-test/suite/perfschema/r/start_server_off.result
      mysql-test/suite/perfschema/r/start_server_on.result
      mysys/thr_lock.c
      scripts/mysql_system_tables.sql
      sql/handler.cc
      storage/perfschema/CMakeLists.txt
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_column_types.h
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_events_waits.cc
      storage/perfschema/pfs_events_waits.h
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_instr_class.cc
      storage/perfschema/pfs_instr_class.h
      storage/perfschema/pfs_lock.h
      storage/perfschema/pfs_stat.h
      storage/perfschema/table_events_waits.cc
      storage/perfschema/table_events_waits.h
      storage/perfschema/table_ews_by_thread_by_event_name.cc
      storage/perfschema/table_ews_by_thread_by_event_name.h
      storage/perfschema/table_ews_global_by_event_name.cc
      storage/perfschema/table_ews_global_by_event_name.h
      storage/perfschema/table_helper.cc
      storage/perfschema/table_helper.h
      storage/perfschema/table_os_global_by_type.cc
      storage/perfschema/table_setup_instruments.cc
=== modified file 'mysql-test/suite/rpl/r/rpl_row_ignorable_event.result'
--- a/mysql-test/suite/rpl/r/rpl_row_ignorable_event.result	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_ignorable_event.result	2011-01-21 11:30:47 +0000
@@ -1,7 +1,5 @@
 include/master-slave.inc
 [connection master]
-SET @old_debug= @@global.debug;
-SET GLOBAL debug="+d,waiting_for_delayed_insert_queue_is_empty";
 # Test non-transaction
 create table t1(a int, b int) engine= myisam;
 insert into t1(a,b) values(1,1),(2,1);
@@ -38,6 +36,10 @@ insert into t5(a, b) values(3,1);
 # Test the Rows_query log event will be filtered out if slave filters
 # out all its related tables by replication filtering rules
 update t4,t5 set t4.a=4, t5.a=5 where t4.b=t5.b;
+SET @old_debug= @@global.debug;
+SET GLOBAL debug="+d,after_handle_inserts";
+set DEBUG_SYNC= 'before_write_delayed SIGNAL before_insert EXECUTE 3';
+set DEBUG_SYNC= 'after_write_delayed WAIT_FOR inserts_handled EXECUTE 3';
 # Test insert delayed ...
 insert delayed into t3(a,b) values(1,5),(1,6),(1,7);
 SET @@global.debug= @old_debug;

=== modified file 'mysql-test/suite/rpl/t/rpl_row_ignorable_event.test'
--- a/mysql-test/suite/rpl/t/rpl_row_ignorable_event.test	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_ignorable_event.test	2011-01-21 11:30:47 +0000
@@ -13,8 +13,6 @@ source include/have_binlog_rows_query.in
 source include/have_innodb.inc;
 source include/have_debug.inc;
 
-SET @old_debug= @@global.debug;
-SET GLOBAL debug="+d,waiting_for_delayed_insert_queue_is_empty";
 --echo # Test non-transaction
 let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
 let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1);
@@ -60,6 +58,10 @@ insert into t5(a, b) values(3,1);
 --echo # out all its related tables by replication filtering rules
 update t4,t5 set t4.a=4, t5.a=5 where t4.b=t5.b;
 
+SET @old_debug= @@global.debug;
+SET GLOBAL debug="+d,after_handle_inserts";
+set DEBUG_SYNC= 'before_write_delayed SIGNAL before_insert EXECUTE 3';
+set DEBUG_SYNC= 'after_write_delayed WAIT_FOR inserts_handled EXECUTE 3';
 --echo # Test insert delayed ...
 let $table=t3;
 insert delayed into t3(a,b) values(1,5),(1,6),(1,7);

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2010-12-22 13:23:59 +0000
+++ b/sql/sql_insert.cc	2011-01-21 11:30:47 +0000
@@ -75,6 +75,7 @@
 #include "rpl_mi.h"
 #include "transaction.h"
 #include "sql_audit.h"
+#include "debug_sync.h"
 
 #ifndef EMBEDDED_LIBRARY
 static bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
@@ -920,7 +921,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *t
     if (lock_type == TL_WRITE_DELAYED)
     {
       LEX_STRING const st_query = { query, thd->query_length() };
+      DEBUG_SYNC(thd, "before_write_delayed");
       error=write_delayed(thd, table, duplic, st_query, ignore, log_on);
+      DEBUG_SYNC(thd, "after_write_delayed");
       query=0;
     }
     else
@@ -2345,8 +2348,6 @@ int write_delayed(THD *thd, TABLE *table
                        (ulong) query.length));
 
   thd_proc_info(thd, "waiting for handler insert");
-  DBUG_EXECUTE_IF("waiting_for_delayed_insert_queue_is_empty",
-                  while(di->stacked_inserts) sleep(1););
   mysql_mutex_lock(&di->mutex);
   while (di->stacked_inserts >= delayed_queue_size && !thd->killed)
     mysql_cond_wait(&di->cond_client, &di->mutex);
@@ -3103,6 +3104,15 @@ bool Delayed_insert::handle_inserts(void
     goto err;
   }
   query_cache_invalidate3(&thd, table, 1);
+  DBUG_EXECUTE_IF("after_handle_inserts",
+                  {
+                    const char act[]=
+                      "now "
+                      "signal inserts_handled";
+                    DBUG_ASSERT(opt_debug_sync_timeout > 0);
+                    DBUG_ASSERT(!debug_sync_set_action(&thd,
+                                                       STRING_WITH_LEN(act)));
+                  };);
   mysql_mutex_lock(&mutex);
   DBUG_RETURN(0);
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (daogang.qu:3539 to 3540) Bug#58784daogang.qu21 Jan