#At file:///media/sdb2/hezx/work/mysql/bzrwork/semisync/6.0-rpl/ based on revid:alfranio.correia@stripped
2841 He Zhenxing 2009-04-14
BUG#44058 Possible semi-sync replication bugs
Added the following interfaces to allow plugins to set current
thread's status when it is about to sleep and waiting for a
condition. So that KILL can wake it up.
M include/mysql/plugin.h
M include/mysql/plugin.h.pp
M sql/rpl_handler.cc
=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h 2008-12-24 10:48:24 +0000
+++ b/include/mysql/plugin.h 2009-04-14 04:59:02 +0000
@@ -689,6 +689,24 @@ int get_user_var_str(const char *name,
char *value, unsigned long len,
unsigned int precision, int *null_value);
+/**
+ Current thread entering a condition
+
+ This function should be called before putting current thread to
+ wait for a condition. @a mutex should be held before calling this
+ function. After being waken up, @f current_thd_exit_cond should be
+ called.
+*/
+const char* current_thd_enter_cond(pthread_cond_t *cond,
+ pthread_mutex_t *mutex, const char *msg);
+
+/**
+ Current thread leaving a condition
+
+ This function should be called after being waken up for a condition.
+*/
+void current_thd_exit_cond(const char *msg);
+
#ifdef __cplusplus
}
=== modified file 'include/mysql/plugin.h.pp'
--- a/include/mysql/plugin.h.pp 2008-11-12 15:23:22 +0000
+++ b/include/mysql/plugin.h.pp 2009-04-14 04:59:02 +0000
@@ -151,3 +151,6 @@ int get_user_var_real(const char *name,
int get_user_var_str(const char *name,
char *value, unsigned long len,
unsigned int precision, int *null_value);
+const char* current_thd_enter_cond(pthread_cond_t *cond,
+ pthread_mutex_t *mutex, const char *msg);
+void current_thd_exit_cond(const char *msg);
=== modified file 'sql/rpl_handler.cc'
--- a/sql/rpl_handler.cc 2009-03-13 08:14:40 +0000
+++ b/sql/rpl_handler.cc 2009-04-14 04:59:02 +0000
@@ -86,6 +86,23 @@ int get_user_var_str(const char *name, c
return 0;
}
+/* A wrapper of THD::enter_cond for current thread */
+const char* current_thd_enter_cond(pthread_cond_t *cond,
+ pthread_mutex_t *mutex, const char *msg)
+{
+ THD *thd= current_thd;
+
+ return thd->enter_cond(cond, mutex, msg);
+}
+
+/* A wrapper of THD::exit_cond for current thread */
+void current_thd_exit_cond(const char *msg)
+{
+ THD *thd= current_thd;
+ thd->exit_cond(msg);
+}
+
+
int delegates_init()
{
static unsigned long trans_mem[sizeof(Trans_delegate) / sizeof(unsigned long) + 1];
Attachment: [text/bzr-bundle] bzr/zhenxing.he@sun.com-20090414045902-z0qw5vzm8le6415e.bundle