Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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.1830 05/04/29 18:10:47 tomas@stripped +9 -0
cluster_replication removed
cleaner shutdown
disables some tests
added skip on row-based
freeing memory at end
added ndb binlog thread to show processlist
injector thread shutdown to be handled by mysql server
sql/sql_class.h
1.238 05/04/29 18:10:42 tomas@stripped +1 -0
ndb system thread
sql/ha_ndbcluster.cc
1.229 05/04/29 18:10:42 tomas@stripped +62 -53
freeing memory at end
added ndb binlog thread to show processlist
injector thread shutdown to be handled by mysql server
mysql-test/t/rpl_ndb_multi.test
1.3 05/04/29 18:10:42 tomas@stripped +3 -0
cleaner shutdown
mysql-test/t/rpl_ndb_idempotent.test
1.4 05/04/29 18:10:42 tomas@stripped +2 -0
cleaner shutdown
mysql-test/t/rpl_delete_all.test
1.5 05/04/29 18:10:42 tomas@stripped +3 -0
added skip on row-based
mysql-test/t/disabled.def
1.10 05/04/29 18:10:42 tomas@stripped +2 -0
disables some tests
mysql-test/r/rpl_ndb_multi.result
1.3 05/04/29 18:10:42 tomas@stripped +1 -0
cleaner shutdown
mysql-test/r/rpl_ndb_idempotent.result
1.5 05/04/29 18:10:42 tomas@stripped +1 -0
cleaner shutdown
mysql-test/r/rpl000015.result
1.40 05/04/29 18:10:42 tomas@stripped +1 -1
cluster_replication removed
# 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: tomas
# Host: poseidon.ndb.mysql.com
# Root: /home/tomas/wl2325
--- 1.237/sql/sql_class.h 2005-04-26 10:53:21 +02:00
+++ 1.238/sql/sql_class.h 2005-04-29 18:10:42 +02:00
@@ -1525,6 +1525,7 @@
#define SYSTEM_THREAD_DELAYED_INSERT 1
#define SYSTEM_THREAD_SLAVE_IO 2
#define SYSTEM_THREAD_SLAVE_SQL 4
+#define SYSTEM_THREAD_NDBCLUSTER_BINLOG 8
/*
Used to hold information about file and file structure in exchainge
--- 1.4/mysql-test/t/rpl_delete_all.test 2005-02-17 02:46:47 +01:00
+++ 1.5/mysql-test/t/rpl_delete_all.test 2005-04-29 18:10:42 +02:00
@@ -1,3 +1,6 @@
+# Requires statement logging
+-- source include/have_binlog_format_statement.inc
+
source include/master-slave.inc;
connection slave;
--- 1.9/mysql-test/t/disabled.def 2005-04-28 18:51:36 +02:00
+++ 1.10/mysql-test/t/disabled.def 2005-04-29 18:10:42 +02:00
@@ -17,3 +17,5 @@
ndb_cache_multi2 : replication conflict
ndb_insert : Tomas fix sql REPLACE replication conflict
ndb_multi : replication conflict
+rpl_change_master : result mismatch, Mats, Lars check
+rpl_deadlock : result mismatch, Mats, Lars check
--- 1.228/sql/ha_ndbcluster.cc 2005-04-29 02:45:17 +02:00
+++ 1.229/sql/ha_ndbcluster.cc 2005-04-29 18:10:42 +02:00
@@ -174,6 +174,7 @@
#ifndef DBUG_OFF
static void dbug_print_table(const char *info, TABLE *table);
#endif
+int ndbcluster_binlog_start();
extern "C" pthread_handler_decl(ndb_injector_thread_func, arg);
pthread_mutex_t injector_mutex;
@@ -5170,31 +5171,9 @@
pthread_mutex_init(&ndbcluster_mutex,MY_MUTEX_INIT_FAST);
#ifdef HAVE_REPLICATION
- if (opt_bin_log)
+ if (opt_bin_log && ndbcluster_binlog_start())
{
- pthread_mutex_init(&injector_mutex,MY_MUTEX_INIT_FAST);
- pthread_cond_init(&injector_cond,NULL);
-
-
- // Create injector thread
- if (pthread_create(&ndb_injector_thread, &connection_attrib,
- ndb_injector_thread_func, 0))
- {
- DBUG_PRINT("error", ("Could not create ndb injector thread"));
- pthread_cond_destroy(&injector_cond);
- pthread_mutex_destroy(&injector_mutex);
- goto ndbcluster_init_error;
- }
- /**
- * Wait for the ndb injector thread to finish starting up.
- */
- pthread_mutex_lock(&injector_mutex);
- while(!ndb_injector_thread_running)
- pthread_cond_wait(&injector_cond,&injector_mutex);
- pthread_mutex_unlock(&injector_mutex);
-
- if(ndb_injector_thread_running<0)
- goto ndbcluster_init_error;
+ goto ndbcluster_init_error;
}
#endif /* HAVE_REPLICATION */
@@ -5247,24 +5226,6 @@
(void) pthread_cond_signal(&COND_ndb_util_thread);
(void) pthread_mutex_unlock(&LOCK_ndb_util_thread);
-#ifdef HAVE_REPLICATION
- if (ndb_injector_thread_running)
- {
- // wait for the injector thread
- int r;
- if ((r= pthread_join(ndb_injector_thread, NULL)))
- {
- // ToDo the join does not work...
- // returns EINVAL
- DBUG_PRINT("info",("pthread_join(ndb_injector_thread, NULL) %d", r));
- DBUG_PRINT("info",("%d %d %d", ESRCH, EINVAL, EDEADLK));
- }
- pthread_mutex_destroy(&injector_mutex);
- pthread_cond_destroy(&injector_cond);
- ndb_injector_thread_running= 0;
- }
-#endif /* HAVE_REPLICATION */
-
if(g_ndb)
delete g_ndb;
g_ndb= NULL;
@@ -8055,17 +8016,7 @@
DBUG_PRINT("query",("%s",thd->query));
mysql_parse(thd,thd->query,thd->query_length);
-/*
- end=strmov(strmov(strmov(strmov(strmov(buf,
- "INSERT IGNORE INTO "),
- NDB_REP_DB),"."),NDB_APPLY_TABLE),
- " VALUES (0,0)");
- thd->query_length= end-buf;
- thd->query= buf;
-
- mysql_parse(thd,thd->query,thd->query_length);
-*/
thd->query_length= save_query_length;
thd->query= save_query;
thd->variables.pseudo_thread_id= save_thread_id;
@@ -8074,7 +8025,45 @@
return 0;
}
+
+/**
+ * start, stop, wait for ndbcluster binlog thread
+ */
+
static int do_ndbcluster_binlog_close_connection= 0;
+
+int ndbcluster_binlog_start()
+{
+ DBUG_ENTER("ndbcluster_binlog_start");
+
+ pthread_mutex_init(&injector_mutex,MY_MUTEX_INIT_FAST);
+ pthread_cond_init(&injector_cond,NULL);
+
+ // Create injector thread
+ if (pthread_create(&ndb_injector_thread, &connection_attrib,
+ ndb_injector_thread_func, 0))
+ {
+ DBUG_PRINT("error", ("Could not create ndb injector thread"));
+ pthread_cond_destroy(&injector_cond);
+ pthread_mutex_destroy(&injector_mutex);
+ DBUG_RETURN(-1);
+ }
+
+ /**
+ * Wait for the ndb injector thread to finish starting up.
+ */
+ pthread_mutex_lock(&injector_mutex);
+ while(!ndb_injector_thread_running)
+ pthread_cond_wait(&injector_cond,&injector_mutex);
+ pthread_mutex_unlock(&injector_mutex);
+
+ if(ndb_injector_thread_running<0)
+ {
+ DBUG_RETURN(-1);
+ }
+ DBUG_RETURN(0);
+}
+
void ndbcluster_binlog_close_connection(THD *thd)
{
DBUG_ENTER("ndbcluster_binlog_close_connection");
@@ -8717,6 +8706,12 @@
*/
sql_print_information("Starting Cluster Binlog");
+ pthread_detach_this_thread();
+ pthread_mutex_lock(&LOCK_thread_count);
+ thd->thread_id = thread_id++;
+ threads.append(thd);
+ pthread_mutex_unlock(&LOCK_thread_count);
+
if (!(ndb= new Ndb(g_ndb_cluster_connection, "")) ||
ndb->init())
{
@@ -8740,12 +8735,17 @@
pthread_mutex_unlock(&injector_mutex);
pthread_cond_signal(&injector_cond);
+ thd->system_thread= SYSTEM_THREAD_NDBCLUSTER_BINLOG;
+ thd->version=refresh_version;
+ thd->set_time();
thd->host_or_ip= "";
thd->client_capabilities = 0;
my_net_init(&thd->net, 0);
thd->master_access= ~0;
thd->priv_user = 0;
+ thd->proc_info= "Waiting for ndbcluster to start";
+
pthread_mutex_lock(&injector_mutex);
while (!ndb_cluster_node_id)
{
@@ -8784,7 +8784,8 @@
/**
* now we don't want any events before next gci is complete
*/
-
+ thd->proc_info= "Waiting for event from ndbcluster";
+
int res= ndb->pollEvents(1000); // wait for event or 1000 ms
if (abort_loop || do_ndbcluster_binlog_close_connection)
@@ -8814,6 +8815,7 @@
if(res > 0) // ToDo should perhaps be >= 0 to get empty transactions...
{
DBUG_PRINT("info",("pollEvents res: %d",res));
+ thd->proc_info= "Processing events";
error= 0;
NdbEventOperation *pOp;
Binlog_index_row row;
@@ -8892,6 +8894,7 @@
} // for(;;)
}
err:
+ //close_thread_tables(thd);
ndb_injector_thread_running= -1;
pthread_mutex_lock(&injector_mutex);
/* don't mess with the injector_ndb anymore from other threads */
@@ -8900,6 +8903,10 @@
thd->db=0; // as not to try to free memory
sql_print_information("Stopping Cluster Binlog");
+
+ if (apply_status_share)
+ free_share(&apply_status_share);
+
/* remove all event operations */
if (ndb)
{
@@ -8909,6 +8916,8 @@
{
DBUG_PRINT("info",("removing event operation on %s",
op->getEvent()->getName()));
+ NDB_SHARE *share= (NDB_SHARE *)op->getCustomData();
+ free_share(&share);
ndb->dropEventOperation(op);
}
delete ndb;
--- 1.39/mysql-test/r/rpl000015.result 2005-04-18 13:14:00 +02:00
+++ 1.40/mysql-test/r/rpl000015.result 2005-04-29 18:10:42 +02:00
@@ -1,7 +1,7 @@
reset master;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 102 cluster_replication
+master-bin.000001 102
reset slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
--- 1.4/mysql-test/r/rpl_ndb_idempotent.result 2005-04-29 11:34:43 +02:00
+++ 1.5/mysql-test/r/rpl_ndb_idempotent.result 2005-04-29 18:10:42 +02:00
@@ -51,3 +51,4 @@
c1 c2 c3
row3 C 3
row4 D 4
+STOP SLAVE;
--- 1.2/mysql-test/r/rpl_ndb_multi.result 2005-04-27 16:57:25 +02:00
+++ 1.3/mysql-test/r/rpl_ndb_multi.result 2005-04-29 18:10:42 +02:00
@@ -52,3 +52,4 @@
row3 C 3
row4 D 4
row5 E 5
+STOP SLAVE;
--- 1.3/mysql-test/t/rpl_ndb_idempotent.test 2005-04-27 16:57:25 +02:00
+++ 1.4/mysql-test/t/rpl_ndb_idempotent.test 2005-04-29 18:10:42 +02:00
@@ -64,5 +64,7 @@
connection master;
SELECT * FROM t1 ORDER BY c3;
sync_slave_with_master;
+connection slave;
SELECT * FROM t1 ORDER BY c3;
+STOP SLAVE;
--- 1.2/mysql-test/t/rpl_ndb_multi.test 2005-04-27 16:57:25 +02:00
+++ 1.3/mysql-test/t/rpl_ndb_multi.test 2005-04-29 18:10:42 +02:00
@@ -64,5 +64,8 @@
INSERT INTO t1 VALUES ("row5","E",5);
SELECT * FROM t1 ORDER BY c3;
#sync_slave_with_master;
+connection slave;
--sleep 2
SELECT * FROM t1 ORDER BY c3;
+
+STOP SLAVE;
| Thread |
|---|
| • bk commit into 5.1 tree (tomas:1.1830) | tomas | 29 Apr |