Bug #31484 Cluster LOST_EVENTS entry not added to binlog on mysqld restart.

parent d8eb4cdc
......@@ -5,10 +5,6 @@ connect (server2,127.0.0.1,root,,test,$MASTER_MYPORT1,);
# Check that server1 has NDB support
connection server1;
disable_query_log;
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
flush tables;
--require r/true.require
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
......@@ -17,14 +13,10 @@ enable_query_log;
# Check that server2 has NDB support
connection server2;
disable_query_log;
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
flush tables;
--require r/true.require
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
enable_query_log;
# Set the default connection to 'server1'
connection server1;
# Set the default connection
connection default;
drop table if exists t1, t2, t3, t4;
flush status;
drop table if exists t1, t2, t3, t4;
flush status;
create table t1 (a int) engine=ndbcluster;
......
......@@ -6,11 +6,12 @@
--disable_warnings
connection server2;
drop table if exists t1, t2, t3, t4;
flush status;
connection server1;
drop table if exists t1, t2, t3, t4;
flush status;
--enable_warnings
flush status;
# Create test tables on server1
create table t1 (a int) engine=ndbcluster;
......
......@@ -618,7 +618,7 @@ bool ha_ndbcluster::get_error_message(int error,
DBUG_ENTER("ha_ndbcluster::get_error_message");
DBUG_PRINT("enter", ("error: %d", error));
Ndb *ndb= get_ndb();
Ndb *ndb= check_ndb_in_thd(current_thd);
if (!ndb)
DBUG_RETURN(FALSE);
......
......@@ -3587,6 +3587,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
Thd_ndb *thd_ndb=0;
int ndb_update_ndb_binlog_index= 1;
injector *inj= injector::instance();
uint incident_id= 0;
#ifdef RUN_NDB_BINLOG_TIMER
Timer main_timer;
......@@ -3692,17 +3693,43 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
pthread_mutex_unlock(&injector_mutex);
pthread_cond_signal(&injector_cond);
/*
wait for mysql server to start (so that the binlog is started
and thus can receive the first GAP event)
*/
pthread_mutex_lock(&LOCK_server_started);
while (!mysqld_server_started)
{
struct timespec abstime;
set_timespec(abstime, 1);
pthread_cond_timedwait(&COND_server_started, &LOCK_server_started,
&abstime);
if (ndbcluster_terminating)
{
pthread_mutex_unlock(&LOCK_server_started);
pthread_mutex_lock(&LOCK_ndb_util_thread);
goto err;
}
}
pthread_mutex_unlock(&LOCK_server_started);
restart:
/*
Main NDB Injector loop
*/
{
/*
Always insert a GAP event as we cannot know what has happened in the cluster
while not being connected.
Always insert a GAP event as we cannot know what has happened
in the cluster while not being connected.
*/
LEX_STRING const msg= { C_STRING_WITH_LEN("Cluster connect") };
inj->record_incident(thd, INCIDENT_LOST_EVENTS, msg);
LEX_STRING const msg[2]=
{
{ C_STRING_WITH_LEN("mysqld startup") },
{ C_STRING_WITH_LEN("cluster disconnect")}
};
IF_DBUG(int error=)
inj->record_incident(thd, INCIDENT_LOST_EVENTS, msg[incident_id]);
DBUG_ASSERT(!error);
incident_id= 1;
}
{
thd->proc_info= "Waiting for ndbcluster to start";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment