Merge with MySQL 5.1.53

Open issues:
- A better fix for #57688; Igor is working on this
- Test failure in index_merge_innodb.test ; Igor promised to look at this
- Some Innodb tests fails (need to merge with latest xtradb) ; Kristian promised to look at this.
 - Failing tests: innodb_plugin.innodb_bug56143 innodb_plugin.innodb_bug56632 innodb_plugin.innodb_bug56680 innodb_plugin.innodb_bug57255 
- Werror is disabled;  Should be enabled after merge with xtradb.
This commit is contained in:
Michael Widenius 2010-11-25 00:57:34 +02:00
commit 1a6373e8e2
184 changed files with 6256 additions and 722 deletions

View file

@ -91,12 +91,11 @@ extern pthread_mutex_t LOCK_gethostbyname_r;
is finished with the structure.
*/
struct hostent *
my_gethostbyname_r(const char *name,
struct hostent *result __attribute__((unused)),
char *buffer __attribute__((unused)),
int buflen __attribute__((unused)),
int *h_errnop)
struct hostent *my_gethostbyname_r(const char *name,
struct hostent *res __attribute__((unused)),
char *buffer __attribute__((unused)),
int buflen __attribute__((unused)),
int *h_errnop)
{
struct hostent *hp;
pthread_mutex_lock(&LOCK_gethostbyname_r);

View file

@ -21,18 +21,6 @@
#ifndef MAIN
#if defined(__FreeBSD__) || defined(__linux__)
static my_bool memcpy_and_test(uchar *to, uchar *from, uint len)
{
uint i, res=1;
for (i=0; i < len; i++)
if ((*to++= *from++))
res=0;
return res;
}
#endif /* FreeBSD || linux */
#ifdef __FreeBSD__
#include <net/ethernet.h>
@ -44,10 +32,11 @@ static my_bool memcpy_and_test(uchar *to, uchar *from, uint len)
my_bool my_gethwaddr(uchar *to)
{
size_t len;
uchar *buf, *next, *end, *addr;
char *buf, *next, *end;
struct if_msghdr *ifm;
struct sockaddr_dl *sdl;
int res=1, mib[6]={CTL_NET, AF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0};
char zero_array[ETHER_ADDR_LEN] = {0};
if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
goto err;
@ -63,9 +52,9 @@ my_bool my_gethwaddr(uchar *to)
ifm = (struct if_msghdr *)next;
if (ifm->ifm_type == RTM_IFINFO)
{
sdl = (struct sockaddr_dl *)(ifm + 1);
addr=LLADDR(sdl);
res=memcpy_and_test(to, addr, ETHER_ADDR_LEN);
sdl= (struct sockaddr_dl *)(ifm + 1);
memcpy(to, LLADDR(sdl), ETHER_ADDR_LEN);
res= memcmp(to, zero_array, ETHER_ADDR_LEN) ? 0 : 1;
}
}
@ -81,8 +70,9 @@ err:
my_bool my_gethwaddr(uchar *to)
{
int fd, res=1;
int fd, res= 1;
struct ifreq ifr;
char zero_array[ETHER_ADDR_LEN] = {0};
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0)
@ -91,9 +81,13 @@ my_bool my_gethwaddr(uchar *to)
bzero(&ifr, sizeof(ifr));
strnmov(ifr.ifr_name, "eth0", sizeof(ifr.ifr_name) - 1);
do {
do
{
if (ioctl(fd, SIOCGIFHWADDR, &ifr) >= 0)
res=memcpy_and_test(to, (uchar *)&ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
{
memcpy(to, &ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
res= memcmp(to, zero_array, ETHER_ADDR_LEN) ? 0 : 1;
}
} while (res && (errno == 0 || errno == ENODEV) && ifr.ifr_name[3]++ < '6');
close(fd);

View file

@ -113,7 +113,6 @@ int my_is_symlink(const char *filename __attribute__((unused)))
#endif
}
/*
Resolve all symbolic links in path
'to' may be equal to 'filename'
@ -149,8 +148,22 @@ int my_realpath(char *to, const char *filename,
result= -1;
}
DBUG_RETURN(result);
#else
#ifdef _WIN32
int ret= GetFullPathName(filename,FN_REFLEN, to, NULL);
if (ret == 0 || ret > FN_REFLEN)
{
if (ret > FN_REFLEN)
my_errno= ENAMETOOLONG;
else
my_errno= EACCES;
if (MyFlags & MY_WME)
my_error(EE_REALPATH, MYF(0), filename, my_errno);
return -1;
}
#else
my_load_path(to, filename, NullS);
#endif
return 0;
#endif
}

View file

@ -64,7 +64,7 @@ int my_sync(File fd, myf my_flags)
/* Some file systems don't support F_FULLFSYNC and fail above: */
DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back"));
#endif
#if defined(HAVE_FDATASYNC)
#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
res= fdatasync(fd);
#elif defined(HAVE_FSYNC)
res= fsync(fd);
@ -97,6 +97,7 @@ int my_sync(File fd, myf my_flags)
static const char cur_dir_name[]= {FN_CURLIB, 0};
/*
Force directory information to disk.
@ -108,6 +109,7 @@ static const char cur_dir_name[]= {FN_CURLIB, 0};
RETURN
0 if ok, !=0 if error
*/
int my_sync_dir(const char *dir_name __attribute__((unused)),
myf my_flags __attribute__((unused)))
{
@ -138,7 +140,6 @@ int my_sync_dir(const char *dir_name __attribute__((unused)),
#endif
}
/*
Force directory information to disk.
@ -150,6 +151,7 @@ int my_sync_dir(const char *dir_name __attribute__((unused)),
RETURN
0 if ok, !=0 if error
*/
int my_sync_dir_by_file(const char *file_name __attribute__((unused)),
myf my_flags __attribute__((unused)))
{
@ -162,4 +164,3 @@ int my_sync_dir_by_file(const char *file_name __attribute__((unused)),
return 0;
#endif
}

View file

@ -527,8 +527,8 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file,
int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
struct timespec *abstime,
const char *file, uint line)
const struct timespec *abstime,
const char *file, uint line)
{
int error;
safe_mutex_t save_state;