>Description:
I am running a MySQL 4.1.14-standard server on one HP Alpha machine. It is 
configured
to act as a replication master. When I start a replication slave on a different 
HP Alpha
machine, using the same binary distribution, the slave fails. This is part of 
the slave's
error log file:

050828 13:33:30  mysqld started
050828 13:33:30 [Warning] Can't open and lock time zone table: Table 
'mysql.time_zone_leap_second' doesn't exist trying to live without them
/nfs/pathsoft/external/mysql-standard-4.1.14/bin/mysqld: ready for connections.
Version: '4.1.14-standard'  socket: 
'/nfs/arcturus1/mysql/etc/mysql.pcs3-dev.sock'  port: 14644  MySQL Community 
Edition - Standard (GPL)
050828 13:33:30 [Note] Slave SQL thread initialized, starting replication in 
log 'FIRST' at position 0, relay log 
'/nfs/arcturus1/mysql/data/pcs3-dev/relay-bin.000001' position: 4
050828 13:33:30 [ERROR] Slave I/O thread: error connecting to master '[EMAIL 
PROTECTED]:14642': Error: 'Unknown MySQL server host 'pcs3' (1)'  errno: 2005  
retry-time: 30  retries: 86400

Note the error message "Unknown MySQL server host 'pcs3' (1)". This suggests 
that the slave canor resolve the
hostname "pcs3" to an IP address, but from the same host that the slave is 
running on, I can connect to the
master with a command such as "mysql -h pcs3 -P 14642 ..."

I can successfully run a replication slave with an *identical* configuration 
file on a Linux/i686
machine, so I know that (a) my master server on host pcs3 is correctly 
configured to act as a
replication master, (b) my replication slave configuration file is correct, and 
(c) there is
nothing suspicious about my network environment such as bad a DNS or NIS lookup.

>How-To-Repeat:
This is a repeatable problem. Every time I try to start the replication slave 
on the HP Alpha,
it fails, reporting the same error message as above.
>Fix:
The error lies in the code which the server uses to perform host-to-IP lookups.
Specifically, the server calls gethostbyname_r to resolve the host name. The man
page for gethostbyname_r under OSF1 says:

NAME

  gethostbyname, gethostbyname_r - Get a network host entry by name

SYNOPSIS

  #include <netdb.h>


  struct hostent *gethostbyname(
          const char *name );

  [Tru64 UNIX]  The following function is supported in order to maintain
  backward compatibility with previous versions of the operating system.  You
  should not use it in new designs.

  int gethostbyname_r(
          const char *name,
          struct hostent *hptr,
          struct hostent_data *hdptr );

and later in the man page:

  [Tru64 UNIX]  The gethostbyname_r() function is an obsolete reentrant ver-
  sion of the gethostbyname() function.  It is supported in order to maintain
  backward compatibility with previous versions of the operating system and
  should not be used in new designs.  Note that you must zero-fill the hdptr
  structure before its first access by the gethostbyname_r() function.

The MySQL source code is *not* zero-filling the hdptr data structure, and as
a result, the function call is returning a non-zero value, which the MySQL
source code is interpreting incorrectly as a DNS lookup failure.

This error is closely related to a bug which I reported in 2002 in MySQL 
3.23.49:

  http://lists.mysql.com/bugs/11975

Monty Widenius identified the cause of the problem and fixed it in the next
release by forcing the use of gethostbyname, which is thread-safe under OSF1.
Unfortunately, the bug seems to have crept back in.

I'm afraid that I'm unable to re-build from source code to verify my hypothesis,
but I'll wager a bottle of beer that this is the problem.
>Submitter-Id:  <submitter ID>
>Originator: David Harper
>Organization:
Wellcome Trust Sanger Institute,  Hinxton,  Cambridge CB10 1SA,  England
>
>MySQL support: none
>Synopsis: Replication slave fails to start under OSF1 (Tru64)
>Severity: serious
>Priority:  medium
>Category:      mysql
>Class:         sw-bug
>Release:       mysql-4.1.14-standard (MySQL Community Edition - Standard (GPL))
>C compiler:    
>C++ compiler:  
>Environment:
HP Alpha running OSF1 (Tru64)
System: OSF1 pcs3d V5.1 2650 alpha
Machine: alpha
Some paths:  /bin/perl /bin/make /usr/local/bin/gmake /usr/local/bin/gcc /bin/cc
GCC: Reading specs from /usr/local/lib/gcc-lib/alpha-dec-osf5.1/3.0.3/specs
Configured with: ../configure 
Thread model: single
gcc version 3.0.3
Compilation info: CC='cc'  CFLAGS='-O2 -pthread -ansi_alias -ansi_args -fast 
-inline speed -speculate all'  CXX='cxx'  CXXFLAGS='-O2 -pthread -ansi_alias 
-fast -inline speed -noexceptions -nortti'  LDFLAGS=''  ASFLAGS=''
LIBC: 
lrwxrwxrwx   1 root     system        17 Mar  6  2004 /lib/libc.a -> 
../ccs/lib/libc.a
lrwxrwxrwx   1 root     system        17 Mar  6  2004 /usr/lib/libc.a -> 
../ccs/lib/libc.a
Configure command: ./configure '--prefix=/usr/local/mysql' 
'--localstatedir=/usr/local/mysql/data' '--libexecdir=/usr/local/mysql/bin' 
'--with-comment=MySQL Community Edition - Standard (GPL)' 
'--with-extra-charsets=complex' '--with-server-suffix=-standard' 
'--enable-thread-safe-client' '--enable-local-infile' 
'--with-named-thread-libs=-lpthread -lmach -lexc -lc' '--disable-shared' 
'--with-mysqld-ldflags=-all-static' '--with-readline' '--with-embedded-server' 
'--with-archive-storage-engine' '--with-innodb' 'CC=cc' 'CFLAGS=-O2 -pthread 
-ansi_alias -ansi_args -fast -inline speed -speculate all' 'CXXFLAGS=-O2 
-pthread -ansi_alias -fast -inline speed -noexceptions -nortti' 'CXX=cxx'

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to