mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
b920ab261e
- when we don't have in_addr_t, use uint32. - a forgotten initialization of slave_proxy_id in sql/log_event.cc (was not really "forgot", was "we needn't init it there", but there was one case where we needed...). - made slave_proxy_id always meaningful in THD and Log_event, so we can rely more on it (no need to test if it's meaningful). THD::slave_proxy_id is equal to THD::thread_id except for the slave SQL thread. - clean up the slave's temporary table (i.e. free their memory) when slave server shuts down. extra/resolveip.c: removed #define as it is simpler to put it in my_net.h (because we need the #define elsewhere) include/my_net.h: When in_addr_t is not defined, use uint32. libmysql/libmysql.c: using in_addr_t is more generic. libmysql/manager.c: using in_addr_t is more generic. mysql-test/t/rpl_chain_temp_table.test: comments sql/log_event.cc: * Had forgot to initialize slave_proxy_id in the event constructor (char* buf...). Initializing is in fact only needed for Create_file_log_event, because it uses slave_proxy_id even if it does not write an event to the binlog (it uses slave_proxy_id to write it to SQL-LOAD.info). * When we write events we now always write slave_proxy_id, which is now always meaningful (as thd->slave_proxy_id is now always meaningful, see change in sql_class.cc). sql/mini_client.cc: in_addr_t is more generic. sql/slave.cc: A RELAY_LOG_INFO method to free the slave's temporary tables from memory at slave's server shutdown. It is called by end_slave(), which is called by close_connections(), which is called when the server terminates (close_connections() is just before clean_up(); putting the call in clean_up() was buggy, as active_mi is already deleted by close_connections(). sql/slave.h: new method sql/sql_class.cc: By default we set THD::slave_proxy_id to THD::thread_id, so THD::slave_proxy_id is always meaningful (not 0). It's always the same as the thread id except for the slave SQL thread.
122 lines
3.5 KiB
C
122 lines
3.5 KiB
C
/* Copyright (C) 2000 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
/*
|
|
thread safe version of some common functions:
|
|
my_inet_ntoa
|
|
|
|
This file is also used to make handling of sockets and ioctl()
|
|
portable accross systems.
|
|
|
|
*/
|
|
|
|
#ifndef _my_net_h
|
|
#define _my_net_h
|
|
C_MODE_START
|
|
|
|
#include <errno.h>
|
|
#ifdef HAVE_SYS_SOCKET_H
|
|
#include <sys/socket.h>
|
|
#endif
|
|
#ifdef HAVE_NETINET_IN_H
|
|
#include <netinet/in.h>
|
|
#endif
|
|
#ifdef HAVE_ARPA_INET_H
|
|
#include <arpa/inet.h>
|
|
#endif
|
|
#ifdef HAVE_POLL
|
|
#include <sys/poll.h>
|
|
#endif
|
|
#ifdef HAVE_SYS_IOCTL_H
|
|
#include <sys/ioctl.h>
|
|
#endif
|
|
|
|
#if !defined(MSDOS) && !defined(__WIN__) && !defined(HAVE_BROKEN_NETINET_INCLUDES) && !defined(__BEOS__) && !defined(__NETWARE__)
|
|
#include <netinet/in_systm.h>
|
|
#include <netinet/in.h>
|
|
#include <netinet/ip.h>
|
|
#if !defined(alpha_linux_port)
|
|
#include <netinet/tcp.h>
|
|
#endif
|
|
#endif
|
|
|
|
#if defined(__EMX__)
|
|
#include <sys/ioctl.h>
|
|
#define ioctlsocket(A,B,C) ioctl((A),(B),(void *)(C),sizeof(*(C)))
|
|
#undef HAVE_FCNTL
|
|
#endif /* defined(__EMX__) */
|
|
|
|
#if defined(MSDOS) || defined(__WIN__)
|
|
#define O_NONBLOCK 1 /* For emulation of fcntl() */
|
|
#endif
|
|
|
|
/*
|
|
On OSes which don't have the in_addr_t, we guess that using uint32 is the best
|
|
possible choice. We guess this from the fact that on HP-UX64bit & FreeBSD64bit
|
|
& Solaris64bit, in_addr_t is equivalent to uint32. And on Linux32bit too.
|
|
*/
|
|
#ifndef HAVE_IN_ADDR_T
|
|
#define in_addr_t uint32
|
|
#endif
|
|
|
|
/* Thread safe or portable version of some functions */
|
|
|
|
void my_inet_ntoa(struct in_addr in, char *buf);
|
|
|
|
/*
|
|
Handling of gethostbyname_r()
|
|
*/
|
|
|
|
#if !defined(HPUX10)
|
|
struct hostent;
|
|
#endif /* HPUX */
|
|
#if !defined(HAVE_GETHOSTBYNAME_R)
|
|
struct hostent *my_gethostbyname_r(const char *name,
|
|
struct hostent *result, char *buffer,
|
|
int buflen, int *h_errnop);
|
|
void my_gethostbyname_r_free();
|
|
#elif defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
|
|
struct hostent *my_gethostbyname_r(const char *name,
|
|
struct hostent *result, char *buffer,
|
|
int buflen, int *h_errnop);
|
|
#define my_gethostbyname_r_free()
|
|
#if !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) && !defined(HPUX10)
|
|
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
|
|
#endif /* !defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */
|
|
|
|
#elif defined(HAVE_GETHOSTBYNAME_R_RETURN_INT)
|
|
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
|
|
struct hostent *my_gethostbyname_r(const char *name,
|
|
struct hostent *result, char *buffer,
|
|
int buflen, int *h_errnop);
|
|
#define my_gethostbyname_r_free()
|
|
#else
|
|
#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
|
|
#define my_gethostbyname_r_free()
|
|
#endif /* !defined(HAVE_GETHOSTBYNAME_R) */
|
|
|
|
#ifndef GETHOSTBYNAME_BUFF_SIZE
|
|
#define GETHOSTBYNAME_BUFF_SIZE 2048
|
|
#endif
|
|
|
|
/* On SCO you get a link error when refering to h_errno */
|
|
#ifdef SCO
|
|
#undef h_errno
|
|
#define h_errno errno
|
|
#endif
|
|
|
|
C_MODE_END
|
|
#endif
|