Hi Daogang,
Nice work.
Please find my review comments below.
STATUS
------
Not Approved.
REQUIRED CHANGES
----------------
RC1. I am ok with the patch, but I think there is a better way
to handle the debug.
It is similar with your patch, except that write_delayed() will
wait an signal, but not sleep.
the code like(I didn't verify the code):
in write_delayed()
+ DBUG_EXECUTE_IF("dbug.waiting_for_delayed_insert_queue_is_empty",
+ {
+ if (di->insert_delayed > 0)
+ {
+ const char act[]=
+ "now "
+ "wait_for signal.has_inserted";
+ DBUG_ASSERT(opt_debug_sync_timeout > 0);
+ DBUG_ASSERT(!debug_sync_set_action(current_thd,
+ STRING_WITH_LEN(act)));
+ }
+ };);
in handle_inserts()
+ DEBUG_SYNC("handle_inserts");
+ Please check the sql/debug_sync.cc.
In the way, the extra variable is not needed.
REQUESTS
--------
NO
SUGGESTIONS
-----------
NO
DETAILS
-------
NO
On Thu, 2011-01-06 at 03:42 +0000, daogang.qu@stripped wrote:
> #At file:///home/daogang/bzrwork/bug58784/mysql-trunk/ based on
> revid:marc.alff@stripped
>
> 3454 daogang.qu@stripped 2011-01-06
> 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 a variable and a debug option 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.
> @ sql/sql_insert.cc
> Added a 'queue_is_empty' variable to indicate that the delayed
> insert queue is empty until the last row from the queue is
> executed completely.
>
> modified:
> sql/sql_insert.cc
> === 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-06 03:42:49 +0000
> @@ -1871,6 +1871,7 @@ public:
> mysql_cond_t cond, cond_client;
> volatile uint tables_in_use,stacked_inserts;
> volatile bool status;
> + bool queue_is_empty;
> /**
> When the handler thread starts, it clones a metadata lock ticket
> which protects against GRL and ticket for the table to be inserted.
> @@ -1895,7 +1896,8 @@ public:
>
> Delayed_insert()
> :locks_in_memory(0), table(0),tables_in_use(0),stacked_inserts(0),
> - status(0), handler_thread_initialized(FALSE), group_count(0)
> + status(0), queue_is_empty(TRUE), handler_thread_initialized(FALSE),
> + group_count(0)
> {
> DBUG_ENTER("Delayed_insert constructor");
> thd.security_ctx->user=(char*) delayed_user;
> @@ -2346,7 +2348,7 @@ int write_delayed(THD *thd, TABLE *table
>
> thd_proc_info(thd, "waiting for handler insert");
> DBUG_EXECUTE_IF("waiting_for_delayed_insert_queue_is_empty",
> - while(di->stacked_inserts) sleep(1););
> + while(!di->queue_is_empty) sleep(1););
> mysql_mutex_lock(&di->mutex);
> while (di->stacked_inserts >= delayed_queue_size &&
> !thd->killed)
> mysql_cond_wait(&di->cond_client, &di->mutex);
> @@ -2431,6 +2433,7 @@ int write_delayed(THD *thd, TABLE *table
>
> di->rows.push_back(row);
> di->stacked_inserts++;
> + di->queue_is_empty= FALSE;
> di->status=1;
> if (table->s->blob_fields)
> unlink_blobs(table);
> @@ -3104,6 +3107,8 @@ bool Delayed_insert::handle_inserts(void
> }
> query_cache_invalidate3(&thd, table, 1);
> mysql_mutex_lock(&mutex);
> + DBUG_EXECUTE_IF("waiting_for_delayed_insert_queue_is_empty",
> + queue_is_empty= TRUE;);
> DBUG_RETURN(0);
>
> err:
>
> text/bzr-bundle type attachment
> (bzr/daogang.qu@stripped)
> # Bazaar merge directive format 2 (Bazaar 0.90)
> # revision_id: daogang.qu@stripped\
> # tj7y1rhbz0oiludy
> # target_branch: file:///home/daogang/bzrwork/bug58784/mysql-trunk/
> # testament_sha1: 5607620fb40e1d232e0f42821f94ed8c8cc81f5a
> # timestamp: 2011-01-06 11:42:54 +0800
> # base_revision_id: marc.alff@stripped\
> # yab7b8mxeng998ia
> #
> # Begin bundle
> IyBCYXphYXIgcmV2aXN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0Ea6
> AqiUonLxUkvUX+LuSKcKEh2hzSzA
>
>
> --
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe: http://lists.mysql.com/commits?unsub=1
--
Your Sincerely,
Libing Song
==================================
MySQL Replication Team
Software Engineer
Email : Anders.Song@stripped
Skype : libing.song
MSN : slb_database@stripped
Phone : +86 010-6505-4020 ext. 319
Mobile: +86 138-1144-2038
==================================