Commit 2eb954a2 authored by unknown's avatar unknown
Browse files

Bug #4629 Crash after SLAVE STOP, if the IO thread is in special state.

client.c:
  Added call to clear_slave_vio inside end_server only when under Windows with repliaction
slave.cc:
  Added clear_slave_vio function for clearing active vio on THD under Windows replication


sql/slave.cc:
  Added clear_slave_vio function for clearing active vio on THD under Windows replication
sql-common/client.c:
  Added call to clear_slave_vio inside end_server only when under Windows with repliaction
parent 7c462524
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -133,6 +133,11 @@ static void mysql_close_free(MYSQL *mysql);
static int wait_for_data(my_socket fd, uint timeout);
#endif

#if defined(__WIN__) && defined(HAVE_REPLICATION) && defined(MYSQL_SERVER)
void clear_slave_vio( MYSQL* mysql );
#endif


/****************************************************************************
  A modified version of connect().  my_connect() allows you to specify
  a timeout value, in seconds, that we should wait until we
@@ -818,6 +823,12 @@ void end_server(MYSQL *mysql)
    init_sigpipe_variables
    DBUG_PRINT("info",("Net: %s", vio_description(mysql->net.vio)));
    set_sigpipe(mysql);

#if defined(__WIN__) && defined(HAVE_REPLICATION) && defined(MYSQL_SERVER)
	/* if this mysql is one of our connections to the master, then clear it */
	clear_slave_vio( mysql );
#endif

    vio_delete(mysql->net.vio);
    reset_sigpipe(mysql);
    mysql->net.vio= 0;          /* Marker */
+22 −0
Original line number Diff line number Diff line
@@ -4383,4 +4383,26 @@ template class I_List_iterator<i_string>;
template class I_List_iterator<i_string_pair>;
#endif


#ifdef __WIN__
extern "C" void clear_slave_vio( MYSQL* mysql )
{
	if (active_mi->mysql == mysql)
		active_mi->io_thd->clear_active_vio();
	/* TODO: use code like below when multi-master is in place */
	/*	LIST *cur = &master_list;
	if (((MASTER_INFO*)cur->data)->mysql == mysql)
	{
		MASTER_INFO *mi = (MASTER_INFO*)cur->data;
		mi->io_thd->clear_active_vio();
		return;
	}
	else
		cur = cur->next;*/
}
#endif




#endif /* HAVE_REPLICATION */