#At file:///home/daogang/bzrwork/bug58784/mysql-trunk/ based on revid:marc.alff@stripped
3454 daogang.qu@stripped 2011-01-06
Bug #56913 rpl_row_ignorable_event fails sporadically on next-mr-bugfixing codebase.
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:36:18 +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:
Attachment: [text/bzr-bundle] bzr/daogang.qu@greatopensource.com-20110106033618-3vh6q92ob4jrkudf.bundle
Thread |
---|
• bzr commit into mysql-trunk branch (daogang.qu:3454) Bug#56913 | daogang.qu | 6 Jan |