List:Commits« Previous MessageNext Message »
From:Daogang Qu Date:January 18 2011 2:41am
Subject:Re: bzr commit into mysql-trunk branch (daogang.qu:3454) Bug#58784
View as plain text  
2011-01-14 19:48, Andrei Elkin wrote:
> DaoGang, hello.
>
>
> The new patch is perfect! Indeed, dbug_sync-based simulation is much better.
>
>   
>> #At file:///home/daogang/bzrwork/bug58784/mysql-trunk/ based on
> revid:marc.alff@stripped
>>
>>  3454 daogang.qu@stripped	2011-01-14
>>       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.
>>     
> I could add few words further explaining mechanics of non-deterministic
> number of Table-maps. I am guessing it, a Table-map is per each wait by
> the Insert handler. So if all 3 rows were queued before the handler
> reacted there would be just one Table-map.
> You may correct me if I am wrong and if you like put couple of words
> into the above paragraph.
>
>   
Yes. You are right. But I think the original description covered what
you described
in your comments. Could you please write it down clearly if you think
it's not?

Best Regards,

Daogang
> Thanks!
>
> Andrei
>
>
>   
>>             
>>       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
>> === 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-14 02:21:46
> +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,9 @@ 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="+d,after_write_delayed";
>>  # 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-14 02:21:46
> +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,9 @@ 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="+d,after_write_delayed";
>>  --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-14 02:21:46 +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,
>> @@ -2345,8 +2346,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);
>> @@ -2438,6 +2437,23 @@ int write_delayed(THD *thd, TABLE *table
>>  
>>    thread_safe_increment(delayed_rows_in_use,&LOCK_delayed_status);
>>    mysql_mutex_unlock(&di->mutex);
>> +  DBUG_EXECUTE_IF("after_write_delayed",
>> +                  {
>> +                    const char act[]=
>> +                      "now "
>> +                      "wait_for has_inserted";
>> +                    DBUG_ASSERT(opt_debug_sync_timeout > 0);
>> +                    DBUG_ASSERT(!debug_sync_set_action(current_thd,
>> +                                                       STRING_WITH_LEN(act)));
>> +                  };);
>> +  DBUG_EXECUTE_IF("after_write_delayed",
>> +                  {
>> +                    const char act[]=
>> +                      "reset";
>> +                    DBUG_ASSERT(opt_debug_sync_timeout > 0);
>> +                    DBUG_ASSERT(!debug_sync_set_action(current_thd,
>> +                                                       STRING_WITH_LEN(act)));
>> +                  };);
>>    DBUG_RETURN(0);
>>  
>>   err:
>> @@ -3104,6 +3120,15 @@ bool Delayed_insert::handle_inserts(void
>>    }
>>    query_cache_invalidate3(&thd, table, 1);
>>    mysql_mutex_lock(&mutex);
>> +  DBUG_EXECUTE_IF("after_handle_inserts",
>> +                  {
>> +                    const char act[]=
>> +                      "now "
>> +                      "signal has_inserted";
>> +                    DBUG_ASSERT(opt_debug_sync_timeout > 0);
>> +                    DBUG_ASSERT(!debug_sync_set_action(current_thd,
>> +                                                       STRING_WITH_LEN(act)));
>> +                  };);
>>    DBUG_RETURN(0);
>>  
>>   err:
>>
>>
>> # Bazaar merge directive format 2 (Bazaar 0.90)
>> # revision_id: daogang.qu@stripped\
>> #   se1d2bswfgj3i7do
>> # target_branch: file:///home/daogang/bzrwork/bug58784/mysql-trunk/
>> # testament_sha1: f90eb630eff67680c2cc33c65738d12a801e9b54
>> # timestamp: 2011-01-14 10:21:51 +0800
>> # base_revision_id: marc.alff@stripped\
>> #   yab7b8mxeng998ia
>> # 
>> # Begin bundle
>> IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWXQv4HcABAX/gFAxUAB47///
>> f+Xe6r////pgCYe9vb532++t0pRTKPU7sily1O51x92dECSSaCaZGRJ+1TaJhpPSEaZNDQAxAAAA
>> SUTQmbSJhE2qabSZPEgAAGIAAAANFRsmk9SYEwmTNBoRgCYCMAmACMBpopqPRkpmoZB6IAAANMIy
>> AAAACKREwETBTyk9PFGo/KhvVPQh6TEYR6R6mnojR6NQSRE00AAqn5Mg01PU9Ek9TT2qYmgaMJpk
>> AZP1TeqYs32LtaYbE74q07JDNvqZB/Vepx623SToru1x8F0LjAH8gPCOZxkYF896BfTKVy11YWI/
>> l75Pf9qsuO/RpSEzQglgDAw9hXV8OsmdYZ+g3PW6GIiIAiBqJTKg+XPBpkUUWrTJZDgtNuyjItuC
>> tVJK1FDGD5paFtPWbqU4VRf+e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rRxqZGECVcMmGFW5Qz3HHoAcBpfcUPwLS8yJDcxIsgg
>> kpBN4JtF6kcWnUYB3VLRqGYcJMad6mlsKy5WFe2JpSLltPJq+bpkMy+q+oLwXlgko08uNNUw3LLx
>> UDBczMFb4JFx2tnsqhncY8m+hhEEkR3MGaRB4svRE+aRGIfEmR7KLja+AUq9uegXwvW3z9/gktiC
>> ogKWApr1lVf1WJknScIk74HhaQjRr0ELql5ZSN2hrQsH0NoEUmRrEJ9S3RyMolgly/AxCjVJWygW
>> pElq1dnenhBRiXhrSs4CvGZmKhUlxFQXVeAiKXpPUNF32kNzx5ktIRoe6J1VBZWh0YUlWJrdjZU8
>> RqJNUs0QwUsyCmBljuYwxUbtcLbb3t5MeAn321KOaY8WAGZpHdRwxtmuBlo2yl2al9TAxYkQE4Z4
>> 0qDMh5N6Kv0XmkeGnYuA7DRD6MUBXksQyXB13GWazjuSKJqcEOHXZYi+FRTURTcwBJ+vlPGXi17z
>> fUJM5suR3BWOGCZnK8SazY7llsiXcgm1OcMa7G0tSni03YV69jPANTS4vve+9o/+LuSKcKEg6F/A
>>     
>   

Thread
bzr commit into mysql-trunk branch (daogang.qu:3454) Bug#58784daogang.qu17 Jan
Re: bzr commit into mysql-trunk branch (daogang.qu:3454) Bug#58784Daogang Qu18 Jan