Merge work.mysql.com:/home/bk/mysql

into work.mysql.com:/d1/users/tim/my/work


BitKeeper/etc/logging_ok:
  auto-union
This commit is contained in:
unknown 2001-01-29 20:14:29 +01:00
commit bf1f8fd3eb
115 changed files with 1887 additions and 678 deletions

View File

@ -189,3 +189,4 @@ tmp/*
extra/resolve_stack_dump
sql/share/*.sys
BitKeeper/tmp/bkr3sAHD
BitKeeper/tmp/*

View File

@ -317,3 +317,64 @@ serg@serg.mysql.com|mysql-test/r/3.23/mrg000001.dummy.result|20001206231604|0505
serg@serg.mysql.com|mysql-test/r/3.23/mrg000001.result|20001206231609|46662|db2ef2e717ab8332
mwagner@evoq.home.mwagner.org|mysql-test/chew_on_this/select.res|20001014084759|41327|1295456b9394876
mwagner@evoq.home.mwagner.org|mysql-test/chew_on_this/select.res|20001014084759|41327|1295456b93948768
BK|sql-bench/Results-linux/ATIS-interbase-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02361|6a0a837742a861bb
BK|sql-bench/Results-linux/ATIS-interbase-Linux_2.2.14_5.0_i686|19700101030959|02348|e87091e2a6dce931
BK|sql-bench/Results-linux/ATIS-mysql-Linux_2.0.33_i586-cmp-access,mysql|19700101030959|02326|70981cb1dd58d3fb
BK|sql-bench/Results-linux/ATIS-mysql-Linux_2.0.33_i586-cmp-ms-sql,mysql,sybase|19700101030959|02327|67957b2b80839c59
BK|sql-bench/Results-linux/ATIS-mysql-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02362|20e8179c6f87930d
BK|sql-bench/Results-linux/RUN-interbase-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02365|5e446b99518aa0b1
BK|sql-bench/Results-linux/RUN-interbase-Linux_2.2.14_5.0_i686|19700101030959|02351|9a0d8be7d641fae7
BK|sql-bench/Results-linux/RUN-mysql-Linux_2.0.33_i586-cmp-access,mysql|19700101030959|02334|5f0504783180d906
BK|sql-bench/Results-linux/RUN-mysql-Linux_2.0.33_i586-cmp-ms-sql,mysql,sybase|19700101030959|02335|6abba8bd8d9f8b7b
BK|sql-bench/Results-linux/RUN-mysql-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02366|730674f4ac333638
BK|sql-bench/Results-linux/alter-table-interbase-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02367|e901749edf05bb58
BK|sql-bench/Results-linux/alter-table-interbase-Linux_2.2.14_5.0_i686|19700101030959|02352|c4e27f25a15b6681
BK|sql-bench/Results-linux/alter-table-mysql-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02368|19c95f9fc4ee458
BK|sql-bench/Results-linux/big-tables-interbase-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02371|c0c1c5efea0661ad
BK|sql-bench/Results-linux/big-tables-interbase-Linux_2.2.14_5.0_i686|19700101030959|02353|beba3adfcfd472c0
BK|sql-bench/Results-linux/big-tables-mysql-Linux_2.0.33_i586-cmp-access,mysql|19700101030959|02341|cabe523a8f103945
BK|sql-bench/Results-linux/big-tables-mysql-Linux_2.0.33_i586-cmp-ms-sql,mysql,sybase|19700101030959|02342|c682fb7ee1fb3d8
BK|sql-bench/Results-linux/big-tables-mysql-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02372|69d33d25eda85041
BK|sql-bench/Results-linux/connect-interbase-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02373|744f1e38649d21d
BK|sql-bench/Results-linux/connect-interbase-Linux_2.2.14_5.0_i686|19700101030959|02354|c28534284b9f5657
BK|sql-bench/Results-linux/connect-mysql-Linux_2.0.33_i586-cmp-access,mysql|19700101030959|02349|ebdc62367f5fcd43
BK|sql-bench/Results-linux/connect-mysql-Linux_2.0.33_i586-cmp-ms-sql,mysql,sybase|19700101030959|02350|7ed494b7cc7081c9
BK|sql-bench/Results-linux/connect-mysql-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02374|55d777517ce8091
BK|sql-bench/Results-linux/create-interbase-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02377|d60ca06157cfc9b9
BK|sql-bench/Results-linux/create-interbase-Linux_2.2.14_5.0_i686|19700101030959|02355|537da98f6c1bc6df
BK|sql-bench/Results-linux/create-mysql-Linux_2.0.33_i586-cmp-access,mysql|19700101030959|02356|612a182b889dd778
BK|sql-bench/Results-linux/create-mysql-Linux_2.0.33_i586-cmp-ms-sql,mysql,sybase|19700101030959|02357|b501391eec112dd0
BK|sql-bench/Results-linux/create-mysql-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02378|35bd48cfe30c16a3
BK|sql-bench/Results-linux/insert-interbase-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02379|25161ee7c13036c1
BK|sql-bench/Results-linux/insert-interbase-Linux_2.2.14_5.0_i686|19700101030959|02358|461a48df25628c0f
BK|sql-bench/Results-linux/insert-mysql-Linux_2.0.33_i586-cmp-access,mysql|19700101030959|02363|3260743076dbe95f
BK|sql-bench/Results-linux/insert-mysql-Linux_2.0.33_i586-cmp-ms-sql,mysql,sybase|19700101030959|02364|9de5538694cd87ea
BK|sql-bench/Results-linux/insert-mysql-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02380|7451b789c29b7dcd
BK|sql-bench/Results-linux/select-interbase-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02439|816ec12a9152b578
BK|sql-bench/Results-linux/select-interbase-Linux_2.2.14_5.0_i686|19700101030959|02359|3535cd00c2a9cb5d
BK|sql-bench/Results-linux/select-mysql-Linux_2.0.33_i586-cmp-access,mysql|19700101030959|02369|de288cd8c11e1749
BK|sql-bench/Results-linux/select-mysql-Linux_2.0.33_i586-cmp-ms-sql,mysql,sybase|19700101030959|02370|a82e759dbd5d66b
BK|sql-bench/Results-linux/select-mysql-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02440|862a7c0ef1b17f29
BK|sql-bench/Results-linux/wisconsin-interbase-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02441|cb767c1f9abc2ebd
BK|sql-bench/Results-linux/wisconsin-interbase-Linux_2.2.14_5.0_i686|19700101030959|02360|9404247a2e483b34
BK|sql-bench/Results-linux/wisconsin-mysql-Linux_2.0.33_i586-cmp-access,mysql|19700101030959|02375|8669562660b2c238
BK|sql-bench/Results-linux/wisconsin-mysql-Linux_2.0.33_i586-cmp-ms-sql,mysql,sybase|19700101030959|02376|c7cbe3b167655f9c
BK|sql-bench/Results-linux/wisconsin-mysql-Linux_2.2.14_5.0_i686-cmp-interbase,mysql|19700101030959|02442|74b238eca114dbbe
monty@donna.mysql.com|sql-bench/Results-linux/ATIS-mysql_dbug-Linux_2.2.14_my_SMP_i686|20001218140918|34755|45d7837423db243f
monty@donna.mysql.com|sql-bench/Results-linux/ATIS-mysql_dbug_full-Linux_2.2.14_my_SMP_i686|20001218140918|37262|2274651e29d38b07
monty@donna.mysql.com|sql-bench/Results-linux/RUN-mysql_dbug-Linux_2.2.14_my_SMP_i686|20001218140918|39831|a6ef8229d40b75d1
monty@donna.mysql.com|sql-bench/Results-linux/RUN-mysql_dbug_full-Linux_2.2.14_my_SMP_i686|20001218140918|42374|65ccbcd7b1c4d7b5
monty@donna.mysql.com|sql-bench/Results-linux/alter-table-mysql_dbug-Linux_2.2.14_my_SMP_i686|20001218140918|44909|de84e4a2fd07f53
monty@donna.mysql.com|sql-bench/Results-linux/alter-table-mysql_dbug_full-Linux_2.2.14_my_SMP_i686|20001218140918|47422|ee162dd1474ba9d8
monty@donna.mysql.com|sql-bench/Results-linux/big-tables-mysql_dbug-Linux_2.2.14_my_SMP_i686|20001218140918|49948|d11a751a268a4df3
monty@donna.mysql.com|sql-bench/Results-linux/big-tables-mysql_dbug_full-Linux_2.2.14_my_SMP_i686|20001218140918|52469|c13eca5ec25cd6e1
monty@donna.mysql.com|sql-bench/Results-linux/connect-mysql_dbug-Linux_2.2.14_my_SMP_i686|20001218140918|54998|dfaa50e67eb15556
monty@donna.mysql.com|sql-bench/Results-linux/connect-mysql_dbug_full-Linux_2.2.14_my_SMP_i686|20001218140918|57532|4015a2bef627d8cd
monty@donna.mysql.com|sql-bench/Results-linux/create-mysql_dbug-Linux_2.2.14_my_SMP_i686|20001218140918|60103|fa19b9a2c7a3c3c
monty@donna.mysql.com|sql-bench/Results-linux/create-mysql_dbug_full-Linux_2.2.14_my_SMP_i686|20001218140918|62710|21ec8ba1ea3ca4c4
monty@donna.mysql.com|sql-bench/Results-linux/insert-mysql_dbug-Linux_2.2.14_my_SMP_i686|20001218140918|65289|a02aceb3b30de493
monty@donna.mysql.com|sql-bench/Results-linux/insert-mysql_dbug_full-Linux_2.2.14_my_SMP_i686|20001218140918|02393|7c9baa774fc324e1
monty@donna.mysql.com|sql-bench/Results-linux/select-mysql_dbug-Linux_2.2.14_my_SMP_i686|20001218140918|05001|da73eefa16ca9383
monty@donna.mysql.com|sql-bench/Results-linux/select-mysql_dbug_full-Linux_2.2.14_my_SMP_i686|20001218140918|07610|cffd7d282a90113a
monty@donna.mysql.com|sql-bench/Results-linux/wisconsin-mysql_dbug-Linux_2.2.14_my_SMP_i686|20001218140918|10615|8dcd7271a9137341
monty@donna.mysql.com|sql-bench/Results-linux/wisconsin-mysql_dbug_full-Linux_2.2.14_my_SMP_i686|20001218140918|13213|4398328883aa75da

View File

@ -6,5 +6,6 @@ paul@central.snake.net
sasha@mysql.sashanet.com
sasha@work.mysql.com
serg@donna.mysql.com
serg@serg.mysql.com
tim@cane.mysql.fi
tim@work.mysql.com

File diff suppressed because it is too large Load Diff

View File

@ -485,14 +485,19 @@ int do_echo(struct st_query* q)
return 0;
}
int do_sync_with_master()
int do_sync_with_master(struct st_query* q)
{
MYSQL_RES* res;
MYSQL_ROW row;
MYSQL* mysql = &cur_con->mysql;
char query_buf[FN_REFLEN+128];
int offset = 0;
char* p = q->first_argument;
if(*p)
offset = atoi(p);
sprintf(query_buf, "select master_pos_wait('%s', %ld)", master_pos.file,
master_pos.pos);
master_pos.pos + offset);
if(mysql_query(mysql, query_buf))
die("At line %u: failed in %s: %d: %s", start_lineno, query_buf,
mysql_errno(mysql), mysql_error(mysql));
@ -1458,7 +1463,7 @@ int main(int argc, char** argv)
q->require_file=require_file;
save_file[0]=0;
}
error |= run_query(&cur_con->mysql, q, QUERY_SEND|QUERY_REAP);
error |= run_query(&cur_con->mysql, q, flags);
break;
}
case Q_SEND:

View File

@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
AM_INIT_AUTOMAKE(mysql, 3.23.32)
AM_INIT_AUTOMAKE(mysql, 3.23.33)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@ -129,6 +129,7 @@ fi
# Still need ranlib for readline; local static use only so no libtool.
AC_PROG_RANLIB
# We use libtool
#AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
#AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_DISABLE_FAST_INSTALL AC_DISABLE_SHARED AC_DISABLE_STATIC

35
include/my_bitmap.h Normal file
View File

@ -0,0 +1,35 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
#ifndef _my_bitmap_h_
#define _my_bitmap_h_
#define MY_BIT_NONE ~(uint)0
#ifdef __cplusplus
extern "C" {
#endif
extern void bitmap_set_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit);
extern uint bitmap_set_next(uchar *bitmap, uint bitmap_size);
extern void bitmap_clear_bit(uchar *bitmap,uint bitmap_size,uint bitmap_bit);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -41,13 +41,6 @@ extern int NEAR my_errno; /* Last error in mysys */
#include <stdarg.h>
#ifdef __EMX__
/* record loging flags (F_GETLK, F_SETLK, F_SETLKW) */
#define F_RDLCK 1 /* FreeBSD: shared or read lock */
#define F_UNLCK 2 /* FreeBSD: unlock */
#define F_WRLCK 3 /* FreeBSD: exclusive or write lock */
#endif
#define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; }
#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;}
#define MY_INIT(name); { my_progname= name; my_init(); }
@ -425,7 +418,7 @@ extern int my_printf_error _VARARGS((uint my_err, const char *format,
__attribute__ ((format (printf, 2, 4))));
extern int my_vsnprintf( char *str, size_t n,
const char *format, va_list ap );
extern int my_snprintf(char* to, size_t n, const char* fmt, ...);
extern int my_message(uint my_err, const char *str,myf MyFlags);
extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags);
extern int my_message_curses(uint my_err, const char *str,myf MyFlags);

View File

@ -198,4 +198,9 @@
#define ER_CRASHED_ON_REPAIR 1195
#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
#define ER_TRANS_CACHE_FULL 1197
#define ER_ERROR_MESSAGES 198
#define ER_SLAVE_MUST_STOP 1198
#define ER_SLAVE_NOT_RUNNING 1199
#define ER_BAD_SLAVE 1200
#define ER_MASTER_INFO 1201
#define ER_SLAVE_THREAD 1202
#define ER_ERROR_MESSAGES 203

View File

@ -27,7 +27,8 @@ extern "C" {
#include <my_list.h>
struct st_thr_lock;
extern ulong locks_immediate,locks_waited ;
enum thr_lock_type { TL_IGNORE=-1,
TL_UNLOCK, /* UNLOCK ANY LOCK */
TL_READ, /* Read lock */

View File

@ -36,7 +36,7 @@ const char *client_errors[]=
"MySQL client got out of memory",
"Wrong host info",
"Localhost via UNIX socket",
"%s via TCP/IP",
"%-.64s via TCP/IP",
"Error in server handshake",
"Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now",
@ -62,11 +62,11 @@ const char *client_errors[]=
"MySQL client run out of memory",
"Wrong host info",
"Localhost via UNIX socket",
"%s via TCP/IP",
"%-.64s via TCP/IP",
"Error in server handshake",
"Lost connection to MySQL server during query",
"Commands out of sync; You can't run this command now",
"%s via named pipe",
"%-.64s via named pipe",
"Can't wait for named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't open named pipe to host: %-.64s pipe: %-.32s (%lu)",
"Can't set state of named pipe to host: %-.64s pipe: %-.32s (%lu)",

View File

@ -1411,8 +1411,8 @@ else
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
allow_undefined_flag=unsupported
archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def'
allow_undefined_flag=" "
archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll $linkflags -o $lib $libobjs $deplibs $objdir/$libname.def'
old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
;;
@ -2036,6 +2036,7 @@ os2*)
need_lib_prefix=no
library_names_spec='$libname.dll $libname.a'
dynamic_linker='OS/2 ld.exe'
deplibs_check_method=pass_all
shlibpath_var=LIBPATH
;;

View File

@ -819,6 +819,7 @@ compiler."
old_convenience=
deplibs=
linkopts=
linkflags=
if test -n "$shlibpath_var"; then
# get the directories listed in $shlibpath_var
@ -1159,6 +1160,7 @@ compiler."
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
linkflags="$linkflags $arg"
case "$arg" in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
arg="\"$arg\""

View File

@ -62,7 +62,7 @@ int handle_locking;
{
if ((end=buff+length)[-1] == '\n')
end[-1]='\0';
if (buff[0]) /* Skipp empty lines */
if (buff[0] && buff[0] != '#') /* Skipp empty lines and comments */
{
last_isam=isam;
if (!test_if_hard_path(buff))

View File

@ -44,6 +44,7 @@ static char *rcsid = "$Id$";
#include <resolv.h>
#define NET_BUFSIZE 4096
#undef ALIGN
#define ALIGN(p, t) ((char *)(((((long)(p) - 1) / sizeof(t)) + 1) * sizeof(t)))
#define SP(p, t, n) (ALIGN(p, t) + (n) * sizeof(t))

View File

@ -44,6 +44,7 @@ static char *rcsid = "$Id$";
#include <resolv.h>
#define PROTO_BUFSIZE 4096
#undef ALIGN
#define ALIGN(p, t) ((char *)(((((long)(p) - 1) / sizeof(t)) + 1) * sizeof(t)))
#define SP(p, t, n) (ALIGN(p, t) + (n) * sizeof(t))

View File

@ -44,6 +44,7 @@ static char *rcsid = "$Id$";
#include <resolv.h>
#define HOST_BUFSIZE 4096
#undef ALIGN
#define ALIGN(p, t) ((char *)(((((long)(p) - 1) / sizeof(t)) + 1) * sizeof(t)))
#define SP(p, t, n) (ALIGN(p, t) + (n) * sizeof(t))

View File

@ -44,6 +44,7 @@ static char *rcsid = "$Id$";
#include <resolv.h>
#define SERV_BUFSIZE 4096
#undef ALIGN
#define ALIGN(p, t) ((char *)(((((long)(p) - 1) / sizeof(t)) + 1) * sizeof(t)))
#define SP(p, t, n) (ALIGN(p, t) + (n) * sizeof(t))

View File

@ -376,7 +376,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
if ((!(param->testflag & T_SILENT)))
printf ("- check data record references index: %d\n",key+1);
if (share->state.key_root[key] == HA_OFFSET_ERROR &&
info->state->records == 0)
(info->state->records == 0 || keyinfo->flag & HA_FULLTEXT))
continue;
if (!_mi_fetch_keypage(info,keyinfo,share->state.key_root[key],info->buff,
0))
@ -1462,6 +1462,8 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
reg1 MI_KEYDEF *keyinfo;
File new_file;
my_off_t index_pos[MI_MAX_POSSIBLE_KEY];
uint r_locks,w_locks;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("sort_index");
if (!(param->testflag & T_SILENT))
@ -1475,21 +1477,21 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
param->temp_filename);
DBUG_RETURN(-1);
}
if (filecopy(param, new_file,info->s->kfile,0L,
(ulong) info->s->base.keystart, "headerblock"))
if (filecopy(param, new_file,share->kfile,0L,
(ulong) share->base.keystart, "headerblock"))
goto err;
param->new_file_pos=info->s->base.keystart;
for (key= 0,keyinfo= &info->s->keyinfo[0]; key < info->s->base.keys ;
param->new_file_pos=share->base.keystart;
for (key= 0,keyinfo= &share->keyinfo[0]; key < share->base.keys ;
key++,keyinfo++)
{
if (!(((ulonglong) 1 << key) & info->s->state.key_map))
if (!(((ulonglong) 1 << key) & share->state.key_map))
continue;
if (info->s->state.key_root[key] != HA_OFFSET_ERROR)
if (share->state.key_root[key] != HA_OFFSET_ERROR)
{
index_pos[key]=param->new_file_pos; /* Write first block here */
if (sort_one_index(param,info,keyinfo,info->s->state.key_root[key],
if (sort_one_index(param,info,keyinfo,share->state.key_root[key],
new_file))
goto err;
}
@ -1498,19 +1500,24 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
}
/* Flush key cache for this file if we are calling this outside myisamchk */
flush_key_blocks(info->s->kfile, FLUSH_IGNORE_CHANGED);
flush_key_blocks(share->kfile, FLUSH_IGNORE_CHANGED);
/* Put same locks as old file */
info->s->state.version=(ulong) time((time_t*) 0);
VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
VOID(my_close(info->s->kfile,MYF(MY_WME)));
info->s->kfile = -1;
share->state.version=(ulong) time((time_t*) 0);
r_locks=share->r_locks; w_locks=share->w_locks;
share->r_locks=share->w_locks=0;
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
VOID(my_close(share->kfile,MYF(MY_WME)));
share->kfile = -1;
VOID(my_close(new_file,MYF(MY_WME)));
if (change_to_newfile(info->s->filename,MI_NAME_IEXT,INDEX_TMP_EXT,0,
if (change_to_newfile(share->filename,MI_NAME_IEXT,INDEX_TMP_EXT,0,
MYF(0)) ||
mi_open_keyfile(info->s))
mi_open_keyfile(share))
goto err2;
_mi_readinfo(info,F_WRLCK,0);
info->lock_type=F_UNLCK; /* Force mi_readinfo to lock */
_mi_readinfo(info,F_WRLCK,0); /* Will lock the table */
info->lock_type=F_WRLCK;
share->r_locks=r_locks; share->w_locks=w_locks;
info->state->key_file_length=param->new_file_pos;
info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);

View File

@ -52,8 +52,8 @@ int myrg_status(MYRG_INFO *info,register MYMERGE_INFO *x,int flag)
info->data_file_length+=file->table->s->state.state.data_file_length;
info->records+=file->table->s->state.state.records;
info->del+=file->table->s->state.state.del;
DBUG_PRINT("info2",("table: %s, offset: 0x%08lx",
file->table->filename,(ulong)file->file_offset));
DBUG_PRINT("info2",("table: %s, offset: %lu",
file->table->filename,(ulong) file->file_offset));
}
x->records = info->records;
x->deleted = info->del;

View File

@ -36,11 +36,12 @@ int mode;
int handle_locking;
{
int save_errno,i,errpos;
uint files,dir_length;
uint files,dir_length,length;
ulonglong file_offset;
char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end;
MYRG_INFO info,*m_info;
FILE *file;
File fd;
IO_CACHE file;
MI_INFO *isam,*last_isam;
DBUG_ENTER("myrg_open");
@ -49,15 +50,18 @@ int handle_locking;
isam=0;
errpos=files=0;
bzero((gptr) &info,sizeof(info));
if (!(file=my_fopen(fn_format(name_buff,name,"",MYRG_NAME_EXT,4),
O_RDONLY | O_SHARE,MYF(0))))
bzero((char*) &file,sizeof(file));
if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,4),
O_RDONLY | O_SHARE,MYF(0))) < 0 ||
init_io_cache(&file, fd, IO_SIZE, READ_CACHE, 0, 0,
MYF(MY_WME | MY_NABP)))
goto err;
errpos=1;
dir_length=dirname_part(name_buff,name);
info.reclength=0;
while (fgets(buff,FN_REFLEN-1,file))
while ((length=my_b_gets(&file,buff,FN_REFLEN-1)))
{
if ((end=strend(buff))[-1] == '\n')
if ((end=buff+length)[-1] == '\n')
end[-1]='\0';
if (buff[0] && buff[0] != '#') /* Skipp empty lines and comments */
{
@ -118,7 +122,8 @@ int handle_locking;
m_info->end_table=m_info->open_tables+files;
m_info->last_used_table=m_info->open_tables;
VOID(my_fclose(file,MYF(0)));
VOID(my_close(fd,MYF(0)));
end_io_cache(&file);
m_info->open_list.data=(void*) m_info;
pthread_mutex_lock(&THR_LOCK_open);
myrg_open_list=list_add(myrg_open_list,&m_info->open_list);
@ -132,7 +137,8 @@ err:
my_free((char*) m_info,MYF(0));
/* Fall through */
case 1:
VOID(my_fclose(file,MYF(0)));
VOID(my_close(fd,MYF(0)));
end_io_cache(&file);
for (i=files ; i-- > 0 ; )
{
isam=last_isam;

View File

@ -36,7 +36,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
int error;
MI_INFO *isam_info;
DBUG_ENTER("myrg_rrnd");
DBUG_PRINT("info",("offset: 0x%016qx", (ulonglong)filepos));
DBUG_PRINT("info",("offset: %lu", (ulong) filepos));
if (filepos == HA_OFFSET_ERROR)
{
@ -109,7 +109,7 @@ static MYRG_TABLE *find_table(MYRG_TABLE *start, MYRG_TABLE *end,
else
start=mid;
}
DBUG_PRINT("info",("offset: 0x%016qx, table: %s",
(ulonglong)pos, start->table->filename));
DBUG_PRINT("info",("offset: %lu, table: %s",
(ulong) pos, start->table->filename));
DBUG_RETURN(start);
}

View File

@ -72,6 +72,7 @@ cd ..
BASEDIR=`pwd`
cd $CWD
MYSQL_TEST_DIR=$BASEDIR/mysql-test
export MYSQL_TEST_DIR
STD_DATA=$MYSQL_TEST_DIR/std_data
hostname=`hostname` # Installed in the mysql privilege table
@ -336,6 +337,11 @@ gcov_collect () {
start_master()
{
[ x$MASTER_RUNNING = 1 ] && return
#run master initialization shell script if one exists
if [ -f "$master_init_script" ] ;
then
/bin/sh $master_init_script
fi
cd $BASEDIR # for gcov
# Remove old berkeley db log files that can confuse the server
$RM -f $MASTER_MYDDIR/log.*
@ -375,6 +381,13 @@ start_slave()
{
[ x$SKIP_SLAVE = x1 ] && return
[ x$SLAVE_RUNNING = 1 ] && return
#run slave initialization shell script if one exists
if [ -f "$slave_init_script" ] ;
then
/bin/sh $slave_init_script
fi
if [ -z "$SLAVE_MASTER_INFO" ] ; then
master_info="--master-user=root \
--master-connect-retry=1 \
@ -502,6 +515,8 @@ run_testcase ()
tname=`$BASENAME $tf .test`
master_opt_file=$TESTDIR/$tname-master.opt
slave_opt_file=$TESTDIR/$tname-slave.opt
master_init_script=$TESTDIR/$tname-master.sh
slave_init_script=$TESTDIR/$tname-slave.sh
slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt
SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0`

View File

@ -37,3 +37,7 @@ k
223
245
267
Table Op Msg_type Msg_text
test.t1 restore status OK
Table Op Msg_type Msg_text
test.t1 backup status OK

View File

@ -153,3 +153,17 @@ j_lj_t3 index id id 4 NULL 2 where used; Using index; Distinct
t3_lj index id id 8 NULL 1 where used; Using index; Distinct
id
2
a sec_to_time(sum(time_to_sec(t)))
1 00:06:15
1 00:36:30
1 00:36:30
a sec_to_time(sum(time_to_sec(t)))
1 00:06:15
1 00:36:30
a sec_to_time(sum(time_to_sec(t)))
1 00:06:15
1 00:36:30
1 00:36:30
a sec_to_time(sum(time_to_sec(t)))
1 00:06:15
1 00:36:30

View File

@ -106,4 +106,10 @@ incr othr
2 24
4 33
3 53
count(*)
10
count(*)
20
count(*)
20
a

View File

@ -1,13 +1,13 @@
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 73
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
127.0.0.1 root 9306 1 master-bin.001 73 Yes
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
127.0.0.1 root 9306 1 master-bin.001 73 No
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
127.0.0.1 root 9306 1 master-bin.001 73 Yes
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
127.0.0.1 root 9306 1 master-bin.001 173 Yes
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 1 master-bin.001 73 Yes 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 1 master-bin.001 73 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 1 master-bin.001 73 Yes 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 1 master-bin.001 173 Yes 0 0
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 73
n

View File

@ -1,13 +1,13 @@
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 73
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
0 0 0 No
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
127.0.0.1 test 3306 60 4 No
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
127.0.0.1 root 9306 60 4 No
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
127.0.0.1 root 9306 60 master-bin.001 73 Yes
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
0 0 0 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 test 3306 60 4 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 60 4 No 0 0
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 60 master-bin.001 73 Yes 0 0
n
10
45

View File

@ -1,5 +1,5 @@
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
127.0.0.1 root 9306 60 master-bin.001 216 Yes
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 60 master-bin.001 216 Yes 0 0
s
Could not break slave
Tried hard
@ -9,10 +9,17 @@ master-bin.002
master-bin.003
Log_name
master-bin.003
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db
127.0.0.1 root 9306 60 master-bin.003 128 Yes
Master_Host Master_User Master_Port Connect_retry Log_File Pos Slave_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter
127.0.0.1 root 9306 60 master-bin.003 184 Yes 0 0
m
34
65
67
123
65
1234
Log_name
master-bin.003
master-bin.004
master-bin.005
count(*)
100

View File

@ -0,0 +1,2 @@
n
24

View File

@ -0,0 +1,5 @@
Log_name
master-bin.001
master-bin.002
n
3351

View File

@ -0,0 +1,6 @@
Variable_name Value
Table_locks_immediate 0
Table_locks_waited 0
Variable_name Value
Table_locks_immediate 3
Table_locks_waited 1

Binary file not shown.

View File

@ -26,6 +26,19 @@ select n from t1;
select m from t2;
select k from t3;
drop table t1,t2,t3;
#restore table t1 from '../tmp';
#connection con2;
#lock tables t1 write;
restore table t1 from '../tmp';
connection con2;
send lock tables t1 write;
connection con1;
send backup table t1 to '../tmp';
connection con2;
reap;
unlock tables;
connection con1;
reap;

View File

@ -182,3 +182,19 @@ WHERE
((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
drop table t1,t2,t3;
#
# Test using DISTINCT on a function that contains a group function
# This also test the case when one doesn't use all fields in GROUP BY.
#
drop table if exists t1;
create table t1 (a int not null, b int not null, t time);
insert into t1 values (1,1,"00:06:15"),(1,2,"00:06:15"),(1,2,"00:30:15"),(1,3,"00:06:15"),(1,3,"00:30:15");
select a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b;
select distinct a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b;
create table t2 (a int not null primary key, b int);
insert into t2 values (1,1),(2,2),(3,3);
select t1.a,sec_to_time(sum(time_to_sec(t))) from t1 left join t2 on (t1.b=t2.a) group by t1.a,t2.b;
select distinct t1.a,sec_to_time(sum(time_to_sec(t))) from t1 left join t2 on (t1.b=t2.a) group by t1.a,t2.b;
drop table t1,t2;

View File

@ -35,7 +35,8 @@ select a from t3 order by a desc limit 300,10;
# The following should give errors
create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2);
drop table if exists t1,t2,t3,t4;
# Because of windows, it's important that we drop the merge tables first!
drop table if exists t4,t3,t1,t2;
create table t1 (c char(10)) type=myisam;
create table t2 (c char(10)) type=myisam;
@ -70,6 +71,12 @@ INSERT INTO t1 VALUES (11,20),(13,43),(15,11),(17,22),(19,37);
INSERT INTO t2 VALUES (12,25),(14,31),(16,42),(18,27),(10,30);
SELECT * from t3 where incr in (1,2,3,4) order by othr;
alter table t3 UNION=(t1);
select count(*) from t3;
alter table t3 UNION=(t1,t2);
select count(*) from t3;
alter table t3 TYPE=MYISAM;
select count(*) from t3;
drop table t3,t2,t1;
#

View File

@ -0,0 +1,4 @@
connect (con1,localhost,boo,,test,0,mysql-master.sock);
connection con1;
-- error 1064;
drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;

View File

@ -10,20 +10,26 @@ connection master1;
create temporary table t1 (n int);
insert into t1 values (4),(5);
insert into t2 select * from t1;
save_master_pos;
disconnect master;
connection slave;
#add 1 to the saved position, so we will catch drop table on disconnect
#for sure
sync_with_master 1;
connection master1;
insert into t2 values(6);
disconnect master1;
connect (master2,localhost,root,,test,0,mysql-master.sock);
connection master2;
save_master_pos;
disconnect master1;
connection slave;
sync_with_master;
#same trick - make sure we catch drop of temporary table on disconnect
sync_with_master 1;
@r/rpl000012.result select * from t2;
@r/rpl000012.status.result show status like 'Slave_open_temp_tables';
#
# Clean up
#
connect (master2,localhost,root,,test,0,mysql-master.sock);
connection master2;
drop table if exists t1,t2;
save_master_pos;

View File

@ -13,20 +13,24 @@ connection master1;
create temporary table t1 (n int);
insert into t1 values (4),(5);
insert into t2 select * from t1;
save_master_pos;
disconnect master;
connection slave;
#add 1 to catch drop table
sync_with_master 1;
connection master1;
insert into t2 values(6);
disconnect master1;
connect (master2,localhost,root,,test,0,mysql-master.sock);
connection master2;
save_master_pos;
disconnect master1;
connection slave;
sync_with_master;
# same trick to go one more event
sync_with_master 1;
@r/rpl000013.result select * from t2;
@r/rpl000013.status.result show status like 'Slave_open_temp_tables';
#
# Clean up
#
connect (master2,localhost,root,,test,0,mysql-master.sock);
connection master2;
drop table if exists t1,t2;
save_master_pos;

View File

@ -0,0 +1 @@
-O max_binlog_size=2048

View File

@ -26,10 +26,40 @@ select * from t1;
connection master;
flush logs;
drop table if exists t2;
create table t2(m int);
create table t2(m int not null primary key);
insert into t2 values (34),(67),(123);
save_master_pos;
flush logs;
show master logs;
#now lets make some duplicate key mess and see if we can recover from it
#first insert a value on the slave
connection slave;
sync_with_master;
insert into t2 values(1234);
#same value on the master
connection master;
save_master_pos;
insert into t2 values(1234);
connection slave;
sync_with_master;
#the slave may have already stopped, so we ignore the error
!slave stop;
#restart slave skipping one event
set sql_slave_skip_counter=1;
slave start;
connection master;
save_master_pos;
#let slave catch up
connection slave;
sync_with_master;
connection master;
purge master logs to 'master-bin.003';
show master logs;
insert into t2 values (65);
@ -38,6 +68,25 @@ connection slave;
sync_with_master;
show slave status;
select * from t2;
drop table if exists t1,t2;
connection master;
drop table if exists t1,t2;
let $1=100;
drop table if exists t3;
create table t3 (n int);
while ($1)
{
insert into t3 values(4);
dec $1;
}
show master logs;
save_master_pos;
connection slave;
slave stop;
slave start;
sync_with_master;
select count(*) from t3 where n = 4;
#clean up
connection master;
drop table if exists t1,t2,t3;
save_master_pos;
connection slave;
sync_with_master;

View File

@ -0,0 +1 @@
--skip-slave-start

View File

@ -0,0 +1,9 @@
cat > $MYSQL_TEST_DIR/var/slave-data/master.info <<EOF
master-bin.001
4
127.0.0.1
root
9306
1
EOF

View File

@ -0,0 +1,19 @@
connect (master,localhost,root,,test,0,mysql-master.sock);
connect (slave,localhost,root,,test,0,mysql-slave.sock);
connection master;
reset master;
connection slave;
slave start;
connection master;
drop table if exists t1;
create table t1(n int);
insert into t1 values(24);
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;

View File

@ -0,0 +1 @@
-O max_binlog_size=4096

View File

@ -0,0 +1,3 @@
rm -f $MYSQL_TEST_DIR/var/lib/master-bin.*
cp $MYSQL_TEST_DIR/std_data/master-bin.001 $MYSQL_TEST_DIR/var/lib/
echo ./master-bin.001 > $MYSQL_TEST_DIR/var/lib/master-bin.index

View File

@ -0,0 +1 @@
--skip-slave-start --abort-slave-event-count=1

View File

@ -0,0 +1,19 @@
connect (master,localhost,root,,test,0,mysql-master.sock);
connect (slave,localhost,root,,test,0,mysql-slave.sock);
connection slave;
reset slave;
slave start;
connection master;
show master logs;
drop table if exists t1;
create table t1(n int);
insert into t1 values (3351);
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
connection master;
drop table t1;
save_master_pos;
connection slave;
sync_with_master;

23
mysql-test/t/status.test Normal file
View File

@ -0,0 +1,23 @@
connect (con1,localhost,root,,test,0,mysql-master.sock);
connect (con2,localhost,root,,test,0,mysql-master.sock);
flush status;
show status like 'Table_lock%';
connection con1;
SET SQL_LOG_BIN=0;
drop table if exists t1;
create table t1(n int);
insert into t1 values(1);
connection con2;
lock tables t1 read;
unlock tables;
lock tables t1 read;
connection con1;
send update t1 set n = 3;
connection con2;
sleep 0.5;
unlock tables;
connection con1;
reap;
show status like 'Table_lock%';
drop table t1;

View File

@ -44,7 +44,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
my_quick.c my_lockmem.c my_static.c \
getopt.c getopt1.c getvar.c my_mkdir.c \
default.c my_compress.c checksum.c raid.cc my_net.c \
my_vsnprintf.c charset.c
my_vsnprintf.c charset.c my_bitmap.c
EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \
thr_mutex.c thr_rwlock.c
libmysys_a_LIBADD = @THREAD_LOBJECTS@

View File

@ -83,7 +83,7 @@ void hash_free(HASH *hash)
/* some helper functions */
static inline byte*
inline byte*
hash_key(HASH *hash,const byte *record,uint *length,my_bool first)
{
if (hash->get_key)
@ -180,7 +180,7 @@ uint calc_hashnr_caseup(const byte *key, uint len)
#endif
static inline uint rec_hashnr(HASH *hash,const byte *record)
inline uint rec_hashnr(HASH *hash,const byte *record)
{
uint length;
byte *key=hash_key(hash,record,&length,0);

View File

@ -40,7 +40,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
myf MyFlags __attribute__((unused)))
{
File file= -1;
DBUG_ENTER("open_temp_file");
DBUG_ENTER("create_temp_file");
#if defined(_MSC_VER)
{
char temp[FN_REFLEN],*end,*res,**old_env,*temp_env[1];

60
mysys/my_bitmap.c Normal file
View File

@ -0,0 +1,60 @@
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA */
/*
Handling of uchar arrays as large bitmaps.
*/
#include "mysys_priv.h"
#include <my_bitmap.h>
pthread_mutex_t LOCK_bitmap;
void bitmap_set_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit) {
if((bitmap_bit != MY_BIT_NONE) && (bitmap_bit < bitmap_size*8)) {
pthread_mutex_lock(&LOCK_bitmap);
bitmap[bitmap_bit / 8] |= (1 << bitmap_bit % 8);
pthread_mutex_unlock(&LOCK_bitmap);
};
};
uint bitmap_set_next(uchar *bitmap, uint bitmap_size) {
uint bit_found = MY_BIT_NONE;
int i, b;
pthread_mutex_lock(&LOCK_bitmap);
for(i=0; (i<bitmap_size) && (bit_found==MY_BIT_NONE); i++) {
if(bitmap[i] == 0xff) continue;
for(b=0; (b<8) && (bit_found==MY_BIT_NONE); b++)
if((bitmap[i] & 1<<b) == 0) {
bit_found = (i*8)+b;
bitmap[i] |= 1<<b;
};
};
pthread_mutex_unlock(&LOCK_bitmap);
return bit_found;
};
void bitmap_clear_bit(uchar *bitmap, uint bitmap_size, uint bitmap_bit) {
if((bitmap_bit != MY_BIT_NONE) && (bitmap_bit < bitmap_size*8)) {
pthread_mutex_lock(&LOCK_bitmap);
bitmap[bitmap_bit / 8] &= ~(1 << bitmap_bit % 8);
pthread_mutex_unlock(&LOCK_bitmap);
};
};

View File

@ -29,6 +29,10 @@
#include <direct.h>
#endif
#ifdef __EMX__
// chdir2 support also drive change
#define chdir _chdir2
#endif
/* Gets current working directory in buff. Directory is allways ended
with FN_LIBCHAR */

View File

@ -48,6 +48,7 @@ static my_bool win32_init_tcp_ip();
static my_bool my_init_done=0;
static ulong atoi_octal(const char *str)
{
long int tmp;
@ -76,6 +77,7 @@ void my_init(void)
#ifndef __WIN__
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
#endif
pthread_mutex_init(&LOCK_bitmap, NULL);
#endif
{
DBUG_ENTER("my_init");
@ -127,7 +129,12 @@ void my_end(int infoflag)
#ifdef HAVE_GETRUSAGE
struct rusage rus;
if (!getrusage(RUSAGE_SELF, &rus))
fprintf(info_file,"\nUser time %.2f, System time %.2f\nMaximum resident set size %ld, Integral resident set size %ld\nNon physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\nBlocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\nVouluntary context switches %ld, Invouluntary context switches %ld\n",
fprintf(info_file,"\n\
User time %.2f, System time %.2f\n\
Maximum resident set size %ld, Integral resident set size %ld\n\
Non-physical pagefaults %ld, Physical pagefaults %ld, Swaps %ld\n\
Blocks in %ld out %ld, Messages in %ld out %ld, Signals %ld\n\
Voluntary context switches %ld, Involuntary context switches %ld\n",
(rus.ru_utime.tv_sec * SCALE_SEC +
rus.ru_utime.tv_usec / SCALE_USEC) / 100.0,
(rus.ru_stime.tv_sec * SCALE_SEC +
@ -159,6 +166,7 @@ void my_end(int infoflag)
pthread_mutex_destroy(&THR_LOCK_keycache);
pthread_mutex_destroy(&THR_LOCK_malloc);
pthread_mutex_destroy(&THR_LOCK_open);
pthread_mutex_destroy(&LOCK_bitmap);
DBUG_POP(); /* Must be done before my_thread_end */
my_thread_end();
my_thread_global_end();

View File

@ -21,6 +21,13 @@
#include <stdarg.h>
#include <m_ctype.h>
int my_snprintf(char* to, size_t n, const char* fmt, ...)
{
va_list args;
va_start(args,fmt);
return my_vsnprintf(to, n, fmt, args);
}
int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
{
char *start=to, *end=to+n-1;

View File

@ -25,6 +25,7 @@
#ifdef THREAD
extern pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,THR_LOCK_keycache,
THR_LOCK_lock,THR_LOCK_isam,THR_LOCK_net,THR_LOCK_charset;
extern pthread_mutex_t LOCK_bitmap;
#else /* THREAD */
#define pthread_mutex_lock(A)
#define pthread_mutex_unlock(A)

View File

@ -83,7 +83,7 @@ multiple read locks.
#include <errno.h>
my_bool thr_lock_inited=0;
ulong locks_immediate = 0L, locks_waited = 0L;
/* The following constants are only for debug output */
#define MAX_THREADS 100
@ -387,6 +387,7 @@ static my_bool wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
else
{
result=0;
statistic_increment(locks_waited, &THR_LOCK_lock);
if (data->lock->get_status)
(*data->lock->get_status)(data->status_param);
check_locks(data->lock,"got wait_for_lock",0);
@ -447,6 +448,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
check_locks(lock,"read lock with old write lock",0);
if (lock->get_status)
(*lock->get_status)(data->status_param);
++locks_immediate;
goto end;
}
if (lock->write.data->type == TL_WRITE_ONLY)
@ -470,6 +472,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
if ((int) lock_type == (int) TL_READ_NO_INSERT)
lock->read_no_write_count++;
check_locks(lock,"read lock with no write locks",0);
++locks_immediate;
goto end;
}
/* Can't get lock yet; Wait for it */
@ -501,6 +504,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
data->cond=get_cond();
if (lock->get_status)
(*lock->get_status)(data->status_param);
++locks_immediate;
goto end;
}
}
@ -535,6 +539,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
check_locks(lock,"second write lock",0);
if (data->lock->get_status)
(*data->lock->get_status)(data->status_param);
++locks_immediate;
goto end;
}
DBUG_PRINT("lock",("write locked by thread: %ld",
@ -560,6 +565,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
if (data->lock->get_status)
(*data->lock->get_status)(data->status_param);
check_locks(lock,"only write lock",0);
++locks_immediate;
goto end;
}
}

View File

@ -38,7 +38,7 @@
# as such, and clarify ones such as "mediumint" with comments such as
# "3-byte int" or "same as xxx".
$version="1.54";
$version="1.55";
use DBI;
use Getopt::Long;
@ -1315,7 +1315,7 @@ report("default value for column",'create_default',
"drop table crash_q $drop_attr");
report("default value function for column",'create_default_func',
"create table crash_q (q integer not null,q1 integer default (1+1)",
"create table crash_q (q integer not null,q1 integer default (1+1))",
"drop table crash_q $drop_attr");
report("temporary tables",'temporary_table',
@ -1696,7 +1696,7 @@ if (!report("drop table with cascade/restrict","drop_restrict",
report("-- as comment (ANSI)","comment_--",
"select * from crash_me -- Testing of comments");
report("// as comment (ANSI)","comment_//",
report("// as comment","comment_//",
"select * from crash_me // Testing of comments");
report("# as comment","comment_#",
"select * from crash_me # Testing of comments");

View File

@ -4710,13 +4710,13 @@ create_field::create_field(Field *old_field,Field *orig_field)
orig_field)
{
char buff[MAX_FIELD_WIDTH],*pos;
String tmp(buff,sizeof(buff)),*res;
String tmp(buff,sizeof(buff));
/* Get the value from record[2] (the default value row) */
my_ptrdiff_t diff= (my_ptrdiff_t) (orig_field->table->rec_buff_length*2);
orig_field->move_field(diff); // Points now at record[2]
bool is_null=orig_field->is_real_null();
res=orig_field->val_str(&tmp,&tmp);
orig_field->val_str(&tmp,&tmp);
orig_field->move_field(-diff); // Back to record[0]
if (!is_null)
{

View File

@ -28,6 +28,7 @@
class Send_field;
struct st_cache_field;
void field_conv(Field *to,Field *from);
class Field {
Field(const Item &); /* Prevent use of theese */

View File

@ -472,8 +472,8 @@ int main(int argc,char **argv)
int error;
MY_INIT(argv[0]);
start_value=4424889L; best_t1=3207460L; best_t2=481534L; best_type=0; /* mode=4451 add=8 type: 0 */
if (get_options(argc,(char **) argv))
start_value=5315771L; best_t1=6916833L; best_t2=3813748L; best_type=3; /* mode=5839 add=5 type: 0 */
if (get_options(argc,(char **) argv))
exit(1);
make_max_length_table();

View File

@ -110,8 +110,6 @@ static void berkeley_noticecall(DB_ENV *db_env, db_notices notice);
bool berkeley_init(void)
{
char buff[1024],*config[10], **conf_pos, *str_pos;
conf_pos=config; str_pos=buff;
DBUG_ENTER("berkeley_init");
if (!berkeley_tmpdir)
@ -247,9 +245,9 @@ int berkeley_show_logs(THD *thd)
my_pthread_setspecific_ptr(THR_MALLOC,&show_logs_root);
if ((error= log_archive(db_env, &all_logs, DB_ARCH_ABS | DB_ARCH_LOG,
(void* (*)(unsigned int)) sql_alloc)) ||
(void* (*)(size_t)) sql_alloc)) ||
(error= log_archive(db_env, &free_logs, DB_ARCH_ABS,
(void* (*)(unsigned int)) sql_alloc)))
(void* (*)(size_t)) sql_alloc)))
{
DBUG_PRINT("error", ("log_archive failed (error %d)", error));
db_env->err(db_env, error, "log_archive: DB_ARCH_ABS");
@ -387,6 +385,7 @@ berkeley_cmp_packed_key(DB *file, const DBT *new_key, const DBT *saved_key)
/* The following is not yet used; Should be used for fixed length keys */
#ifdef NOT_YET
static int
berkeley_cmp_fix_length_key(DB *file, const DBT *new_key, const DBT *saved_key)
{
@ -407,7 +406,7 @@ berkeley_cmp_fix_length_key(DB *file, const DBT *new_key, const DBT *saved_key)
}
return key->handler.bdb_return_if_eq;
}
#endif
/* Compare key against row */
@ -1901,7 +1900,6 @@ longlong ha_berkeley::get_auto_increment()
{
DBT row,old_key;
bzero((char*) &row,sizeof(row));
uint key_len;
KEY *key_info= &table->key_info[active_index];
/* Reading next available number for a sub key */
@ -1947,6 +1945,7 @@ longlong ha_berkeley::get_auto_increment()
Analyzing, checking, and optimizing tables
****************************************************************************/
#ifdef NOT_YET
static void print_msg(THD *thd, const char *table_name, const char *op_name,
const char *msg_type, const char *fmt, ...)
{
@ -1970,7 +1969,7 @@ static void print_msg(THD *thd, const char *table_name, const char *op_name,
thd->packet.length()))
thd->killed=1;
}
#endif
int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
{
@ -2025,14 +2024,14 @@ int ha_berkeley::optimize(THD* thd, HA_CHECK_OPT* check_opt)
int ha_berkeley::check(THD* thd, HA_CHECK_OPT* check_opt)
{
char name_buff[FN_REFLEN];
int error;
DB *tmp_file;
DBUG_ENTER("ha_berkeley::check");
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
#ifdef NOT_YET
char name_buff[FN_REFLEN];
int error;
DB *tmp_file;
/*
To get this to work we need to ensure that no running transaction is
using the table. We also need to create a new environment without
@ -2242,7 +2241,6 @@ void ha_berkeley::get_status()
static int write_status(DB *status_block, char *buff, uint length)
{
DB_TXN *trans;
DBT row,key;
int error;
const char *key_buff="status";
@ -2285,7 +2283,6 @@ static void update_status(BDB_SHARE *share, TABLE *table)
}
{
char rec_buff[4+MAX_KEY*4], *pos=rec_buff;
const char *key_buff="status";
int4store(pos,share->rows); pos+=4;
for (uint i=0 ; i < table->keys ; i++)
{

View File

@ -64,7 +64,7 @@ class ha_berkeley: public handler
ulong max_row_length(const byte *buf);
int pack_row(DBT *row,const byte *record, bool new_row);
void unpack_row(char *record, DBT *row);
void ha_berkeley::unpack_key(char *record, DBT *key, uint index);
void unpack_key(char *record, DBT *key, uint index);
DBT *create_key(DBT *key, uint keynr, char *buff, const byte *record,
int key_length = MAX_KEY_LENGTH);
DBT *pack_key(DBT *key, uint keynr, char *buff, const byte *key_ptr,
@ -156,13 +156,12 @@ class ha_berkeley: public handler
void get_status();
inline void get_auto_primary_key(byte *to)
{
ulonglong tmp;
pthread_mutex_lock(&share->mutex);
share->auto_ident++;
int5store(to,share->auto_ident);
pthread_mutex_unlock(&share->mutex);
}
longlong ha_berkeley::get_auto_increment();
longlong get_auto_increment();
};
extern bool berkeley_skip, berkeley_shared_data;

View File

@ -177,6 +177,7 @@ void ha_myisammrg::info(uint flag)
errkey = info.errkey;
table->keys_in_use=(((key_map) 1) << table->keys)- (key_map) 1;
table->db_options_in_use = info.options;
table->is_view=1;
mean_rec_length=info.reclength;
block_size=0;
update_time=0;

View File

@ -48,6 +48,7 @@ public:
};
static hash_filo *hostname_cache;
static pthread_mutex_t LOCK_hostname;
void hostname_cache_refresh()
{
@ -56,6 +57,7 @@ void hostname_cache_refresh()
bool hostname_cache_init()
{
(void) pthread_mutex_init(&LOCK_hostname,NULL);
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE,offsetof(host_entry,ip),
sizeof(struct in_addr),NULL,
(void (*)(void*)) free)))
@ -66,6 +68,7 @@ bool hostname_cache_init()
void hostname_cache_free()
{
(void) pthread_mutex_destroy(&LOCK_hostname);
delete hostname_cache;
}
@ -97,7 +100,7 @@ static void add_hostname(struct in_addr *in,const char *name)
}
static inline void add_wrong_ip(struct in_addr *in)
inline void add_wrong_ip(struct in_addr *in)
{
add_hostname(in,NullS);
}
@ -180,26 +183,26 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
DBUG_RETURN(0); // out of memory
#else
VOID(pthread_mutex_lock(&hostname_cache->lock));
VOID(pthread_mutex_lock(&LOCK_hostname));
if (!(hp=gethostbyaddr((char*) in,sizeof(*in), AF_INET)))
{
VOID(pthread_mutex_unlock(&hostname_cache->lock));
VOID(pthread_mutex_unlock(&LOCK_hostname));
DBUG_PRINT("error",("gethostbyaddr returned %d",errno));
goto err;
}
if (!hp->h_name[0]) // Don't allow empty hostnames
{
VOID(pthread_mutex_unlock(&hostname_cache->lock));
VOID(pthread_mutex_unlock(&LOCK_hostname));
DBUG_PRINT("error",("Got an empty hostname"));
goto err;
}
if (!(name=my_strdup(hp->h_name,MYF(0))))
{
VOID(pthread_mutex_unlock(&hostname_cache->lock));
VOID(pthread_mutex_unlock(&LOCK_hostname));
DBUG_RETURN(0); // out of memory
}
check=gethostbyname(name);
VOID(pthread_mutex_unlock(&hostname_cache->lock));
VOID(pthread_mutex_unlock(&LOCK_hostname));
if (!check)
{
DBUG_PRINT("error",("gethostbyname returned %d",errno));

View File

@ -471,7 +471,7 @@ bool Item_real::save_in_field(Field *field)
** In number context this is a longlong value.
****************************************************************************/
static inline uint char_val(char X)
inline uint char_val(char X)
{
return (uint) (X >= '0' && X <= '9' ? X-'0' :
X >= 'A' && X <= 'Z' ? X-'A'+10 :

View File

@ -811,7 +811,7 @@ bool Item_sum_count_distinct::setup(THD *thd)
for (uint i=0; i < arg_count ; i++)
if (list.push_back(args[i]))
return 1;
count_field_types(tmp_table_param,list);
count_field_types(tmp_table_param,list,0);
if (table)
{
free_tmp_table(thd, table);

View File

@ -166,6 +166,8 @@ class Item_sum_count_distinct :public Item_sum_int
/* Item to get the value of a stored sum function */
class Item_sum_avg;
class Item_avg_field :public Item_result_field
{
public:
@ -200,6 +202,7 @@ class Item_sum_avg :public Item_sum_num
const char *func_name() const { return "avg"; }
};
class Item_sum_std;
class Item_std_field :public Item_result_field
{

View File

@ -283,6 +283,7 @@ static SYMBOL symbols[] = {
{ "SQL_QUOTE_SHOW_CREATE",SYM(SQL_QUOTE_SHOW_CREATE), 0, 0},
{ "SQL_SAFE_UPDATES", SYM(SQL_SAFE_UPDATES),0,0},
{ "SQL_SELECT_LIMIT", SYM(SQL_SELECT_LIMIT),0,0},
{ "SQL_SLAVE_SKIP_COUNTER", SYM(SQL_SLAVE_SKIP_COUNTER),0,0},
{ "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT),0,0},
{ "SQL_WARNINGS", SYM(SQL_WARNINGS),0,0},
{ "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0},

View File

@ -18,6 +18,10 @@
/* logging of commands */
/* TODO: Abort logging when we get an error in reading or writing log files */
#ifdef __EMX__
#include <io.h>
#endif
#include "mysql_priv.h"
#include "sql_acl.h"
#include "sql_repl.h"
@ -28,6 +32,7 @@
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
extern I_List<i_string> binlog_do_db, binlog_ignore_db;
extern ulong max_binlog_size;
static bool test_if_number(const char *str,
long *res, bool allow_wildcards);
@ -609,6 +614,8 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
{
/* In most cases this is only called if 'is_open()' is true */
bool error=0;
bool should_rotate = 0;
if (!inited) // Can't use mutex if not init
return 0;
VOID(pthread_mutex_lock(&LOCK_log));
@ -655,7 +662,7 @@ bool MYSQL_LOG::write(Query_log_event* event_info)
file == &log_file && flush_io_cache(file))
goto err;
error=0;
should_rotate = (file == &log_file && my_b_tell(file) >= max_binlog_size);
err:
if (error)
{
@ -669,6 +676,8 @@ err:
VOID(pthread_cond_broadcast(&COND_binlog_update));
}
VOID(pthread_mutex_unlock(&LOCK_log));
if(should_rotate)
new_file();
return error;
}
@ -682,6 +691,7 @@ bool MYSQL_LOG::write(IO_CACHE *cache)
{
VOID(pthread_mutex_lock(&LOCK_log));
bool error=1;
if (is_open())
{
uint length;
@ -722,7 +732,8 @@ err:
else
VOID(pthread_cond_broadcast(&COND_binlog_update));
VOID(pthread_mutex_unlock(&LOCK_log));
VOID(pthread_mutex_unlock(&LOCK_log));
return error;
}
@ -730,6 +741,8 @@ err:
bool MYSQL_LOG::write(Load_log_event* event_info)
{
bool error=0;
bool should_rotate = 0;
if (inited)
{
VOID(pthread_mutex_lock(&LOCK_log));
@ -745,11 +758,16 @@ bool MYSQL_LOG::write(Load_log_event* event_info)
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
error=write_error=1;
}
should_rotate = (my_b_tell(&log_file) >= max_binlog_size);
VOID(pthread_cond_broadcast(&COND_binlog_update));
}
}
VOID(pthread_mutex_unlock(&LOCK_log));
}
if(should_rotate)
new_file();
return error;
}

View File

@ -18,6 +18,10 @@
#ifndef _LOG_EVENT_H
#define _LOG_EVENT_H
#ifdef __EMX__
#undef write // remove pthread.h macro definition, conflict with write() class member
#endif
#if defined(__GNUC__) && !defined(MYSQL_CLIENT)
#pragma interface /* gcc class implementation */
#endif

View File

@ -73,6 +73,7 @@ void kill_one_thread(THD *thd, ulong id);
#ifndef MYSQLD_NET_RETRY_COUNT
#define MYSQLD_NET_RETRY_COUNT 10 // Abort read after this many int.
#endif
#define TEMP_POOL_SIZE 128
/* The following parameters is to decide when to use an extra cache to
optimise seeks when reading a big table in sorted order */
#define MIN_FILE_LENGTH_TO_USE_ROW_CACHE (16L*1024*1024)
@ -507,7 +508,8 @@ extern ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count,
ha_read_key_count, ha_read_next_count, ha_read_prev_count,
ha_read_first_count, ha_read_last_count,
ha_read_rnd_count, ha_read_rnd_next_count;
extern uchar temp_pool[TEMP_POOL_SIZE];
extern bool use_temp_pool;
extern char f_fyllchar;
extern uchar *days_in_month;
extern DATE_FORMAT dayord;

View File

@ -238,7 +238,7 @@ ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
query_buff_size, lower_case_table_names, mysqld_net_retry_count,
net_interactive_timeout, slow_launch_time = 2L,
net_read_timeout,net_write_timeout,slave_open_temp_tables=0,
open_files_limit=0;
open_files_limit=0, max_binlog_size;
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
volatile ulong cached_thread_count=0;
@ -287,6 +287,9 @@ I_List<THD> threads,thread_cache;
time_t start_time;
uchar temp_pool[TEMP_POOL_SIZE];
bool use_temp_pool;
pthread_key(MEM_ROOT*,THR_MALLOC);
pthread_key(THD*, THR_THD);
pthread_key(NET*, THR_NET);
@ -1048,7 +1051,6 @@ static void init_signals(void)
#elif defined(__EMX__)
static void sig_reload(int signo)
{
//reload_acl_and_cache(~0); // Flush everything
reload_acl_and_cache((THD*) 0,~0, (TABLE_LIST*) 0); // Flush everything
signal(signo, SIG_ACK);
}
@ -1078,8 +1080,30 @@ static void init_signals(void)
#ifdef HAVE_LINUXTHREADS
static sig_handler write_core(int sig);
#ifdef __i386__
#define SIGRETURN_FRAME_COUNT 1
#define PTR_SANE(p) ((char*)p >= heap_start && (char*)p <= heap_end)
extern char* __bss_start;
static char* heap_start, *heap_end;
inline static __volatile__ void print_str(const char* name,
const char* val, int max_len)
{
fprintf(stderr, "%s at %p ", name, val);
if(!PTR_SANE(val))
{
fprintf(stderr, " is invalid pointer\n");
return;
}
fprintf(stderr, "= ");
for(; max_len && PTR_SANE(val) && *val; --max_len)
fputc(*val++, stderr);
fputc('\n', stderr);
}
inline static __volatile__ void trace_stack()
{
uchar **stack_bottom;
@ -1136,7 +1160,18 @@ New value of ebp failed sanity check terminating backtrace\n");
++frame_count;
}
fprintf(stderr, "stack trace successful\n");
fprintf(stderr, "stack trace successful, now will try to get some\n\
variables. Some pointers may be invalid and cause dump abort\n");
heap_start = __bss_start;
heap_end = (char*)sbrk(0);
print_str("thd->query", thd->query, 1024);
fprintf(stderr, "thd->thread_id = %ld\n", thd->thread_id);
fprintf(stderr, "successfully dumped variables, if you ran with --log\n \
take a look at the details of what thread %ld did to cause the crash.\n\
In some cases of really bad corruption, this value can be invalid \n",
thd->thread_id);
fprintf(stderr, "Please use the information above to create a repeatable\n\
test case for the crash, and send it to bugs@lists.mysql.com\n");
}
#endif
#endif
@ -1195,6 +1230,8 @@ static void init_signals(void)
sa.sa_handler=handle_segfault;
#endif
sigaction(SIGSEGV, &sa, NULL);
sigaction(SIGBUS, &sa, NULL);
sigaction(SIGILL, &sa, NULL);
(void) sigemptyset(&set);
#ifdef THREAD_SPECIFIC_SIGPIPE
sigset(SIGPIPE,abort_thread);
@ -1498,6 +1535,9 @@ int main(int argc, char **argv)
if (!mysql_tmpdir || !mysql_tmpdir[0])
mysql_tmpdir=(char*) P_tmpdir; /* purecov: inspected */
bzero(temp_pool, TEMP_POOL_SIZE);
use_temp_pool = 0;
set_options();
#ifdef __WIN__
/* service parameters can be overwritten by options */
@ -2370,7 +2410,8 @@ enum options {
OPT_INNOBASE_LOG_GROUP_HOME_DIR,
OPT_INNOBASE_LOG_ARCH_DIR, OPT_INNOBASE_LOG_ARCHIVE,
OPT_INNOBASE_FLUSH_LOG_AT_TRX_COMMIT, OPT_SAFE_SHOW_DB,
OPT_GEMINI_SKIP
OPT_GEMINI_SKIP,
OPT_TEMP_POOL
};
static struct option long_options[] = {
@ -2501,6 +2542,7 @@ static struct option long_options[] = {
#ifdef __WIN__
{"standalone", no_argument, 0, (int) OPT_STANDALONE},
#endif
{"temp-pool", no_argument, 0, (int) OPT_TEMP_POOL},
{"tmpdir", required_argument, 0, 't'},
{"use-locking", no_argument, 0, (int) OPT_USE_LOCKING},
#ifdef USE_SYMDIR
@ -2571,6 +2613,8 @@ CHANGEABLE_VAR changeable_vars[] = {
1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024 },
{ "max_binlog_cache_size", (long*) &max_binlog_cache_size,
~0L, IO_SIZE, ~0L, 0, IO_SIZE },
{ "max_binlog_size", (long*) &max_binlog_size,
1024*1024L*1024L, 1024, 1024*1024L*1024L, 0, 1 },
{ "max_connections", (long*) &max_connections,
100, 1, 16384, 0, 1 },
{ "max_connect_errors", (long*) &max_connect_errors,
@ -2672,7 +2716,8 @@ struct show_var_st init_vars[]= {
{"low_priority_updates", (char*) &low_priority_updates, SHOW_BOOL},
{"lower_case_table_names", (char*) &lower_case_table_names, SHOW_LONG},
{"max_allowed_packet", (char*) &max_allowed_packet, SHOW_LONG},
{"max_binlog_cache_size", (char*) &max_binlog_cache_size, SHOW_LONG},
{"max_binlog_cache_size", (char*) &max_binlog_cache_size, SHOW_LONG},
{"max_binlog_size", (char*) &max_binlog_size, SHOW_LONG},
{"max_connections", (char*) &max_connections, SHOW_LONG},
{"max_connect_errors", (char*) &max_connect_errors, SHOW_LONG},
{"max_delayed_threads", (char*) &max_insert_delayed_threads, SHOW_LONG},
@ -2766,6 +2811,8 @@ struct show_var_st status_vars[]= {
{"Sort_range", (char*) &filesort_range_count, SHOW_LONG},
{"Sort_rows", (char*) &filesort_rows, SHOW_LONG},
{"Sort_scan", (char*) &filesort_scan_count, SHOW_LONG},
{"Table_locks_immediate", (char*) &locks_immediate, SHOW_LONG},
{"Table_locks_waited", (char*) &locks_waited, SHOW_LONG},
{"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_CONST},
{"Threads_created", (char*) &thread_created, SHOW_LONG_CONST},
{"Threads_connected", (char*) &thread_count, SHOW_INT_CONST},
@ -2874,6 +2921,7 @@ static void usage(void)
Don't give threads different priorities.\n\
--socket=... Socket file to use for connection\n\
-t, --tmpdir=path Path for temporary files\n\
--temp-pool Use a pool of temporary files\n\
-u, --user=user_name Run mysqld daemon as user\n\
-V, --version output version information and exit");
#ifdef __WIN__
@ -3049,6 +3097,9 @@ static void get_options(int argc,char **argv)
case 't':
mysql_tmpdir=optarg;
break;
case OPT_TEMP_POOL:
use_temp_pool=1;
break;
case 'u':
mysqld_user=optarg;
break;

View File

@ -74,7 +74,7 @@ typedef my_bool ALARM;
#define thr_alarm_in_use(A) (*(A))
#define thr_end_alarm(A)
#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C))
static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused)))
{
*A=1;
return 0;
@ -271,7 +271,7 @@ net_real_write(NET *net,const char *packet,ulong len)
int length;
char *pos,*end;
thr_alarm_t alarmed;
#if !defined(__WIN__) && !defined(__EMX__)
#if !defined(__WIN__)
ALARM alarm_buff;
#endif
uint retry_count=0;
@ -426,7 +426,7 @@ static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L)
{
my_bool interrupted = vio_should_retry(net->vio);
if (!thr_got_alarm(&alarmed) && interrupted)
if (!thr_got_alarm(alarmed) && interrupted)
{ /* Probably in MIT threads */
if (retry_count++ < RETRY_COUNT)
continue;

View File

@ -91,7 +91,7 @@ void make_scrambled_password(char *to,const char *password)
sprintf(to,"%08lx%08lx",hash_res[0],hash_res[1]);
}
static inline uint char_val(char X)
inline uint char_val(char X)
{
return (uint) (X >= '0' && X <= '9' ? X-'0' :
X >= 'A' && X <= 'Z' ? X-'A'+10 :

View File

@ -208,3 +208,8 @@
"Tabulka '%-.64s' je ozna-Bèena jako poru¹ená a poslední (automatická?) oprava se nezdaøila",-A
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -202,3 +202,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -187,7 +187,7 @@
"Got error %d during CHECKPOINT",
"Aborted connection %ld to db: '%-.64s' user: '%-.32s' host: `%-.64s' (%-.64s)",
"The handler for the table does not support binary table dump",
"Binlog closed while trying to FLUSH MASTER",
"Binlog closed, cannot RESET MASTER",
"Failed rebuilding the index of dumped table '%-.64s'",
"Error from master: '%-.64s'",
"Net error reading from master",
@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -203,3 +203,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -202,3 +202,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -201,3 +201,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -199,3 +199,8 @@
"La tabella '%-.64s' e' segnalata come rovinata e l'ultima ricostruzione (automatica?) e' fallita",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -201,3 +201,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -201,3 +201,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -201,3 +201,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -203,3 +203,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -199,3 +199,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -203,3 +203,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -179,7 +179,7 @@
"Результат содержит больше одной строки",
"Таблица этого типа обязана иметь PRIMARY KEY",
"Эта копия MySQL скомпилирована без поддержки RAID",
"You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column",
"MySQL работает в режиме защиты от дураков (safe_mode) - не могу UPDATE без WHERE с каким-небудь KEY",
"Индекс '%-.64s' не найден в таблице '%-.64s'",
"Не могу открыть таблицу",
"Данный тип таблиц не поддерживает check/repair",
@ -190,15 +190,20 @@
"Ошибка %d во время CHECKPOINT",
"Прерванное соединение %ld к базе данных: '%-.64s' пользователь: '%-.32s' хост: `%-.64s' (%-.64s)",
"Этот тип таблиц не поддерживает binary table dump",
"Binlog closed while trying to FLUSH MASTER",
"Failed rebuilding the index of dumped table '%-.64s'",
"Error from master: '%-.64s'",
"Net error reading from master",
"Net error writing to master",
"Репликационный лог закрыт, не могу сделать RESET MASTER",
"Ошибка при восстановлении индекса перекачанной таблицы '%-.64s'",
"Ошибка на мастере: '%-.64s'",
"Сетевая ошибка при чтении с мастера",
"Сетевая ошибка при писании мастеру",
"FULLTEXT индекс, соответствующий заданному списку столбцов, не найден",
"Can't execute the given command because you have active locked tables or an active transaction",
"Не могу выполнить комманду из-за активных locked таблиц или активной транзакции",
"Неизвестная системная переменная '%-.64'",
"Таблица '%-.64s' помечена как испорченная и должна быть исправлена",
"Таблица '%-.64s' помечена как испорченная и последняя попытка исправления (автоматическая?) не удалась",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"Предупреждение: некоторые нетранзакционные таблицы не подчиняются ROLLBACK",
"Многозапросная транзакция требует увеличения 'max_binlog_cache_size' - увеличте эту переменную и попробуйте еще раз",
"Эта операция невозможна с активным slave, надо SLAVE STOP",
"Эта операция невозможна с пассивным slave, надо SLAVE START",
"Этот сервер не slave, исправьте в конфигурационном файле или коммандой CHANGE MASTER TO",
"Не получилось инициализировать структуру master info, проверте persmissions на файле master.info",
"Не могу создать процесс SLAVE, проверьте системные ресурсы",

View File

@ -207,3 +207,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -200,3 +200,8 @@
"Table '%-.64s' is marked as crashed and last (automatic?) repair failed",
"Warning: Some non-transactional changed tables couldn't be rolled back",
"Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage. Increase this mysqld variable and try again',
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -199,3 +199,8 @@
"Tabell '%-.64s' är crashad och senast (automatiska?) reparation misslyckades",
"Warning: Några icke transaktionella tabeller kunde inte återställas vid ROLLBACK",
"Transaktionen krävde mera än 'max_binlog_cache_size' minne. Utöka denna mysqld variabel och försök på nytt",
"This operation cannot be performed with a running slave, run SLAVE STOP first",
"This operation requires a running slave, configure slave and do SLAVE START",
"The server is not configured as slave, fix in config file or with CHANGE MASTER TO",
"Could not initialize master info structure, check permisions on master.info",
"Could not create slave thread, check system resources",

View File

@ -34,10 +34,13 @@ DYNAMIC_ARRAY replicate_wild_do_table, replicate_wild_ignore_table;
bool do_table_inited = 0, ignore_table_inited = 0;
bool wild_do_table_inited = 0, wild_ignore_table_inited = 0;
bool table_rules_on = 0;
uint32 slave_skip_counter = 0;
static TABLE* save_temporary_tables = 0;
// when slave thread exits, we need to remember the temporary tables so we
// can re-use them on slave start
static TABLE* save_temporary_tables = 0;
static int last_slave_errno = 0;
static char last_slave_error[1024] = "";
#ifndef DBUG_OFF
int disconnect_slave_event_count = 0, abort_slave_event_count = 0;
static int events_till_disconnect = -1, events_till_abort = -1;
@ -45,8 +48,8 @@ static int stuck_count = 0;
#endif
static inline void skip_load_data_infile(NET* net);
static inline bool slave_killed(THD* thd);
inline void skip_load_data_infile(NET* net);
inline bool slave_killed(THD* thd);
static int init_slave_thread(THD* thd);
static int safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi);
static int safe_reconnect(THD* thd, MYSQL* mysql, MASTER_INFO* mi);
@ -54,7 +57,7 @@ static int safe_sleep(THD* thd, int sec);
static int request_table_dump(MYSQL* mysql, char* db, char* table);
static int create_table_from_dump(THD* thd, NET* net, const char* db,
const char* table_name);
static inline char* rewrite_db(char* db);
inline char* rewrite_db(char* db);
static void free_table_ent(TABLE_RULE_ENT* e)
{
my_free((gptr) e, MYF(0));
@ -194,12 +197,12 @@ void end_slave()
free_string_array(&replicate_wild_ignore_table);
}
static inline bool slave_killed(THD* thd)
inline bool slave_killed(THD* thd)
{
return abort_slave || abort_loop || thd->killed;
}
static inline void skip_load_data_infile(NET* net)
inline void skip_load_data_infile(NET* net)
{
(void)my_net_write(net, "\xfb/dev/null", 10);
(void)net_flush(net);
@ -207,7 +210,7 @@ static inline void skip_load_data_infile(NET* net)
send_ok(net); // the master expects it
}
static inline char* rewrite_db(char* db)
inline char* rewrite_db(char* db)
{
if(replicate_rewrite_db.is_empty() || !db) return db;
I_List_iterator<i_string_pair> it(replicate_rewrite_db);
@ -506,14 +509,14 @@ int init_master_info(MASTER_INFO* mi)
return 1;
}
if (!(length=my_b_gets(&mi->file, mi->log_file_name,
sizeof(mi->log_file_name))))
if ((length=my_b_gets(&mi->file, mi->log_file_name,
sizeof(mi->log_file_name))) < 1)
{
msg="Error reading log file name from master info file ";
goto error;
}
mi->log_file_name[length]= 0; // kill \n
mi->log_file_name[length-1]= 0; // kill \n
char buf[FN_REFLEN];
if(!my_b_gets(&mi->file, buf, sizeof(buf)))
{
@ -570,6 +573,9 @@ int show_master_info(THD* thd)
field_list.push_back(new Item_empty_string("Slave_Running", 3));
field_list.push_back(new Item_empty_string("Replicate_do_db", 20));
field_list.push_back(new Item_empty_string("Replicate_ignore_db", 20));
field_list.push_back(new Item_empty_string("Last_errno", 4));
field_list.push_back(new Item_empty_string("Last_error", 20));
field_list.push_back(new Item_empty_string("Skip_counter", 12));
if(send_fields(thd, field_list, 1))
DBUG_RETURN(-1);
@ -589,6 +595,9 @@ int show_master_info(THD* thd)
pthread_mutex_unlock(&LOCK_slave);
net_store_data(packet, &replicate_do_db);
net_store_data(packet, &replicate_ignore_db);
net_store_data(packet, (uint32)last_slave_errno);
net_store_data(packet, last_slave_error);
net_store_data(packet, slave_skip_counter);
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
DBUG_RETURN(-1);
@ -833,13 +842,14 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
if (ev)
{
int type_code = ev->get_type_code();
if (ev->server_id == ::server_id)
if (ev->server_id == ::server_id || slave_skip_counter)
{
if(type_code == LOAD_EVENT)
skip_load_data_infile(net);
mi->inc_pos(event_len);
flush_master_info(mi);
--slave_skip_counter;
delete ev;
return 0; // avoid infinite update loops
}
@ -853,6 +863,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
{
Query_log_event* qev = (Query_log_event*)ev;
int q_len = qev->q_len;
int expected_error,actual_error = 0;
init_sql_alloc(&thd->mem_root, 8192,0);
thd->db = rewrite_db((char*)qev->db);
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
@ -869,19 +880,22 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
thd->net.last_error[0] = 0;
thd->slave_proxy_id = qev->thread_id; // for temp tables
mysql_parse(thd, thd->query, q_len);
int expected_error,actual_error;
if ((expected_error = qev->error_code) !=
(actual_error = thd->net.last_errno) && expected_error)
{
sql_print_error("Slave: did not get the expected error\
running query from master - expected: '%s', got '%s'",
ER(expected_error),
actual_error ? ER(actual_error):"no error"
const char* errmsg = "Slave: did not get the expected error\
running query from master - expected: '%s', got '%s'";
sql_print_error(errmsg, ER(expected_error),
actual_error ? thd->net.last_error:"no error"
);
thd->query_error = 1;
}
else if (expected_error == actual_error)
thd->query_error = 0;
{
thd->query_error = 0;
*last_slave_error = 0;
last_slave_errno = 0;
}
}
thd->db = 0; // prevent db from being freed
thd->query = 0; // just to be sure
@ -893,6 +907,13 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
{
sql_print_error("Slave: error running query '%s' ",
qev->query);
last_slave_errno = actual_error ? actual_error : -1;
my_snprintf(last_slave_error, sizeof(last_slave_error),
"error '%s' on query '%s'",
actual_error ? thd->net.last_error :
"unexpected success or fatal error",
qev->query
);
free_root(&thd->mem_root,0);
delete ev;
return 1;
@ -1034,9 +1055,12 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
break;
case STOP_EVENT:
close_temporary_tables(thd);
mi->inc_pos(event_len);
flush_master_info(mi);
if(mi->pos > 4) // stop event should be ignored after rotate event
{
close_temporary_tables(thd);
mi->inc_pos(event_len);
flush_master_info(mi);
}
delete ev;
break;
case ROTATE_EVENT:

View File

@ -93,6 +93,11 @@ extern bool opt_log_slave_updates ;
pthread_handler_decl(handle_slave,arg);
extern bool volatile abort_loop, abort_slave;
extern bool slave_running;
extern uint32 slave_skip_counter;
// needed for problems when slave stops and
// we want to restart it skipping one or more events in the master log that
// have caused errors, and have been manually applied by DBA already
extern pthread_t slave_real_id;
extern MASTER_INFO glob_mi;
extern HASH replicate_do_table, replicate_ignore_table;

View File

@ -1287,7 +1287,7 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
static inline GRANT_COLUMN *
inline GRANT_COLUMN *
column_hash_search(GRANT_TABLE *t, const char *cname,
uint length)
{

Some files were not shown because too many files have changed in this diff Show More