Commit ed419a32 authored by unknown's avatar unknown

Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/Users/kent/mysql/bk/mysql-5.0

parents c07407d1 bfef85a1
...@@ -1127,3 +1127,144 @@ vio/test-ssl ...@@ -1127,3 +1127,144 @@ vio/test-ssl
vio/test-sslclient vio/test-sslclient
vio/test-sslserver vio/test-sslserver
vio/viotest-ssl vio/viotest-ssl
*.bin
*.exe
*.idb
*.lib
*.map
*.obj
*.pch
*.pdb
*.res
*.sbr
./copy_mysql_files.bat
./fix-project-files
./mysql*.ds?
./mysql.ncb
./mysql.sln
./mysql.suo
./prepare
./README.build-files
bdb/*.ds?
bdb/*.vcproj
client/*.ds?
client/*.vcproj
client/completion_hash.cpp
client/mysql.cpp
client/mysqladmin.cpp
client/mysqlbinlog.cpp
client/readline.cpp
client/sql_string.cpp
client_debug/*
client_release/*
comp_err/*.ds?
comp_err/*.vcproj
contrib/*.ds?
contrib/*.vcproj
dbug/*.ds?
dbug/*.vcproj
examples/*.ds?
examples/*.vcproj
examples/udf_example/udf_example.def
heap/*.ds?
heap/*.vcproj
innobase/*.ds?
innobase/*.vcproj
isam/*.ds?
isam/*.vcproj
isamchk/*.ds?
isamchk/*.vcproj
lib_debug/*
lib_release/*
libmysql/*.ds?
libmysql/*.vcproj
libmysql/debug/libmysql.exp
libmysql/release/libmysql.exp
libmysqld/*.ds?
libmysqld/*.vcproj
libmysqld/emb_qcache.cpp
libmysqld/lib_sql.cpp
libmysqld/sql_yacc.cpp
libmysqld/sql_yacc.h
libmysqltest/*.ds?
libmysqltest/*.vcproj
libmysqltest/mytest.c
merge/*.ds?
merge/*.vcproj
my_print_defaults/*.ds?
my_print_defaults/*.vcproj
myisam/*.ds?
myisam/*.vcproj
myisam_ftdump/*.ds?
myisam_ftdump/*.vcproj
myisamchk/*.ds?
myisamchk/*.vcproj
myisamlog/*.ds?
myisamlog/*.vcproj
myisammrg/*.ds?
myisammrg/*.vcproj
myisampack/*.ds?
myisampack/*.vcproj
mysql-test/*.ds?
mysql-test/*.vcproj
mysql-test/r/*.err
mysql-test/r/*.out
mysqlbinlog/*.ds?
mysqlbinlog/*.vcproj
mysqlcheck/*.ds?
mysqlcheck/*.vcproj
mysqldemb/*.ds?
mysqldemb/*.vcproj
mysqlserver/*.ds?
mysqlserver/*.vcproj
mysys/*.ds?
mysys/*.vcproj
mysys/my_new.cpp
mysys/raid.cpp
pack_isam/*.ds?
perror/*.ds?
perror/*.vcproj
regex/*.ds?
regex/*.vcproj
replace/*.ds?
replace/*.vcproj
server-tools/instance-manager/buffer.cpp
server-tools/instance-manager/command.cpp
server-tools/instance-manager/commands.cpp
server-tools/instance-manager/guardian.cpp
server-tools/instance-manager/instance.cpp
server-tools/instance-manager/instance_map.cpp
server-tools/instance-manager/instance_options.cpp
server-tools/instance-manager/listener.cpp
server-tools/instance-manager/log.cpp
server-tools/instance-manager/manager.cpp
server-tools/instance-manager/messages.cpp
server-tools/instance-manager/mysql_connection.cpp
server-tools/instance-manager/mysqlmanager.cpp
server-tools/instance-manager/options.cpp
server-tools/instance-manager/parse.cpp
server-tools/instance-manager/parse_output.cpp
server-tools/instance-manager/priv.cpp
server-tools/instance-manager/protocol.cpp
server-tools/instance-manager/thread_registry.cpp
server-tools/instance-manager/user_map.cpp
sql/*.cpp
sql/*.ds?
sql/*.vcproj
sql/max/*
sql/message.h
sql/message.mc
sql/message.rc
strings/*.ds?
strings/*.vcproj
test1/*
tests/*.ds?
tests/*.vcproj
thr_insert_test/*
thr_test/*
vio/*.ds?
vio/*.vcproj
vio/viotest-sslconnect.cpp
vio/viotest.cpp
zlib/*.ds?
zlib/*.vcproj
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="../include,../,../sql" AdditionalIncludeDirectories="../include,../,../sql,../strings"
PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_CONSOLE;_WINDOWS;MYSQL_SERVER" PreprocessorDefinitions="_DEBUG;SAFEMALLOC;SAFE_MUTEX;_CONSOLE;_WINDOWS;MYSQL_SERVER"
RuntimeLibrary="1" RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/mysqlbinlog.pch" PrecompiledHeaderFile=".\Debug/mysqlbinlog.pch"
......
...@@ -392,8 +392,8 @@ inline double ulonglong2double(ulonglong value) ...@@ -392,8 +392,8 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_SPATIAL 1 #define HAVE_SPATIAL 1
#define HAVE_RTREE_KEYS 1 #define HAVE_RTREE_KEYS 1
#define HAVE_OPENSSL 1 /* #undef HAVE_OPENSSL */
#define HAVE_YASSL 1 /* #undef HAVE_YASSL */
/* Define charsets you want */ /* Define charsets you want */
/* #undef HAVE_CHARSET_armscii8 */ /* #undef HAVE_CHARSET_armscii8 */
......
...@@ -553,6 +553,15 @@ typedef SOCKET_SIZE_TYPE size_socket; ...@@ -553,6 +553,15 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define O_NOFOLLOW 0 #define O_NOFOLLOW 0
#endif #endif
/* additional file share flags for win32 */
#ifdef __WIN__
#define _SH_DENYRWD 0x110 /* deny read/write mode & delete */
#define _SH_DENYWRD 0x120 /* deny write mode & delete */
#define _SH_DENYRDD 0x130 /* deny read mode & delete */
#define _SH_DENYDEL 0x140 /* deny delete only */
#endif /* __WIN__ */
/* #define USE_RECORD_LOCK */ /* #define USE_RECORD_LOCK */
/* Unsigned types supported by the compiler */ /* Unsigned types supported by the compiler */
......
...@@ -601,6 +601,7 @@ extern char *_my_strdup_with_length(const byte *from, uint length, ...@@ -601,6 +601,7 @@ extern char *_my_strdup_with_length(const byte *from, uint length,
#ifdef __WIN__ #ifdef __WIN__
extern int my_access(const char *path, int amode); extern int my_access(const char *path, int amode);
extern File my_sopen(const char *path, int oflag, int shflag, int pmode);
#else #else
#define my_access access #define my_access access
#endif #endif
......
...@@ -930,7 +930,7 @@ sub executable_setup () { ...@@ -930,7 +930,7 @@ sub executable_setup () {
} }
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck"); $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump"); $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
$exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport"); $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
$exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow"); $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
...@@ -947,6 +947,7 @@ sub executable_setup () { ...@@ -947,6 +947,7 @@ sub executable_setup () {
$path_client_bindir= mtr_path_exists("$glob_basedir/bin"); $path_client_bindir= mtr_path_exists("$glob_basedir/bin");
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck"); $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
$exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump"); $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
$exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
$exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow"); $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
$exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog"); $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin"); $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
......
...@@ -13,6 +13,7 @@ insert into mysqltest1.t1 values (1); ...@@ -13,6 +13,7 @@ insert into mysqltest1.t1 values (1);
select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt'; select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt';
create table mysqltest1.t2 (n int); create table mysqltest1.t2 (n int);
create table mysqltest1.t3 (n int); create table mysqltest1.t3 (n int);
--replace_result \\ /
--error 1010 --error 1010
drop database mysqltest1; drop database mysqltest1;
use mysqltest1; use mysqltest1;
...@@ -29,6 +30,7 @@ while ($1) ...@@ -29,6 +30,7 @@ while ($1)
} }
--enable_query_log --enable_query_log
--replace_result \\ /
--error 1010 --error 1010
drop database mysqltest1; drop database mysqltest1;
use mysqltest1; use mysqltest1;
......
...@@ -47,13 +47,16 @@ File my_create(const char *FileName, int CreateFlags, int access_flags, ...@@ -47,13 +47,16 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
#elif defined(VMS) #elif defined(VMS)
fd = open((my_string) FileName, access_flags | O_CREAT, 0, fd = open((my_string) FileName, access_flags | O_CREAT, 0,
"ctx=stm","ctx=bin"); "ctx=stm","ctx=bin");
#elif defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2) #elif defined(MSDOS) || defined(__EMX__) || defined(OS2)
if (access_flags & O_SHARE) if (access_flags & O_SHARE)
fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY, fd = sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY,
SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); SH_DENYNO, MY_S_IREAD | MY_S_IWRITE);
else else
fd = open((my_string) FileName, access_flags | O_CREAT | O_BINARY, fd = open((my_string) FileName, access_flags | O_CREAT | O_BINARY,
MY_S_IREAD | MY_S_IWRITE); MY_S_IREAD | MY_S_IWRITE);
#elif defined(__WIN__)
fd= my_sopen((my_string) FileName, access_flags | O_CREAT | O_BINARY,
SH_DENYNO, MY_S_IREAD | MY_S_IWRITE);
#else #else
fd = open(FileName, access_flags); fd = open(FileName, access_flags);
#endif #endif
......
...@@ -56,12 +56,18 @@ File my_open(const char *FileName, int Flags, myf MyFlags) ...@@ -56,12 +56,18 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
DBUG_RETURN(my_register_filename(-1, FileName, FILE_BY_OPEN, DBUG_RETURN(my_register_filename(-1, FileName, FILE_BY_OPEN,
EE_FILENOTFOUND, MyFlags)); EE_FILENOTFOUND, MyFlags));
} }
#ifndef __WIN__
if (Flags & O_SHARE) if (Flags & O_SHARE)
fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO, fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
MY_S_IREAD | MY_S_IWRITE); MY_S_IREAD | MY_S_IWRITE);
else else
fd = open((my_string) FileName, Flags | O_BINARY, fd = open((my_string) FileName, Flags | O_BINARY,
MY_S_IREAD | MY_S_IWRITE); MY_S_IREAD | MY_S_IWRITE);
#else
fd= my_sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO,
MY_S_IREAD | MY_S_IWRITE);
#endif
#elif !defined(NO_OPEN_3) #elif !defined(NO_OPEN_3)
fd = open(FileName, Flags, my_umask); /* Normal unix */ fd = open(FileName, Flags, my_umask); /* Normal unix */
#else #else
...@@ -167,3 +173,181 @@ File my_register_filename(File fd, const char *FileName, enum file_type ...@@ -167,3 +173,181 @@ File my_register_filename(File fd, const char *FileName, enum file_type
FileName, my_errno); FileName, my_errno);
return(fd); return(fd);
} }
#ifdef __WIN__
extern void __cdecl _dosmaperr(unsigned long);
/*
Open a file with sharing. Similar to _sopen() from libc, but allows managing
share delete on win32
SYNOPSIS
my_sopen()
path fully qualified file name
oflag operation flags
shflag share flag
pmode permission flags
RETURN VALUE
File descriptor of opened file if success
-1 and sets errno if fails.
*/
File my_sopen(const char *path, int oflag, int shflag, int pmode)
{
int fh; /* handle of opened file */
int mask;
HANDLE osfh; /* OS handle of opened file */
DWORD fileaccess; /* OS file access (requested) */
DWORD fileshare; /* OS file sharing mode */
DWORD filecreate; /* OS method of opening/creating */
DWORD fileattrib; /* OS file attribute flags */
SECURITY_ATTRIBUTES SecurityAttributes;
SecurityAttributes.nLength= sizeof(SecurityAttributes);
SecurityAttributes.lpSecurityDescriptor= NULL;
SecurityAttributes.bInheritHandle= !(oflag & _O_NOINHERIT);
/*
* decode the access flags
*/
switch (oflag & (_O_RDONLY | _O_WRONLY | _O_RDWR)) {
case _O_RDONLY: /* read access */
fileaccess= GENERIC_READ;
break;
case _O_WRONLY: /* write access */
fileaccess= GENERIC_WRITE;
break;
case _O_RDWR: /* read and write access */
fileaccess= GENERIC_READ | GENERIC_WRITE;
break;
default: /* error, bad oflag */
errno= EINVAL;
_doserrno= 0L; /* not an OS error */
return -1;
}
/*
* decode sharing flags
*/
switch (shflag) {
case _SH_DENYRW: /* exclusive access except delete */
fileshare= FILE_SHARE_DELETE;
break;
case _SH_DENYWR: /* share read and delete access */
fileshare= FILE_SHARE_READ | FILE_SHARE_DELETE;
break;
case _SH_DENYRD: /* share write and delete access */
fileshare= FILE_SHARE_WRITE | FILE_SHARE_DELETE;
break;
case _SH_DENYNO: /* share read, write and delete access */
fileshare= FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
break;
case _SH_DENYRWD: /* exclusive access */
fileshare= 0L;
break;
case _SH_DENYWRD: /* share read access */
fileshare= FILE_SHARE_READ;
break;
case _SH_DENYRDD: /* share write access */
fileshare= FILE_SHARE_WRITE;
break;
case _SH_DENYDEL: /* share read and write access */
fileshare= FILE_SHARE_READ | FILE_SHARE_WRITE;
break;
default: /* error, bad shflag */
errno= EINVAL;
_doserrno= 0L; /* not an OS error */
return -1;
}
/*
* decode open/create method flags
*/
switch (oflag & (_O_CREAT | _O_EXCL | _O_TRUNC)) {
case 0:
case _O_EXCL: // ignore EXCL w/o CREAT
filecreate= OPEN_EXISTING;
break;
case _O_CREAT:
filecreate= OPEN_ALWAYS;
break;
case _O_CREAT | _O_EXCL:
case _O_CREAT | _O_TRUNC | _O_EXCL:
filecreate= CREATE_NEW;
break;
case _O_TRUNC:
case _O_TRUNC | _O_EXCL: // ignore EXCL w/o CREAT
filecreate= TRUNCATE_EXISTING;
break;
case _O_CREAT | _O_TRUNC:
filecreate= CREATE_ALWAYS;
break;
default:
// this can't happen ... all cases are covered
errno= EINVAL;
_doserrno= 0L;
return -1;
}
/*
* decode file attribute flags if _O_CREAT was specified
*/
fileattrib= FILE_ATTRIBUTE_NORMAL; /* default */
if (oflag & _O_CREAT)
{
_umask((mask= _umask(0)));
if (!((pmode & ~mask) & _S_IWRITE))
fileattrib= FILE_ATTRIBUTE_READONLY;
}
/*
* Set temporary file (delete-on-close) attribute if requested.
*/
if (oflag & _O_TEMPORARY)
{
fileattrib|= FILE_FLAG_DELETE_ON_CLOSE;
fileaccess|= DELETE;
}
/*
* Set temporary file (delay-flush-to-disk) attribute if requested.
*/
if (oflag & _O_SHORT_LIVED)
fileattrib|= FILE_ATTRIBUTE_TEMPORARY;
/*
* Set sequential or random access attribute if requested.
*/
if (oflag & _O_SEQUENTIAL)
fileattrib|= FILE_FLAG_SEQUENTIAL_SCAN;
else if (oflag & _O_RANDOM)
fileattrib|= FILE_FLAG_RANDOM_ACCESS;
/*
* try to open/create the file
*/
if ((osfh= CreateFile(path, fileaccess, fileshare, &SecurityAttributes,
filecreate, fileattrib, NULL)) == (HANDLE)0xffffffff)
{
/*
* OS call to open/create file failed! map the error, release
* the lock, and return -1. note that it's not necessary to
* call _free_osfhnd (it hasn't been used yet).
*/
_dosmaperr(GetLastError()); /* map error */
return -1; /* return error to caller */
}
fh= _open_osfhandle((long)osfh, oflag & (_O_APPEND | _O_RDONLY | _O_TEXT));
return fh; /* return handle */
}
#endif /* __WIN__ */
...@@ -3009,8 +3009,8 @@ ha_innobase::store_key_val_for_row( ...@@ -3009,8 +3009,8 @@ ha_innobase::store_key_val_for_row(
if (key_part->length > 0 && cs->mbmaxlen > 1) { if (key_part->length > 0 && cs->mbmaxlen > 1) {
len = (ulint) cs->cset->well_formed_len(cs, len = (ulint) cs->cset->well_formed_len(cs,
src_start, (const char *) src_start,
src_start + key_part->length, (const char *) src_start + key_part->length,
key_part->length / cs->mbmaxlen, key_part->length / cs->mbmaxlen,
&error); &error);
} else { } else {
......
...@@ -357,8 +357,7 @@ static int find_uniq_filename(char *name) ...@@ -357,8 +357,7 @@ static int find_uniq_filename(char *name)
MYSQL_LOG::MYSQL_LOG() MYSQL_LOG::MYSQL_LOG()
:bytes_written(0), last_time(0), query_start(0), name(0), :bytes_written(0), last_time(0), query_start(0), name(0),
prepared_xids(0), log_type(LOG_CLOSED), file_id(1), open_count(1), prepared_xids(0), log_type(LOG_CLOSED), file_id(1), open_count(1),
readers_count(0), reset_pending(FALSE), write_error(FALSE), inited(FALSE), write_error(FALSE), inited(FALSE), need_start_event(TRUE),
need_start_event(TRUE),
description_event_for_exec(0), description_event_for_queue(0) description_event_for_exec(0), description_event_for_queue(0)
{ {
/* /*
...@@ -385,9 +384,7 @@ void MYSQL_LOG::cleanup() ...@@ -385,9 +384,7 @@ void MYSQL_LOG::cleanup()
delete description_event_for_exec; delete description_event_for_exec;
(void) pthread_mutex_destroy(&LOCK_log); (void) pthread_mutex_destroy(&LOCK_log);
(void) pthread_mutex_destroy(&LOCK_index); (void) pthread_mutex_destroy(&LOCK_index);
(void) pthread_mutex_destroy(&LOCK_readers);
(void) pthread_cond_destroy(&update_cond); (void) pthread_cond_destroy(&update_cond);
(void) pthread_cond_destroy(&reset_cond);
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -432,9 +429,7 @@ void MYSQL_LOG::init_pthread_objects() ...@@ -432,9 +429,7 @@ void MYSQL_LOG::init_pthread_objects()
inited= 1; inited= 1;
(void) pthread_mutex_init(&LOCK_log,MY_MUTEX_INIT_SLOW); (void) pthread_mutex_init(&LOCK_log,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW); (void) pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_readers, MY_MUTEX_INIT_SLOW);
(void) pthread_cond_init(&update_cond, 0); (void) pthread_cond_init(&update_cond, 0);
(void) pthread_cond_init(&reset_cond, 0);
} }
const char *MYSQL_LOG::generate_name(const char *log_name, const char *MYSQL_LOG::generate_name(const char *log_name,
...@@ -938,12 +933,6 @@ bool MYSQL_LOG::reset_logs(THD* thd) ...@@ -938,12 +933,6 @@ bool MYSQL_LOG::reset_logs(THD* thd)
pthread_mutex_lock(&LOCK_log); pthread_mutex_lock(&LOCK_log);
pthread_mutex_lock(&LOCK_index); pthread_mutex_lock(&LOCK_index);
/*
we need one more lock to block attempts to open a log while
we are waiting untill all log files will be closed
*/
pthread_mutex_lock(&LOCK_readers);
/* /*
The following mutex is needed to ensure that no threads call The following mutex is needed to ensure that no threads call
'delete thd' as we would then risk missing a 'rollback' from this 'delete thd' as we would then risk missing a 'rollback' from this
...@@ -966,19 +955,6 @@ bool MYSQL_LOG::reset_logs(THD* thd) ...@@ -966,19 +955,6 @@ bool MYSQL_LOG::reset_logs(THD* thd)
goto err; goto err;
} }
reset_pending= TRUE;
/*
send update signal just in case so that all reader threads waiting
for log update will leave wait condition
*/
signal_update();
/*
if there are active readers wait until all of them will
release opened files
*/
while (readers_count)
pthread_cond_wait(&reset_cond, &LOCK_log);
for (;;) for (;;)
{ {
my_delete(linfo.log_file_name, MYF(MY_WME)); my_delete(linfo.log_file_name, MYF(MY_WME));
...@@ -997,10 +973,7 @@ bool MYSQL_LOG::reset_logs(THD* thd) ...@@ -997,10 +973,7 @@ bool MYSQL_LOG::reset_logs(THD* thd)
my_free((gptr) save_name, MYF(0)); my_free((gptr) save_name, MYF(0));
err: err:
reset_pending= FALSE;
(void) pthread_mutex_unlock(&LOCK_thread_count); (void) pthread_mutex_unlock(&LOCK_thread_count);
pthread_mutex_unlock(&LOCK_readers);
pthread_mutex_unlock(&LOCK_index); pthread_mutex_unlock(&LOCK_index);
pthread_mutex_unlock(&LOCK_log); pthread_mutex_unlock(&LOCK_log);
DBUG_RETURN(error); DBUG_RETURN(error);
...@@ -2073,12 +2046,6 @@ void MYSQL_LOG::wait_for_update(THD* thd, bool is_slave) ...@@ -2073,12 +2046,6 @@ void MYSQL_LOG::wait_for_update(THD* thd, bool is_slave)
{ {
const char *old_msg; const char *old_msg;
DBUG_ENTER("wait_for_update"); DBUG_ENTER("wait_for_update");
if (reset_pending)
{
pthread_mutex_unlock(&LOCK_log);
DBUG_VOID_RETURN;
}
old_msg= thd->enter_cond(&update_cond, &LOCK_log, old_msg= thd->enter_cond(&update_cond, &LOCK_log,
is_slave ? is_slave ?
...@@ -2330,33 +2297,6 @@ void MYSQL_LOG::signal_update() ...@@ -2330,33 +2297,6 @@ void MYSQL_LOG::signal_update()
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
void MYSQL_LOG::readers_addref()
{
/*
There is no necessity for reference counting on *nix, since it allows to
delete opened files, however it is more clean way to wait
untill all files will be closed on *nix as well.
*/
DBUG_ENTER("MYSQL_LOG::reader_addref");
pthread_mutex_lock(&LOCK_log);
pthread_mutex_lock(&LOCK_readers);
readers_count++;
pthread_mutex_unlock(&LOCK_readers);
pthread_mutex_unlock(&LOCK_log);
DBUG_VOID_RETURN;
}
void MYSQL_LOG::readers_release()
{
DBUG_ENTER("MYSQL_LOG::reader_release");
pthread_mutex_lock(&LOCK_log);
readers_count--;
if (!readers_count)
pthread_cond_broadcast(&reset_cond);
pthread_mutex_unlock(&LOCK_log);
DBUG_VOID_RETURN;
}
#ifdef __NT__ #ifdef __NT__
void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
uint length, int buffLen) uint length, int buffLen)
......
...@@ -178,7 +178,9 @@ static double wkb_get_double(const char *ptr, Geometry::wkbByteOrder bo) ...@@ -178,7 +178,9 @@ static double wkb_get_double(const char *ptr, Geometry::wkbByteOrder bo)
{ {
double res; double res;
if (bo != Geometry::wkb_xdr) if (bo != Geometry::wkb_xdr)
{
float8get(res, ptr); float8get(res, ptr);
}
else else
{ {
char inv_array[8]; char inv_array[8];
......
...@@ -189,11 +189,10 @@ class MYSQL_LOG: public TC_LOG ...@@ -189,11 +189,10 @@ class MYSQL_LOG: public TC_LOG
{ {
private: private:
/* LOCK_log and LOCK_index are inited by init_pthread_objects() */ /* LOCK_log and LOCK_index are inited by init_pthread_objects() */
pthread_mutex_t LOCK_log, LOCK_index, LOCK_readers; pthread_mutex_t LOCK_log, LOCK_index;
pthread_mutex_t LOCK_prep_xids; pthread_mutex_t LOCK_prep_xids;
pthread_cond_t COND_prep_xids; pthread_cond_t COND_prep_xids;
pthread_cond_t update_cond; pthread_cond_t update_cond;
pthread_cond_t reset_cond;
ulonglong bytes_written; ulonglong bytes_written;
time_t last_time,query_start; time_t last_time,query_start;
IO_CACHE log_file; IO_CACHE log_file;
...@@ -335,9 +334,6 @@ class MYSQL_LOG: public TC_LOG ...@@ -335,9 +334,6 @@ class MYSQL_LOG: public TC_LOG
int purge_logs_before_date(time_t purge_time); int purge_logs_before_date(time_t purge_time);
int purge_first_log(struct st_relay_log_info* rli, bool included); int purge_first_log(struct st_relay_log_info* rli, bool included);
bool reset_logs(THD* thd); bool reset_logs(THD* thd);
inline bool is_reset_pending() { return reset_pending; }
void readers_addref();
void readers_release();
void close(uint exiting); void close(uint exiting);
// iterating through the log index file // iterating through the log index file
......
...@@ -372,11 +372,6 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ...@@ -372,11 +372,6 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
goto err; goto err;
} }
/*
Call readers_addref before opening log to track count
of binlog readers
*/
mysql_bin_log.readers_addref();
if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0) if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0)
{ {
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
...@@ -574,8 +569,7 @@ impossible position"; ...@@ -574,8 +569,7 @@ impossible position";
goto err; goto err;
if (!(flags & BINLOG_DUMP_NON_BLOCK) && if (!(flags & BINLOG_DUMP_NON_BLOCK) &&
mysql_bin_log.is_active(log_file_name) && mysql_bin_log.is_active(log_file_name))
!mysql_bin_log.is_reset_pending())
{ {
/* /*
Block until there is more data in the log Block until there is more data in the log
...@@ -688,13 +682,7 @@ impossible position"; ...@@ -688,13 +682,7 @@ impossible position";
else else
{ {
bool loop_breaker = 0; bool loop_breaker = 0;
// need this to break out of the for loop from switch /* need this to break out of the for loop from switch */
// if we are going to switch log file anyway, close current log first
end_io_cache(&log);
(void) my_close(file, MYF(MY_WME));
// decrease reference count of binlog readers
mysql_bin_log.readers_release();
thd->proc_info = "Finished reading one binlog; switching to next binlog"; thd->proc_info = "Finished reading one binlog; switching to next binlog";
switch (mysql_bin_log.find_next_log(&linfo, 1)) { switch (mysql_bin_log.find_next_log(&linfo, 1)) {
...@@ -704,25 +692,16 @@ impossible position"; ...@@ -704,25 +692,16 @@ impossible position";
case 0: case 0:
break; break;
default: default:
// need following call to do release on err label
mysql_bin_log.readers_addref();
errmsg = "could not find next log"; errmsg = "could not find next log";
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
goto err; goto err;
} }
if (loop_breaker) if (loop_breaker)
{ break;
// need following call to do release on end label
mysql_bin_log.readers_addref(); end_io_cache(&log);
break; (void) my_close(file, MYF(MY_WME));
}
/*
Call readers_addref before opening log to track count
of binlog readers
*/
mysql_bin_log.readers_addref();
/* /*
Call fake_rotate_event() in case the previous log (the one which Call fake_rotate_event() in case the previous log (the one which
...@@ -755,8 +734,6 @@ impossible position"; ...@@ -755,8 +734,6 @@ impossible position";
end_io_cache(&log); end_io_cache(&log);
(void)my_close(file, MYF(MY_WME)); (void)my_close(file, MYF(MY_WME));
// decrease reference count of binlog readers
mysql_bin_log.readers_release();
send_eof(thd); send_eof(thd);
thd->proc_info = "Waiting to finalize termination"; thd->proc_info = "Waiting to finalize termination";
...@@ -783,8 +760,6 @@ impossible position"; ...@@ -783,8 +760,6 @@ impossible position";
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
if (file >= 0) if (file >= 0)
(void) my_close(file, MYF(MY_WME)); (void) my_close(file, MYF(MY_WME));
// decrease reference count of binlog readers
mysql_bin_log.readers_release();
my_message(my_errno, errmsg, MYF(0)); my_message(my_errno, errmsg, MYF(0));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
...@@ -259,7 +259,6 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \ ...@@ -259,7 +259,6 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
--includedir=%{_includedir} \ --includedir=%{_includedir} \
--mandir=%{_mandir} \ --mandir=%{_mandir} \
--enable-thread-safe-client \ --enable-thread-safe-client \
--with-zlib-dir=bundled \
--with-readline ; \ --with-readline ; \
# Add this for more debugging support # Add this for more debugging support
# --with-debug # --with-debug
...@@ -362,8 +361,9 @@ BuildMySQL "--disable-shared \ ...@@ -362,8 +361,9 @@ BuildMySQL "--disable-shared \
%if %{STATIC_BUILD} %if %{STATIC_BUILD}
--with-mysqld-ldflags='-all-static' \ --with-mysqld-ldflags='-all-static' \
--with-client-ldflags='-all-static' \ --with-client-ldflags='-all-static' \
--with-zlib-dir=bundled \
$USE_OTHER_LIBC_DIR \ $USE_OTHER_LIBC_DIR \
%else
--with-zlib-dir=bundled \
%endif %endif
--with-comment=\"MySQL Community Edition - Standard (GPL)\" \ --with-comment=\"MySQL Community Edition - Standard (GPL)\" \
--with-server-suffix='%{server_suffix}' \ --with-server-suffix='%{server_suffix}' \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment