Commit 353fb57b authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

New my_gethostbyname_r() handling

Changed some status variable names
Fix bug in GRANT ... PASSWORD string
parent 14b55bcc
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -19678,17 +19678,17 @@ have.
@item @code{Open_files} @tab  Number of files that are open.
@item @code{Open_streams} @tab Number of streams that are open (used mainly for logging).
@item @code{Opened_tables} @tab Number of tables that have been opened.
@item @code{Select_full_join} @tab Number of joins without keys (Should be 0).
@item @code{Select_full_join} @tab Number of joins without keys (If this is 0, you should carefully check the index of your tables).
@item @code{Select_full_range_join} @tab Number of joins where we used a range search on reference table.
@item @code{Select_range} @tab Number of joins where we used ranges on the first table. (It's normally not critical even if this is big.)
@item @code{Select_scan} @tab Number of joins where we scanned the first table.
@item @code{Select_range_check} @tab Number of joins without keys where we check for key usage after each row (Should be 0).
@item @code{Select_scan} @tab Number of joins where we did a full scann of the first table.
@item @code{Select_range_check} @tab Number of joins without keys where we check for key usage after each row (If this is 0, you should carefully check the index of your tables).
@item @code{Questions} @tab Number of queries sent to the server.
@item @code{Slave_open_temp_tables} @tab Number of temporary tables currently
open by the slave thread
@item @code{Slow_launch_threads} @tab Number of threads that have taken more than @code{slow_launch_time} to connect.
@item @code{Slow_launch_threads} @tab Number of threads that have taken more than @code{slow_launch_time} to create.
@item @code{Slow_queries} @tab Number of queries that have taken more than @code{long_query_time}. @xref{Slow query log}.
@item @code{Sort_merge_passes} @tab Number of merges the sort has to do. If this value is large you should consider increasing @code{sort_buffer}.
@item @code{Sort_merge_passes} @tab Number of merges passes the sort algoritm have had to do. If this value is large you should consider increasing @code{sort_buffer}.
@item @code{Sort_range} @tab Number of sorts that where done with ranges.
@item @code{Sort_rows}  @tab Number of sorted rows.
@item @code{Sort_scan}  @tab Number of sorts that where done by scanning the table.
@@ -19712,8 +19712,8 @@ Some comments about the above:
If @code{Opened_tables} is big, then your @code{table_cache}
variable is probably too small.
@item
If @code{key_reads} is big, then your @code{key_cache} is probably too
small.  The cache hit rate can be calculated with
If @code{key_reads} is big, then your @code{key_buffer_size} variable is
probably too small.  The cache hit rate can be calculated with
@code{key_reads}/@code{key_read_requests}.
@item
If @code{Handler_read_rnd} is big, then you probably have a lot of
@@ -46916,6 +46916,15 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.51
@itemize @bullet
@item
Changed name of variables @code{Com_show_master_stat} to
@code{Com_show_master_status} and @code{Com_show_slave_stat} to
@code{Com_show_slave_status}.
@item
Changed handling of @code{gethostbyname()} to make the client library
threadsafe even if @code{gethostbyname_r} doesn't exists.
@item
Fixed core-dump problem when giving a wrong password string to @code{GRANT}.
@item
Fixed bug in @code{DROP DATABASE} with symlinked directory.
@item
Fixed optimization problem with @code{DATETIME} and value outside
+36 −0
Original line number Diff line number Diff line
@@ -36,6 +36,42 @@ extern "C" {

void my_inet_ntoa(struct in_addr in, char *buf);

/*
  Handling of gethostbyname_r()
*/

#if defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
#if !defined(HPUX)
struct hostent;
#endif /* HPUX */
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)
#define GETHOSTBYNAME_BUFF_SIZE 2048
#else
#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()
#elif !defined(HAVE_GETHOSTBYNAME_R)
#define GETHOSTBYNAME_BUFF_SIZE 2048
struct hostent *my_gethostbyname_r(const char *name,
				   struct hostent *result, char *buffer,
				   int buflen, int *h_errnop);
void my_gethostbyname_r_free();
#else
#define GETHOSTBYNAME_BUFF_SIZE 2048
#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
#define my_gethostbyname_r_free()
#endif /* defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */

#ifdef	__cplusplus
}
#endif
+0 −25
Original line number Diff line number Diff line
@@ -426,31 +426,6 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
#define HAVE_PTHREAD_KILL
#endif

#if defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
#if !defined(HPUX)
struct hostent;
#endif /* HPUX */
struct hostent *my_gethostbyname_r(const char *name,
				   struct hostent *result, char *buffer,
				   int buflen, int *h_errnop);
#if defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE)
#define GETHOSTBYNAME_BUFF_SIZE 2048
#else
#define GETHOSTBYNAME_BUFF_SIZE sizeof(struct hostent_data)
#endif /* defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */

#else
#ifdef 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);
#else
#define GETHOSTBYNAME_BUFF_SIZE 2048
#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
#endif /* HAVE_GETHOSTBYNAME_R_RETURN_INT */
#endif /* defined(HAVE_PTHREAD_ATTR_CREATE) || defined(_AIX) || defined(HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE) */

#endif /* defined(__WIN__) */

	/* safe_mutex adds checking to mutex for easier debugging */
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
			thr_mutex.lo mulalloc.lo string.lo default.lo \
			my_compress.lo array.lo my_once.lo list.lo my_net.lo \
                        charset.lo hash.lo mf_iocache.lo my_seek.lo \
			my_pread.lo mf_cache.lo
			my_pread.lo mf_cache.lo my_gethostbyname.lo
# Not needed in the minimum library
mysysobjects2 =		getopt.lo getopt1.lo getvar.lo my_lib.lo
mysysobjects =		$(mysysobjects1) $(mysysobjects2)
+2 −13
Original line number Diff line number Diff line
@@ -1312,7 +1312,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
      memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr));
    }
    else
#if defined(HAVE_GETHOSTBYNAME_R) && defined(_REENTRANT) && defined(THREAD)
    {
      int tmp_errno;
      struct hostent tmp_hostent,*hp;
@@ -1323,22 +1322,12 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
      {
	net->last_errno=CR_UNKNOWN_HOST;
	sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno);
	my_gethostbyname_r_free();
	goto error;
      }
      memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
      my_gethostbyname_r_free();
    }
#else
    {
      struct hostent *hp;
      if (!(hp=gethostbyname(host)))
      {
	net->last_errno=CR_UNKNOWN_HOST;
	sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, socket_errno);
	goto error;
      }
      memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length);
    }
#endif
    sock_addr.sin_port = (ushort) htons((ushort) port);
    if (connect2(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr),
		 mysql->options.connect_timeout) <0)
Loading