Below is the list of changes that have just been committed into a local
5.1 repository of stewart. When stewart does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1818 05/03/18 17:59:50 stewart@stripped +2 -0
Further work on WL2325 - NDB Injector thread
locking improvements
add ndbcluster_drop_event_ops()
sql/ha_ndbcluster.h
1.81 05/03/18 17:59:35 stewart@stripped +0 -1
Remove duplicate NdbEventOperation member of NDB_SHARE
sql/ha_ndbcluster.cc
1.177 05/03/18 17:59:35 stewart@stripped +41 -6
add ndbcluster_drop_event_ops
- call it on drop table
injector thread
- change mutex locking around condition. should help stop that deadlock tomas was seeing.
- pass the same type of string to get_share
- use correct locking for NDB_SHARE operations
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: stewart
# Host: kennedy.(none)
# Root: /home/stewart/Documents/MySQL/5.1/ndb-wl2325
--- 1.176/sql/ha_ndbcluster.cc 2005-03-18 13:11:59 +11:00
+++ 1.177/sql/ha_ndbcluster.cc 2005-03-18 17:59:35 +11:00
@@ -131,6 +131,7 @@
const char* event_name);
int ndbcluster_create_event_ops(Ndb *ndb, const NDBTAB* table,
const char* event_name);
+int ndbcluster_drop_event_ops(const char *tab);
inline void ndb_rep_event_name(String *event_name, const char* db, const char* tbl);
extern "C" pthread_handler_decl(ndb_injector_thread_func, arg);
@@ -4079,9 +4080,7 @@
#ifdef HAVE_REPLICATION
if (opt_bin_log) {
- sql_print_information("NDB Replication: Drop table %s",
- get_share(m_tabname)->op->getTable()->getName());
- injector_ndb->dropEventOperation(get_share(m_tabname)->op);
+ ndbcluster_drop_event_ops(name);
}
#endif
@@ -4735,7 +4734,7 @@
{
pthread_mutex_init(&injector_startup_mutex,MY_MUTEX_INIT_FAST);
pthread_cond_init(&injector_startup_cond,NULL);
- pthread_mutex_lock(&injector_startup_mutex);
+
// Create injector thread
if (pthread_create(&ndb_injector_thread, &connection_attrib,
@@ -4750,6 +4749,7 @@
* Wait for the ndb injector thread to finish starting up.
* Afterwards, we no longer need this mutex
*/
+ pthread_mutex_lock(&injector_startup_mutex);
pthread_cond_wait(&injector_startup_cond,&injector_startup_mutex);
pthread_mutex_unlock(&injector_startup_mutex);
pthread_cond_destroy(&injector_startup_cond);
@@ -7186,6 +7186,21 @@
DBUG_ENTER("ndbcluster_setup_repl_for_table");
NdbEventOperation *op= ndb->createEventOperation(event_name,100);
+
+ {
+ String share_name(100);
+ share_name.append("./");
+ share_name.append(ndb->getDatabaseName());
+ share_name.append('/');
+ share_name.append(table->getName());
+
+ NDB_SHARE *share= get_share(share_name.c_ptr());
+ pthread_mutex_lock(&share->mutex);
+ share->op= op; // assign op in NDB_SHARE
+ pthread_mutex_unlock(&share->mutex);
+ free_share(share);
+ }
+
if(!op)
{
sql_print_error("NDB Replication: Creating NdbEventOperation failed for"
@@ -7197,8 +7212,6 @@
DBUG_RETURN(-1);
}
- get_share(table->getName())->op= op; // assign op in NDB_SHARE
-
int n_columns= table->getNoOfColumns();
for (int j= 0; j < n_columns; j++)
{
@@ -7223,6 +7236,25 @@
DBUG_RETURN(0);
}
+int ndbcluster_drop_event_ops(const char *db_tab)
+{
+ NDB_SHARE *share= get_share(db_tab);
+ pthread_mutex_lock(&share->mutex);
+
+ if(!share->op) // may have had problem setting up op
+ goto q;
+
+ sql_print_information("NDB Replication: Drop table %s",
+ share->op->getTable()->getName());
+ injector_ndb->dropEventOperation(share->op);
+
+ share->op= NULL;
+
+q:
+ pthread_mutex_unlock(&share->mutex);
+ free_share(share);
+}
+
inline void
ndb_rep_event_name(String *event_name,const char* db, const char* tbl)
{
@@ -7241,6 +7273,8 @@
Ndb *ndb= 0;
longlong last_gci_in_binlog_index= 0;
+ pthread_mutex_lock(&injector_startup_mutex);
+
/*
* Set up the Thread
*/
@@ -7283,6 +7317,7 @@
* starting up.
*/
pthread_cond_signal(&injector_startup_cond);
+ pthread_mutex_unlock(&injector_startup_mutex);
/**
* Main NDB Injector loop
--- 1.80/sql/ha_ndbcluster.h 2005-03-18 12:10:33 +11:00
+++ 1.81/sql/ha_ndbcluster.h 2005-03-18 17:59:35 +11:00
@@ -62,7 +62,6 @@
THR_LOCK lock;
pthread_mutex_t mutex;
char *table_name;
- NdbEventOperation *event_op;
uint table_name_length,use_count;
uint commit_count_lock;
ulonglong commit_count;
| Thread |
|---|
| • bk commit into 5.1 tree (stewart:1.1818) | Stewart Smith | 18 Mar |