Commit 69c28050 authored by unknown's avatar unknown Committed by MySQL Build Team

Merge from mysql-5.1.50-release

parents 3ac03a0b 79095419
......@@ -90,22 +90,19 @@ SSL_LIBRARY=--with-ssl
if [ "x$warning_mode" != "xpedantic" ]; then
# Both C and C++ warnings
warnings="-Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W"
warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare"
warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label -Wunused-value -Wunused-variable"
warnings="-Wall -Wextra -Wunused -Wwrite-strings"
# For more warnings, uncomment the following line
# warnings="$global_warnings -Wshadow"
# warnings="$warnings -Wshadow"
# C warnings
c_warnings="$warnings -Wunused-parameter"
c_warnings="$warnings"
# C++ warnings
cxx_warnings="$warnings"
cxx_warnings="$warnings -Wno-unused-parameter"
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
cxx_warnings="$cxx_warnings -Wreorder"
cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor"
# Added unless --with-debug=full
debug_extra_cflags="-O0 -g3 -gdwarf-2" #1 -Wuninitialized"
debug_extra_cflags="-O0 -g3 -gdwarf-2"
else
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
c_warnings="$warnings"
......
......@@ -181,14 +181,17 @@ check_cpu () {
cc=$CC
fi
cc_ver=`$cc --version | sed 1q`
cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
set -- `echo $cc_verno | tr '.' ' '`
cc_major=$1
cc_minor=$2
cc_patch=$3
cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
# check if compiler is gcc and dump its version
cc_verno=`$cc -dumpversion 2>/dev/null`
if test "x$?" = "x0" ; then
set -- `echo $cc_verno | tr '.' ' '`
cc_ver="GCC"
cc_major=$1
cc_minor=$2
cc_patch=$3
cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
fi
case "$cc_ver--$cc_verno" in
*GCC*)
# different gcc backends (and versions) have different CPU flags
......@@ -229,7 +232,7 @@ check_cpu () {
fi
while [ "$cpu_arg" ] ; do
printf "testing $cpu_arg ... " >&2
# compile check
eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
if test "x$?" = "x0" ; then
......@@ -243,5 +246,5 @@ check_cpu () {
done
rm __test.*
}
check_cpu
......@@ -314,7 +314,7 @@ abi_check_all: $(TEST_PREPROCESSOR_HEADER)
do_abi_check:
set -ex; \
for file in $(abi_headers); do \
@CC@ -E -nostdinc -dI \
@CC@ -E -nostdinc -dI -DMYSQL_ABI_CHECK \
-I$(top_srcdir)/include \
-I$(top_srcdir)/include/mysql \
-I$(top_srcdir)/sql \
......
......@@ -93,7 +93,6 @@ extern "C" {
#endif
#endif
#undef bcmp // Fix problem with new readline
#if defined(__WIN__)
#include <conio.h>
#elif !defined(__NETWARE__)
......@@ -3640,7 +3639,7 @@ xmlencode_print(const char *src, uint length)
tee_fputs("NULL", PAGER);
else
{
for (const char *p = src; length; *p++, length--)
for (const char *p = src; length; p++, length--)
{
const char *t;
if ((t = array_value(xmlmeta, *p)))
......@@ -4727,7 +4726,7 @@ static const char* construct_prompt()
struct tm *t = localtime(&lclock);
/* parse thru the settings for the prompt */
for (char *c = current_prompt; *c ; *c++)
for (char *c = current_prompt; *c ; c++)
{
if (*c != PROMPT_CHAR)
processed_prompt.append(*c);
......
......@@ -595,7 +595,10 @@ static int upgrade_already_done(void)
my_fclose(in, MYF(0));
return (strncmp(buf, MYSQL_SERVER_VERSION,
if (!res)
return 0; /* Could not read from file => not sure */
return (strncmp(res, MYSQL_SERVER_VERSION,
sizeof(MYSQL_SERVER_VERSION)-1)==0);
}
......
......@@ -437,7 +437,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
ptr= fname + target_dir_name_len;
memcpy(ptr,bname,blen);
ptr+= blen;
ptr+= my_sprintf(ptr, (ptr, "-%x", file_id));
ptr+= sprintf(ptr, "-%x", file_id);
if ((file= create_unique_file(fname,ptr)) < 0)
{
......
......@@ -703,8 +703,7 @@ static int handle_request_for_tables(char *tables, uint length)
if (opt_all_in_1)
{
/* No backticks here as we added them before */
query_length= my_sprintf(query,
(query, "%s TABLE %s %s", op, tables, options));
query_length= sprintf(query, "%s TABLE %s %s", op, tables, options);
}
else
{
......
......@@ -669,8 +669,7 @@ list_fields(MYSQL *mysql,const char *db,const char *table,
char query[1024],*end;
MYSQL_RES *result;
MYSQL_ROW row;
ulong rows;
LINT_INIT(rows);
ulong UNINIT_VAR(rows);
if (mysql_select_db(mysql,db))
{
......
......@@ -5780,7 +5780,7 @@ int read_command(struct st_command** command_ptr)
(struct st_command*) my_malloc(sizeof(*command),
MYF(MY_WME|MY_ZEROFILL))) ||
insert_dynamic(&q_lines, (uchar*) &command))
die(NullS);
die("Out of memory");
command->type= Q_UNKNOWN;
read_command_buf[0]= 0;
......@@ -6260,7 +6260,7 @@ void init_win_path_patterns()
}
if (insert_dynamic(&patterns, (uchar*) &p))
die(NullS);
die("Out of memory");
DBUG_PRINT("info", ("p: %s", p));
while (*p)
......@@ -9331,8 +9331,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
for (i=1 ; i <= found_sets ; i++)
{
pos=from[found_set[i-1].table_offset];
rep_str[i].found= !bcmp((const uchar*) pos,
(const uchar*) "\\^", 3) ? 2 : 1;
rep_str[i].found= !memcmp(pos, "\\^", 3) ? 2 : 1;
rep_str[i].replace_string=to_array[found_set[i-1].table_offset];
rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos);
rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
......@@ -9460,8 +9459,8 @@ void copy_bits(REP_SET *to,REP_SET *from)
int cmp_bits(REP_SET *set1,REP_SET *set2)
{
return bcmp((uchar*) set1->bits,(uchar*) set2->bits,
sizeof(uint) * set1->size_of_bits);
return memcmp(set1->bits, set2->bits,
sizeof(uint) * set1->size_of_bits);
}
......@@ -9530,17 +9529,15 @@ int find_found(FOUND_SET *found_set,uint table_offset, int found_offset)
uint start_at_word(char * pos)
{
return (((!bcmp((const uchar*) pos, (const uchar*) "\\b",2) && pos[2]) ||
!bcmp((const uchar*) pos, (const uchar*) "\\^", 2)) ? 1 : 0);
return (((!memcmp(pos, "\\b",2) && pos[2]) ||
!memcmp(pos, "\\^", 2)) ? 1 : 0);
}
uint end_of_word(char * pos)
{
char * end=strend(pos);
return ((end > pos+2 && !bcmp((const uchar*) end-2,
(const uchar*) "\\b", 2)) ||
(end >= pos+2 && !bcmp((const uchar*) end-2,
(const uchar*) "\\$",2))) ? 1 : 0;
return ((end > pos+2 && !memcmp(end-2, "\\b", 2)) ||
(end >= pos+2 && !memcmp(end-2, "\\$",2))) ? 1 : 0;
}
/****************************************************************************
......
......@@ -122,7 +122,8 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
str_charset=cs;
if (decimals >= NOT_FIXED_DEC)
{
uint32 len= my_sprintf(buff,(buff, "%.15g",num));// Enough for a DATETIME
// Enough for a DATETIME
uint32 len= sprintf(buff, "%.15g", num);
return copy(buff, len, &my_charset_latin1, cs, &dummy_errors);
}
#ifdef HAVE_FCONVERT
......@@ -674,7 +675,7 @@ void String::qs_append(const char *str, uint32 len)
void String::qs_append(double d)
{
char *buff = Ptr + str_length;
str_length+= my_sprintf(buff, (buff, "%.15g", d));
str_length+= sprintf(buff, buff, "%.15g", d);
}
void String::qs_append(double *d)
......
......@@ -31,7 +31,7 @@ noinst_HEADERS = readline.h chardefs.h keymaps.h \
EXTRA_DIST= emacs_keymap.c vi_keymap.c
DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR
DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR -D_GNU_SOURCE=1
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -318,7 +318,9 @@ _rl_input_available ()
return (_kbhit ());
#endif
#if !defined (HAVE_SELECT)
return 0;
#endif
}
int
......
#
# Control aspects of the development environment which are
# specific to MySQL maintainers and developers.
#
AC_DEFUN([MY_MAINTAINER_MODE], [
AC_MSG_CHECKING([whether to enable the maintainer-specific development environment])
AC_ARG_ENABLE([mysql-maintainer-mode],
[AS_HELP_STRING([--enable-mysql-maintainer-mode],
[Enable a MySQL maintainer-specific development environment])],
[USE_MYSQL_MAINTAINER_MODE=$enableval],
[USE_MYSQL_MAINTAINER_MODE=no])
AC_MSG_RESULT([$USE_MYSQL_MAINTAINER_MODE])
])
# Set warning options required under maintainer mode.
AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [
# Setup GCC warning options.
AS_IF([test "$GCC" = "yes"], [
C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror"
CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter"
])
# Test whether the warning options work.
# Test C options
AS_IF([test -n "$C_WARNINGS"], [
save_CFLAGS="$CFLAGS"
AC_MSG_CHECKING([whether to use C warning options ${C_WARNINGS}])
AC_LANG_PUSH(C)
CFLAGS="$CFLAGS ${C_WARNINGS}"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_c_warning_flags=yes],
[myac_c_warning_flags=no])
AC_LANG_POP()
AC_MSG_RESULT([$myac_c_warning_flags])
CFLAGS="$save_CFLAGS"
])
# Test C++ options
AS_IF([test -n "$CXX_WARNINGS"], [
save_CXXFLAGS="$CXXFLAGS"
AC_MSG_CHECKING([whether to use C++ warning options ${CXX_WARNINGS}])
AC_LANG_PUSH(C++)
CXXFLAGS="$CXXFLAGS ${CXX_WARNINGS}"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_cxx_warning_flags=yes],
[myac_cxx_warning_flags=no])
AC_LANG_POP()
AC_MSG_RESULT([$myac_cxx_warning_flags])
CXXFLAGS="$save_CXXFLAGS"
])
# Set compile flag variables.
AS_IF([test "$myac_c_warning_flags" = "yes"], [
AM_CFLAGS="${AM_CFLAGS} ${C_WARNINGS}"
AC_SUBST([AM_CFLAGS])])
AS_IF([test "$myac_cxx_warning_flags" = "yes"], [
AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS}"
AC_SUBST([AM_CXXFLAGS])])
])
# Set compiler flags required under maintainer mode.
AC_DEFUN([MY_MAINTAINER_MODE_SETUP], [
AS_IF([test "$USE_MYSQL_MAINTAINER_MODE" = "yes"],
[MY_MAINTAINER_MODE_WARNINGS])
])
......@@ -65,6 +65,7 @@ MYSQL_TCP_PORT_DEFAULT=3306
MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock"
dnl Include m4
sinclude(config/ac-macros/maintainer.m4)
sinclude(config/ac-macros/alloca.m4)
sinclude(config/ac-macros/check_cpu.m4)
sinclude(config/ac-macros/character_sets.m4)
......@@ -102,6 +103,8 @@ AC_SUBST(SHARED_LIB_MAJOR_VERSION)
AC_SUBST(SHARED_LIB_VERSION)
AC_SUBST(AVAILABLE_LANGUAGES)
# Whether the maintainer mode should be enabled.
MY_MAINTAINER_MODE
# Canonicalize the configuration name.
......@@ -275,40 +278,6 @@ AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf)
AC_CHECK_PROG(DVIS, tex, manual.dvi)
#check the return type of sprintf
AC_MSG_CHECKING("return type of sprintf")
AC_TRY_RUN([
int main()
{
char* s = "hello";
char buf[6];
if((int)sprintf(buf, s) == strlen(s))
return 0;
return -1;
}
],
[AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
AC_MSG_RESULT("int")],
[AC_TRY_RUN([
int main()
{
char* s = "hello";
char buf[6];
if((char*)sprintf(buf,s) == buf + strlen(s))
return 0;
return -1;
} ],
[AC_DEFINE(SPRINTF_RETURNS_PTR, [1], [Broken sprintf])
AC_MSG_RESULT("ptr")],
[AC_DEFINE(SPRINTF_RETURNS_GARBAGE, [1], [Broken sprintf])
AC_MSG_RESULT("garbage")]
)],
# Cross compile, assume POSIX
[AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
AC_MSG_RESULT("int (we assume)")]
)
AC_PATH_PROG(uname_prog, uname, no)
# We should go through this and put all the explictly system dependent
......@@ -2102,7 +2071,7 @@ MYSQL_TYPE_QSORT
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
AC_CHECK_FUNCS(alarm bfill bmove bsearch bzero \
chsize cuserid fchmod fcntl \
fconvert fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
......@@ -2880,6 +2849,12 @@ do
done
AC_SUBST(sql_union_dirs)
#
# Setup maintainer mode options by the end to not disturb
# system and other checks.
#
MY_MAINTAINER_MODE_SETUP
# Some usefull subst
AC_SUBST(CC)
AC_SUBST(GXX)
......@@ -2905,7 +2880,8 @@ fi
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl
unittest/mysys/Makefile unittest/examples/Makefile dnl
unittest/mysys/Makefile unittest/strings/Makefile dnl
unittest/examples/Makefile dnl
strings/Makefile regex/Makefile storage/Makefile dnl
man/Makefile BUILD/Makefile vio/Makefile dnl
libmysql/Makefile libmysql_r/Makefile client/Makefile dnl
......
......@@ -639,9 +639,9 @@ static struct message *find_message(struct errors *err, const char *lang,
static ha_checksum checksum_format_specifier(const char* msg)
{
ha_checksum chksum= 0;
const char* p= msg;
const char* start= 0;
int num_format_specifiers= 0;
const uchar* p= (const uchar*) msg;
const uchar* start= NULL;
uint32 num_format_specifiers= 0;
while (*p)
{
......@@ -831,7 +831,6 @@ static struct message *parse_message_string(struct message *new_message,
static struct errors *parse_error_string(char *str, int er_count)
{
struct errors *new_error;
char *start;
DBUG_ENTER("parse_error_string");
DBUG_PRINT("enter", ("str: %s", str));
......@@ -842,7 +841,6 @@ static struct errors *parse_error_string(char *str, int er_count)
DBUG_RETURN(0); /* OOM: Fatal error */
/* getting the error name */
start= str;
str= skip_delimiters(str);
if (!(new_error->er_name= get_word(&str)))
......
......@@ -648,7 +648,7 @@ static REPLACE *init_replace(char * *from, char * *to,uint count,
for (i=1 ; i <= found_sets ; i++)
{
pos=from[found_set[i-1].table_offset];
rep_str[i].found= (my_bool) (!bcmp(pos,"\\^",3) ? 2 : 1);
rep_str[i].found= (my_bool) (!memcmp(pos,"\\^",3) ? 2 : 1);
rep_str[i].replace_string=to_array[found_set[i-1].table_offset];
rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos);
rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
......@@ -776,8 +776,8 @@ static void copy_bits(REP_SET *to,REP_SET *from)
static int cmp_bits(REP_SET *set1,REP_SET *set2)
{
return bcmp((uchar*) set1->bits,(uchar*) set2->bits,
sizeof(uint) * set1->size_of_bits);
return memcmp(set1->bits, set2->bits,
sizeof(uint) * set1->size_of_bits);
}
......@@ -849,14 +849,14 @@ static short find_found(FOUND_SET *found_set,uint table_offset,
static uint start_at_word(char * pos)
{
return (((!bcmp(pos,"\\b",2) && pos[2]) || !bcmp(pos,"\\^",2)) ? 1 : 0);
return (((!memcmp(pos,"\\b",2) && pos[2]) || !memcmp(pos,"\\^",2)) ? 1 : 0);
}
static uint end_of_word(char * pos)
{
char * end=strend(pos);
return ((end > pos+2 && !bcmp(end-2,"\\b",2)) ||
(end >= pos+2 && !bcmp(end-2,"\\$",2))) ?
return ((end > pos+2 && !memcmp(end-2,"\\b",2)) ||
(end >= pos+2 && !memcmp(end-2,"\\$",2))) ?
1 : 0;
}
......
......@@ -953,8 +953,9 @@ x509* PemToDer(FILE* file, CertType type, EncryptedInfo* info)
info->set = true;
}
}
fgets(line,sizeof(line), file); // get blank line
begin = ftell(file);
// get blank line
if (fgets(line, sizeof(line), file))
begin = ftell(file);
}
}
......
......@@ -884,21 +884,19 @@ void Alert::Process(input_buffer& input, SSL& ssl)
else
hmac(ssl, verify, data, aSz, alert, true);
// read mac and fill
// read mac and skip fill
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
opaque mac[SHA_LEN];
input.read(mac, digestSz);
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
int ivExtra = 0;
opaque fill;
if (ssl.isTLSv1_1())
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
aSz - digestSz;
for (int i = 0; i < padSz; i++)
fill = input[AUTO];
input.set_current(input.get_current() + padSz);
}
// verify
......@@ -981,17 +979,17 @@ output_buffer& operator<<(output_buffer& output, const Data& data)
void Data::Process(input_buffer& input, SSL& ssl)
{
int msgSz = ssl.getSecurity().get_parms().encrypt_size_;
int pad = 0, padByte = 0;
int pad = 0, padSz = 0;
int ivExtra = 0;
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
if (ssl.isTLSv1_1()) // IV
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
pad = *(input.get_buffer() + input.get_current() + msgSz -ivExtra - 1);
padByte = 1;
padSz = 1;
}
int digestSz = ssl.getCrypto().get_digest().get_digestSize();
int dataSz = msgSz - ivExtra - digestSz - pad - padByte;
int dataSz = msgSz - ivExtra - digestSz - pad - padSz;
opaque verify[SHA_LEN];
const byte* rawData = input.get_buffer() + input.get_current();
......@@ -1020,14 +1018,10 @@ void Data::Process(input_buffer& input, SSL& ssl)
hmac(ssl, verify, rawData, dataSz, application_data, true);
}
// read mac and fill
// read mac and skip fill
opaque mac[SHA_LEN];
opaque fill;
input.read(mac, digestSz);
for (int i = 0; i < pad; i++)
fill = input[AUTO];
if (padByte)
fill = input[AUTO];
input.set_current(input.get_current() + pad + padSz);
// verify
if (dataSz) {
......@@ -2073,11 +2067,9 @@ void Finished::Process(input_buffer& input, SSL& ssl)
if (ssl.isTLSv1_1())
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
opaque fill;
int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra -
HANDSHAKE_HEADER - finishedSz - digestSz;
for (int i = 0; i < padSz; i++)
fill = input[AUTO];
input.set_current(input.get_current() + padSz);
// verify mac
if (memcmp(mac, verifyMAC, digestSz)) {
......
......@@ -51,7 +51,7 @@ public:
enum { BLOCK_SIZE = BLOWFISH_BLOCK_SIZE, ROUNDS = 16 };
Blowfish(CipherDir DIR, Mode MODE)
: Mode_BASE(BLOCK_SIZE, DIR, MODE) {}
: Mode_BASE(BLOCK_SIZE, DIR, MODE), sbox_(pbox_ + ROUNDS + 2) {}
#ifdef DO_BLOWFISH_ASM
void Process(byte*, const byte*, word32);
......@@ -62,8 +62,8 @@ private:
static const word32 p_init_[ROUNDS + 2];
static const word32 s_init_[4 * 256];
word32 pbox_[ROUNDS + 2];
word32 sbox_[4 * 256];
word32 pbox_[ROUNDS + 2 + 4 * 256];
word32* sbox_;
void crypt_block(const word32 in[2], word32 out[2]) const;
void AsmProcess(const byte* in, byte* out) const;
......
......@@ -35,10 +35,7 @@
// Handler for pure virtual functions
namespace __Crun {
static void pure_error(void)
{
assert("Pure virtual method called." == "Aborted");
}
void pure_error(void);
} // namespace __Crun
#endif // __sun
......@@ -54,16 +51,7 @@ extern "C" {
#else
#include "kernelc.hpp"
#endif
/* Disallow inline __cxa_pure_virtual() */
static int __cxa_pure_virtual() __attribute__((noinline, used));
static int __cxa_pure_virtual()
{
// oops, pure virtual called!
assert("Pure virtual method called." == "Aborted");
return 0;
}
int __cxa_pure_virtual () __attribute__ ((weak));
} // extern "C"
#endif // __GNUC__ > 2
......
......@@ -51,7 +51,7 @@ void AES::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
else if (mode_ == CBC)
else if (mode_ == CBC) {
if (dir_ == ENCRYPTION)
while (blocks--) {
r_[0] ^= *(word32*)in;
......@@ -78,6 +78,7 @@ void AES::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
}
}
#endif // DO_AES_ASM
......
......@@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x,
struct WindowSlider
{
WindowSlider(const Integer &exp, bool fastNegate,
WindowSlider(const Integer &expIn, bool fastNegateIn,
unsigned int windowSizeIn=0)
: exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn),
windowBegin(0), fastNegate(fastNegate), firstTime(true),
: exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn),
windowBegin(0), fastNegate(fastNegateIn), firstTime(true),
finished(false)
{
if (windowSize == 0)
......
......@@ -53,7 +53,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
else if (mode_ == CBC)
else if (mode_ == CBC) {
if (dir_ == ENCRYPTION)
while (blocks--) {
r_[0] ^= *(word32*)in;
......@@ -78,6 +78,7 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
}
}
#endif // DO_BLOWFISH_ASM
......
......@@ -185,7 +185,7 @@ void Base64Decoder::Decode()
{
word32 bytes = coded_.size();
word32 plainSz = bytes - ((bytes + (pemLineSz - 1)) / pemLineSz);
plainSz = (plainSz * 3 + 3) / 4;
plainSz = ((plainSz * 3) / 4) + 3;
decoded_.New(plainSz);
word32 i = 0;
......
......@@ -283,21 +283,23 @@ DWord() {}
word GetHighHalfAsBorrow() const {return 0-halfs_.high;}
private:
struct dword_struct
{
#ifdef LITTLE_ENDIAN_ORDER
word low;
word high;
#else
word high;
word low;
#endif
};
union
{
#ifdef TAOCRYPT_NATIVE_DWORD_AVAILABLE
dword whole_;
#endif
struct
{
#ifdef LITTLE_ENDIAN_ORDER
word low;
word high;
#else
word high;
word low;
#endif
} halfs_;
struct dword_struct halfs_;
};
};
......@@ -1214,20 +1216,24 @@ public:
#define AS1(x) #x ";"
#define AS2(x, y) #x ", " #y ";"
#define AddPrologue \
word res; \
__asm__ __volatile__ \
( \
"push %%ebx;" /* save this manually, in case of -fPIC */ \
"mov %2, %%ebx;" \
"mov %3, %%ebx;" \
".intel_syntax noprefix;" \
"push ebp;"
#define AddEpilogue \
"pop ebp;" \
".att_syntax prefix;" \
"pop %%ebx;" \
: \
"mov %%eax, %0;" \
: "=g" (res) \
: "c" (C), "d" (A), "m" (B), "S" (N) \
: "%edi", "memory", "cc" \
);
); \
return res;
#define MulPrologue \
__asm__ __volatile__ \
( \
......
......@@ -84,12 +84,23 @@ namespace STL = STL_NAMESPACE;
}
#if defined(__ICC) || defined(__INTEL_COMPILER)
#ifdef __sun
// Handler for pure virtual functions
namespace __Crun {
void pure_error() {
assert(!"Aborted: pure virtual method called.");
}
}
#endif
#if defined(__ICC) || defined(__INTEL_COMPILER) || (__GNUC__ > 2)
extern "C" {
int __cxa_pure_virtual() {
assert("Pure virtual method called." == "Aborted");
assert(!"Aborted: pure virtual method called.");
return 0;
}
......@@ -166,14 +177,6 @@ word Crop(word value, unsigned int size)
#ifdef TAOCRYPT_X86ASM_AVAILABLE
#ifndef _MSC_VER
static jmp_buf s_env;
static void SigIllHandler(int)
{
longjmp(s_env, 1);
}
#endif
bool HaveCpuId()
{
......
......@@ -54,7 +54,7 @@ void Twofish::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
else if (mode_ == CBC)
else if (mode_ == CBC) {
if (dir_ == ENCRYPTION)
while (blocks--) {
r_[0] ^= *(word32*)in;
......@@ -82,6 +82,7 @@ void Twofish::Process(byte* out, const byte* in, word32 sz)
out += BLOCK_SIZE;
in += BLOCK_SIZE;
}
}
}
#endif // DO_TWOFISH_ASM
......
......@@ -160,6 +160,11 @@ inline void err_sys(const char* msg)
}
extern "C" {
static int PasswordCallBack(char*, int, int, void*);
}
static int PasswordCallBack(char* passwd, int sz, int rw, void* userdata)
{
strncpy(passwd, "12345678", sz);
......
......@@ -36,10 +36,8 @@ noinst_HEADERS = config-win.h config-netware.h my_bit.h \
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \
my_aes.h my_tree.h my_trie.h hash.h thr_alarm.h \
thr_lock.h t_ctype.h violite.h my_md5.h base64.h \
my_handler.h my_time.h \
my_vle.h my_user.h my_atomic.h atomic/nolock.h \
atomic/rwlock.h atomic/x86-gcc.h atomic/x86-msvc.h \
atomic/gcc_builtins.h my_libwrap.h my_stacktrace.h
my_handler.h my_time.h my_vle.h my_user.h \
my_libwrap.h my_stacktrace.h my_compiler.h
EXTRA_DIST = mysql.h.pp mysql/plugin.h.pp
......
/* Copyright (C) 2008 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define make_atomic_add_body(S) \
v= __sync_fetch_and_add(a, v);
#define make_atomic_swap_body(S) \
v= __sync_lock_test_and_set(a, v);
#define make_atomic_cas_body(S) \
int ## S sav; \
sav= __sync_val_compare_and_swap(a, *cmp, set); \
if (!(ret= (sav == *cmp))) *cmp= sav;
#ifdef MY_ATOMIC_MODE_DUMMY
#define make_atomic_load_body(S) ret= *a
#define make_atomic_store_body(S) *a= v
#else
#define make_atomic_load_body(S) \
ret= __sync_fetch_and_or(a, 0);
#define make_atomic_store_body(S) \
(void) __sync_lock_test_and_set(a, v);
#endif
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#if defined(__i386__) || defined(_M_IX86) || defined(HAVE_GCC_ATOMIC_BUILTINS)
#ifdef MY_ATOMIC_MODE_DUMMY
# define LOCK ""
#else
# define LOCK "lock"
#endif
#ifdef HAVE_GCC_ATOMIC_BUILTINS
#include "gcc_builtins.h"
#elif __GNUC__
#include "x86-gcc.h"
#elif defined(_MSC_VER)
#include "x86-msvc.h"
#endif
#endif
#ifdef make_atomic_cas_body
typedef struct { } my_atomic_rwlock_t;
#define my_atomic_rwlock_destroy(name)
#define my_atomic_rwlock_init(name)
#define my_atomic_rwlock_rdlock(name)
#define my_atomic_rwlock_wrlock(name)
#define my_atomic_rwlock_rdunlock(name)
#define my_atomic_rwlock_wrunlock(name)
#endif
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
typedef struct {pthread_rwlock_t rw;} my_atomic_rwlock_t;
#ifdef MY_ATOMIC_MODE_DUMMY
/*
the following can never be enabled by ./configure, one need to put #define in
a source to trigger the following warning. The resulting code will be broken,
it only makes sense to do it to see now test_atomic detects broken
implementations (another way is to run a UP build on an SMP box).
*/
#warning MY_ATOMIC_MODE_DUMMY and MY_ATOMIC_MODE_RWLOCKS are incompatible
#define my_atomic_rwlock_destroy(name)
#define my_atomic_rwlock_init(name)
#define my_atomic_rwlock_rdlock(name)
#define my_atomic_rwlock_wrlock(name)
#define my_atomic_rwlock_rdunlock(name)
#define my_atomic_rwlock_wrunlock(name)
#define MY_ATOMIC_MODE "dummy (non-atomic)"
#else
#define my_atomic_rwlock_destroy(name) pthread_rwlock_destroy(& (name)->rw)
#define my_atomic_rwlock_init(name) pthread_rwlock_init(& (name)->rw, 0)
#define my_atomic_rwlock_rdlock(name) pthread_rwlock_rdlock(& (name)->rw)
#define my_atomic_rwlock_wrlock(name) pthread_rwlock_wrlock(& (name)->rw)
#define my_atomic_rwlock_rdunlock(name) pthread_rwlock_unlock(& (name)->rw)
#define my_atomic_rwlock_wrunlock(name) pthread_rwlock_unlock(& (name)->rw)
#define MY_ATOMIC_MODE "rwlocks"
#endif
#define make_atomic_add_body(S) int ## S sav; sav= *a; *a+= v; v=sav;
#define make_atomic_swap_body(S) int ## S sav; sav= *a; *a= v; v=sav;
#define make_atomic_cas_body(S) if ((ret= (*a == *cmp))) *a= set; else *cmp=*a;
#define make_atomic_load_body(S) ret= *a;
#define make_atomic_store_body(S) *a= v;
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
XXX 64-bit atomic operations can be implemented using
cmpxchg8b, if necessary. Though I've heard that not all 64-bit
architectures support double-word (128-bit) cas.
*/
#ifdef MY_ATOMIC_NO_XADD
#define MY_ATOMIC_MODE "gcc-x86" LOCK "-no-xadd"
#else
#define MY_ATOMIC_MODE "gcc-x86" LOCK
#endif
/* fix -ansi errors while maintaining readability */
#ifndef asm
#define asm __asm__
#endif
#ifndef MY_ATOMIC_NO_XADD
#define make_atomic_add_body(S) \
asm volatile (LOCK "; xadd %0, %1;" : "+r" (v) , "+m" (*a))
#endif
#define make_atomic_swap_body(S) \
asm volatile ("; xchg %0, %1;" : "+r" (v) , "+m" (*a))
#define make_atomic_cas_body(S) \
asm volatile (LOCK "; cmpxchg %3, %0; setz %2;" \
: "+m" (*a), "+a" (*cmp), "=q" (ret): "r" (set))
#ifdef MY_ATOMIC_MODE_DUMMY
#define make_atomic_load_body(S) ret=*a
#define make_atomic_store_body(S) *a=v
#else
/*
Actually 32-bit reads/writes are always atomic on x86
But we add LOCK here anyway to force memory barriers
*/
#define make_atomic_load_body(S) \
ret=0; \
asm volatile (LOCK "; cmpxchg %2, %0" \
: "+m" (*a), "+a" (ret): "r" (ret))
#define make_atomic_store_body(S) \
asm volatile ("; xchg %0, %1;" : "+m" (*a) : "r" (v))
#endif
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
XXX 64-bit atomic operations can be implemented using
cmpxchg8b, if necessary
*/
// Would it be better to use intrinsics ?
// (InterlockedCompareExchange, InterlockedCompareExchange16
// InterlockedExchangeAdd, InterlockedExchange)
#ifndef _atomic_h_cleanup_
#define _atomic_h_cleanup_ "atomic/x86-msvc.h"
#define MY_ATOMIC_MODE "msvc-x86" LOCK
#define make_atomic_add_body(S) \
_asm { \
_asm mov reg_ ## S, v \
_asm LOCK xadd *a, reg_ ## S \
_asm movzx v, reg_ ## S \
}
#define make_atomic_cas_body(S) \
_asm { \
_asm mov areg_ ## S, *cmp \
_asm mov reg2_ ## S, set \
_asm LOCK cmpxchg *a, reg2_ ## S \
_asm mov *cmp, areg_ ## S \
_asm setz al \
_asm movzx ret, al \
}
#define make_atomic_swap_body(S) \
_asm { \
_asm mov reg_ ## S, v \
_asm xchg *a, reg_ ## S \
_asm mov v, reg_ ## S \
}
#ifdef MY_ATOMIC_MODE_DUMMY
#define make_atomic_load_body(S) ret=*a
#define make_atomic_store_body(S) *a=v
#else
/*
Actually 32-bit reads/writes are always atomic on x86
But we add LOCK here anyway to force memory barriers
*/
#define make_atomic_load_body(S) \
_asm { \
_asm mov areg_ ## S, 0 \
_asm mov reg2_ ## S, areg_ ## S \
_asm LOCK cmpxchg *a, reg2_ ## S \
_asm mov ret, areg_ ## S \
}
#define make_atomic_store_body(S) \
_asm { \
_asm mov reg_ ## S, v \
_asm xchg *a, reg_ ## S \
}
#endif
#define reg_8 al
#define reg_16 ax
#define reg_32 eax
#define areg_8 al
#define areg_16 ax
#define areg_32 eax
#define reg2_8 bl
#define reg2_16 bx
#define reg2_32 ebx
#else /* cleanup */
#undef reg_8
#undef reg_16
#undef reg_32
#undef areg_8
#undef areg_16
#undef areg_32
#undef reg2_8
#undef reg2_16
#undef reg2_32
#endif
......@@ -33,10 +33,6 @@
/* need by my_vsnprintf */
#include <stdarg.h>
#ifdef _AIX
#undef HAVE_BCMP
#endif
/* This is needed for the definitions of bzero... on solaris */
#if defined(HAVE_STRINGS_H)
#include <strings.h>
......@@ -60,14 +56,10 @@
/* Unixware 7 */
#if !defined(HAVE_BFILL)
# define bfill(A,B,C) memset((A),(C),(B))
# define bmove_align(A,B,C) memcpy((A),(B),(C))
#endif
#if !defined(HAVE_BCMP)
# define bcopy(s, d, n) memcpy((d), (s), (n))
# define bcmp(A,B,C) memcmp((A),(B),(C))
# define bzero(A,B) memset((A),0,(B))
# define bmove_align(A,B,C) memcpy((A),(B),(C))
#if !defined(bzero) && !defined(HAVE_BZERO)
# define bzero(A,B) memset((A),0,(B))
#endif
#if defined(__cplusplus)
......@@ -116,19 +108,6 @@ extern const double log_10[309];
extern void bfill(uchar *dst,size_t len,pchar fill);
#endif
#if !defined(bzero) && !defined(HAVE_BZERO)
extern void bzero(uchar * dst,size_t len);
#endif
#if !defined(bcmp) && !defined(HAVE_BCMP)
extern size_t bcmp(const uchar *s1,const uchar *s2,size_t len);
#endif
#ifdef HAVE_purify
extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
#undef bcmp
#define bcmp(A,B,C) my_bcmp((A),(B),(C))
#endif /* HAVE_purify */
#ifndef bmove512
extern void bmove512(uchar *dst,const uchar *src,size_t len);
#endif
......
/* Copyright (C) 2006 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef my_atomic_rwlock_init
#define intptr void *
#ifndef MY_ATOMIC_MODE_RWLOCKS
#include "atomic/nolock.h"
#endif
#ifndef make_atomic_cas_body
#include "atomic/rwlock.h"
#endif
#ifndef make_atomic_add_body
#define make_atomic_add_body(S) \
int ## S tmp=*a; \
while (!my_atomic_cas ## S(a, &tmp, tmp+v)); \
v=tmp;
#endif
#ifdef HAVE_INLINE
#define make_atomic_add(S) \
STATIC_INLINE int ## S my_atomic_add ## S( \
int ## S volatile *a, int ## S v) \
{ \
make_atomic_add_body(S); \
return v; \
}
#define make_atomic_swap(S) \
STATIC_INLINE int ## S my_atomic_swap ## S( \
int ## S volatile *a, int ## S v) \
{ \
make_atomic_swap_body(S); \
return v; \
}
#define make_atomic_cas(S) \
STATIC_INLINE int my_atomic_cas ## S(int ## S volatile *a, \
int ## S *cmp, int ## S set) \
{ \
int8 ret; \
make_atomic_cas_body(S); \
return ret; \
}
#define make_atomic_load(S) \
STATIC_INLINE int ## S my_atomic_load ## S(int ## S volatile *a) \
{ \
int ## S ret; \
make_atomic_load_body(S); \
return ret; \
}
#define make_atomic_store(S) \
STATIC_INLINE void my_atomic_store ## S( \
int ## S volatile *a, int ## S v) \
{ \
make_atomic_store_body(S); \
}
#else /* no inline functions */
#define make_atomic_add(S) \
extern int ## S my_atomic_add ## S(int ## S volatile *a, int ## S v);
#define make_atomic_swap(S) \
extern int ## S my_atomic_swap ## S(int ## S volatile *a, int ## S v);
#define make_atomic_cas(S) \
extern int my_atomic_cas ## S(int ## S volatile *a, int ## S *cmp, int ## S set);
#define make_atomic_load(S) \
extern int ## S my_atomic_load ## S(int ## S volatile *a);
#define make_atomic_store(S) \
extern void my_atomic_store ## S(int ## S volatile *a, int ## S v);
#endif
make_atomic_cas( 8)
make_atomic_cas(16)
make_atomic_cas(32)
make_atomic_cas(ptr)
make_atomic_add( 8)
make_atomic_add(16)
make_atomic_add(32)
make_atomic_load( 8)
make_atomic_load(16)
make_atomic_load(32)
make_atomic_load(ptr)
make_atomic_store( 8)
make_atomic_store(16)
make_atomic_store(32)
make_atomic_store(ptr)
make_atomic_swap( 8)
make_atomic_swap(16)
make_atomic_swap(32)
make_atomic_swap(ptr)
#undef make_atomic_add
#undef make_atomic_cas
#undef make_atomic_load
#undef make_atomic_store
#undef make_atomic_swap
#undef make_atomic_add_body
#undef make_atomic_cas_body
#undef make_atomic_load_body
#undef make_atomic_store_body
#undef make_atomic_swap_body
#undef intptr
#ifdef _atomic_h_cleanup_
#include _atomic_h_cleanup_
#undef _atomic_h_cleanup_
#endif
#define MY_ATOMIC_OK 0
#define MY_ATOMIC_NOT_1CPU 1
extern int my_atomic_initialize();
#endif
......@@ -159,22 +159,6 @@ static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
#define bitmap_set_all(MAP) \
(memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP))))
/**
check, set and clear a bit of interest of an integer.
If the bit is out of range @retval -1. Otherwise
bit_is_set @return 0 or 1 reflecting the bit is set or not;
bit_do_set @return 1 (bit is set 1)
bit_do_clear @return 0 (bit is cleared to 0)
*/
#define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
(((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1)
#define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
((I) |= (ULL(1) << (B)), 1) : -1)
#define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
((I) &= ~(ULL(1) << (B)), 0) : -1)
#ifdef __cplusplus
}
#endif
......
#ifndef MY_COMPILER_INCLUDED
#define MY_COMPILER_INCLUDED
/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/**
Header for compiler-dependent features.
Intended to contain a set of reusable wrappers for preprocessor
macros, attributes, pragmas, and any other features that are
specific to a target compiler.
*/
#include <my_global.h> /* stddef.h offsetof */
/**
Compiler-dependent internal convenience macros.
*/
/* GNU C/C++ */
#if defined __GNUC__
/* Any after 2.95... */
# define MY_ALIGN_EXT
/* Microsoft Visual C++ */
#elif defined _MSC_VER
# define MY_ALIGNOF(type) __alignof(type)
# define MY_ALIGNED(n) __declspec(align(n))
/* Oracle Solaris Studio */
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# if __SUNPRO_C >= 0x590
# define MY_ALIGN_EXT
# endif
/* IBM XL C/C++ */
#elif defined __xlC__
# if __xlC__ >= 0x0600
# define MY_ALIGN_EXT
# endif
/* HP aCC */
#elif defined(__HP_aCC) || defined(__HP_cc)
# if (__HP_aCC >= 60000) || (__HP_cc >= 60000)
# define MY_ALIGN_EXT
# endif
#endif
#ifdef MY_ALIGN_EXT
/** Specifies the minimum alignment of a type. */
# define MY_ALIGNOF(type) __alignof__(type)
/** Determine the alignment requirement of a type. */
# define MY_ALIGNED(n) __attribute__((__aligned__((n))))
#endif
/**
Generic compiler-dependent features.
*/
#ifndef MY_ALIGNOF
# ifdef __cplusplus
template<typename type> struct my_alignof_helper { char m1; type m2; };
/* Invalid for non-POD types, but most compilers give the right answer. */
# define MY_ALIGNOF(type) offsetof(my_alignof_helper<type>, m2)
# else
# define MY_ALIGNOF(type) offsetof(struct { char m1; type m2; }, m2)
# endif
#endif
/**
C++ Type Traits
*/
#ifdef __cplusplus
/**
Opaque storage with a particular alignment.
*/
# if defined(MY_ALIGNED)
/* Partial specialization used due to MSVC++. */
template<size_t alignment> struct my_alignment_imp;
template<> struct MY_ALIGNED(1) my_alignment_imp<1> {};
template<> struct MY_ALIGNED(2) my_alignment_imp<2> {};
template<> struct MY_ALIGNED(4) my_alignment_imp<4> {};
template<> struct MY_ALIGNED(8) my_alignment_imp<8> {};
template<> struct MY_ALIGNED(16) my_alignment_imp<16> {};
/* ... expand as necessary. */
# else
template<size_t alignment>
struct my_alignment_imp { double m1; };
# endif
/**
A POD type with a given size and alignment.
@remark If the compiler does not support a alignment attribute
(MY_ALIGN macro), the default alignment of a double is
used instead.
@tparam size The minimum size.
@tparam alignment The desired alignment: 1, 2, 4, 8 or 16.
*/
template <size_t size, size_t alignment>
struct my_aligned_storage
{
union
{
char data[size];
my_alignment_imp<alignment> align;
};
};
#endif /* __cplusplus */
#include <my_attribute.h>
#endif /* MY_COMPILER_INCLUDED */
......@@ -556,22 +556,30 @@ int __void__;
#endif
#endif /* DONT_DEFINE_VOID */
#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
#define LINT_INIT(var) var=0 /* No uninitialize-warning */
/*
Deprecated workaround for false-positive uninitialized variables
warnings. Those should be silenced using tool-specific heuristics.
Enabled by default for g++ due to the bug referenced below.
*/
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
(defined(__GNUC__) && defined(__cplusplus))
#define LINT_INIT(var) var= 0
#else
#define LINT_INIT(var)
#endif
/*
/*
Suppress uninitialized variable warning without generating code.
The _cplusplus is a temporary workaround for C++ code pending a fix
for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
*/
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || defined(__cplusplus) || \
!defined(__GNUC__)
#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
defined(__cplusplus) || !defined(__GNUC__)
#define UNINIT_VAR(x) x= 0
#else
/* GCC specific self-initialization which inhibits the warning. */
#define UNINIT_VAR(x) x= x
#endif
......@@ -595,7 +603,6 @@ typedef unsigned short ushort;
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
#define test_all_bits(a,b) (((a) & (b)) == (b))
#define set_bits(type, bit_count) (sizeof(type)*8 <= (bit_count) ? ~(type) 0 : ((((type) 1) << (bit_count)) - (type) 1))
#define array_elements(A) ((uint) (sizeof(A)/sizeof(A[0])))
/* Define some general constants */
......@@ -616,7 +623,7 @@ typedef unsigned short ushort;
#define my_const_cast(A) (A)
#endif
#include <my_attribute.h>
#include <my_compiler.h>
/*
Wen using the embedded library, users might run into link problems,
......@@ -934,9 +941,6 @@ typedef long long my_ptrdiff_t;
#define ADD_TO_PTR(ptr,size,type) (type) ((uchar*) (ptr)+size)
#define PTR_BYTE_DIFF(A,B) (my_ptrdiff_t) ((uchar*) (A) - (uchar*) (B))
#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B))
#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))]
/*
Custom version of standard offsetof() macro which can be used to get
offsets of members in class for non-POD types (according to the current
......@@ -1460,17 +1464,6 @@ do { doubleget_union _tmp; \
#endif /* WORDS_BIGENDIAN */
/* sprintf does not always return the number of bytes :- */
#ifdef SPRINTF_RETURNS_INT
#define my_sprintf(buff,args) sprintf args
#else
#ifdef SPRINTF_RETURNS_PTR
#define my_sprintf(buff,args) ((int)(sprintf args - buff))
#else
#define my_sprintf(buff,args) ((ulong) sprintf args, (ulong) strlen(buff))
#endif
#endif
#ifndef THREAD
#define thread_safe_increment(V,L) (V)++
#define thread_safe_decrement(V,L) (V)--
......
......@@ -269,13 +269,14 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
we want to make sure that no such flags are set.
*/
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; int l_rc; \
#define my_sigset(A,B) do { struct sigaction l_s; sigset_t l_set; \
IF_DBUG(int l_rc); \
DBUG_ASSERT((A) != 0); \
sigemptyset(&l_set); \
l_s.sa_handler = (B); \
l_s.sa_mask = l_set; \
l_s.sa_flags = 0; \
l_rc= sigaction((A), &l_s, (struct sigaction *) NULL);\
IF_DBUG(l_rc=) sigaction((A), &l_s, NULL); \
DBUG_ASSERT(l_rc == 0); \
} while (0)
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
......@@ -715,7 +716,7 @@ extern uint thd_lib_detected;
The implementation is guaranteed to be thread safe, on all platforms.
Note that the calling code should *not* assume the counter is protected
by the mutex given, as the implementation of these helpers may change
to use my_atomic operations instead.
to use atomic operations instead.
*/
/*
......
......@@ -44,7 +44,9 @@ extern "C" {
#endif
#ifndef _global_h /* If not standard header */
#ifndef MYSQL_ABI_CHECK
#include <sys/types.h>
#endif
#ifdef __LCC__
#include <winsock2.h> /* For windows */
#endif
......
#include <sys/types.h>
typedef char my_bool;
typedef int my_socket;
#include "mysql_version.h"
......
......@@ -62,7 +62,9 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_UNKNOWN_COLLATION 28
#define EE_FILENOTFOUND 29
#define EE_FILE_NOT_CLOSED 30
#define EE_ERROR_LAST 30 /* Copy last error nr */
#define EE_CHANGE_OWNERSHIP 31
#define EE_CHANGE_PERMISSIONS 32
#define EE_ERROR_LAST 32 /* Copy last error nr */
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
/* exit codes for all MySQL programs */
......
......@@ -38,7 +38,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
strmake.lo strend.lo strtod.lo \
strnlen.lo strfill.lo is_prefix.lo \
int2str.lo str2int.lo strinstr.lo strcont.lo \
strcend.lo bcmp.lo ctype-latin1.lo \
strcend.lo ctype-latin1.lo \
bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \
ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \
......
......@@ -4421,11 +4421,11 @@ static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
case MYSQL_TYPE_TIME:
field->max_length= 15; /* 19:23:48.123456 */
param->skip_result= skip_result_with_length;
break;
case MYSQL_TYPE_DATE:
field->max_length= 10; /* 2003-11-11 */
param->skip_result= skip_result_with_length;
break;
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
param->skip_result= skip_result_with_length;
......
......@@ -42,7 +42,8 @@ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @LIBDL@ $(CXXLDFLAGS) \
mysqltest_embedded_LINK = $(CXXLINK)
nodist_mysqltest_embedded_SOURCES = mysqltest.cc
mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a
mysqltest_embedded_LDADD = $(LDADD) $(top_builddir)/regex/libregex.a \
@MYSQLD_EXTRA_LDFLAGS@
nodist_mysql_SOURCES = mysql.cc readline.cc completion_hash.cc \
my_readline.h sql_string.h completion_hash.h
......
......@@ -100,7 +100,8 @@ TEST_DIRS = t r include std_data std_data/parts collections \
suite/rpl_ndb suite/rpl_ndb/t suite/rpl_ndb/r \
suite/parts suite/parts/t suite/parts/r suite/parts/inc \
suite/innodb suite/innodb/t suite/innodb/r suite/innodb/include \
suite/innodb_plugin suite/innodb_plugin/t suite/innodb_plugin/r suite/innodb_plugin/include \
suite/innodb_plugin suite/innodb_plugin/t suite/innodb_plugin/r \
suite/innodb_plugin/include \
suite/engines suite/engines/funcs suite/engines/iuds suite/engines/rr_trx \
suite/engines/funcs/r suite/engines/funcs/t suite/engines/iuds/r \
suite/engines/iuds/t suite/engines/rr_trx/include suite/engines/rr_trx/r \
......
......@@ -725,9 +725,9 @@ call p_verify_status_increment(4, 4, 4, 4);
alter table t3 add column (b int);
call p_verify_status_increment(2, 0, 2, 0);
alter table t3 rename t4;
call p_verify_status_increment(2, 2, 2, 2);
call p_verify_status_increment(1, 0, 1, 0);
rename table t4 to t3;
call p_verify_status_increment(2, 2, 2, 2);
call p_verify_status_increment(1, 0, 1, 0);
truncate table t3;
call p_verify_status_increment(4, 4, 4, 4);
create view v1 as select * from t2;
......
......@@ -64,17 +64,13 @@ let $_diff_table=$diff_table_2;
let $_diff_i=2;
while ($_diff_i) {
# Parse out any leading "master:" or "slave:" from the table
# specification and connect the appropriate server.
let $_diff_conn_master=`SELECT SUBSTR('$_diff_table', 1, 7) = 'master:'`;
if ($_diff_conn_master) {
let $_diff_table=`SELECT SUBSTR('$_diff_table', 8)`;
connection master;
}
let $_diff_conn_slave=`SELECT SUBSTR('$_diff_table', 1, 6) = 'slave:'`;
if ($_diff_conn_slave) {
let $_diff_table=`SELECT SUBSTR('$_diff_table', 7)`;
connection slave;
# Parse out any leading "master:" or "slave:" from the table specification
# and connect the appropriate server.
let $_pos= `SELECT LOCATE(':', '$_diff_table')`;
let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`;
if (`SELECT 'XX$_diff_conn' <> 'XX'`) {
let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`;
connection $_diff_conn;
}
# Sanity-check the input.
......
--source include/not_embedded.inc
disable_query_log;
--require r/true.require
SELECT (plugin_library LIKE 'ha_innodb_plugin%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
......
# #############################################################################
# Check whether the given table is consistent between different master and
# slaves
#
# Usage:
# --let $diff_table= test.t1
# --let $diff_server_list= master, slave, slave2
# --source include/rpl_diff_tables.inc
# #############################################################################
if (`SELECT "XX$diff_table" = "XX"`)
{
--die diff_table is null.
}
--let $_servers= master, slave
if (`SELECT "XX$diff_server_list" <> "XX"`)
{
--let $_servers= $diff_server_list
}
--let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))`
connection $_master;
while (`SELECT "XX$_servers" <> "XX"`)
{
--let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))`
--sync_slave_with_master $_slave
--let $diff_table_1= $_master:$diff_table
--let $diff_table_2= $_slave:$diff_table
--source include/diff_tables.inc
connection $_slave;
}
......@@ -159,7 +159,7 @@ int main(int argc, char* const argv[] )
signal(SIGCHLD, handle_signal);
signal(SIGABRT, handle_abort);
sprintf(safe_process_name, "safe_process[%d]", own_pid);
sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid);
message("Started");
......
......@@ -841,11 +841,11 @@ call p_verify_status_increment(2, 0, 2, 0);
SUCCESS
alter table t3 rename t4;
call p_verify_status_increment(2, 2, 2, 2);
call p_verify_status_increment(1, 0, 1, 0);
SUCCESS
rename table t4 to t3;
call p_verify_status_increment(2, 2, 2, 2);
call p_verify_status_increment(1, 0, 1, 0);
SUCCESS
truncate table t3;
......
......@@ -995,6 +995,7 @@ SELECT 1 FROM
1
1
DROP TABLE t1;
End of 5.0 tests
#
# Bug #52397: another crash with explain extended and group_concat
#
......@@ -1010,4 +1011,22 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select 1 AS `1` from (select group_concat(`test`.`t1`.`a` order by `test`.`t1`.`a` ASC separator ',') AS `GROUP_CONCAT(t1.a ORDER BY t1.a ASC)` from `test`.`t1` `t2` join `test`.`t1` group by `test`.`t1`.`a`) `d`
DROP TABLE t1;
End of 5.0 tests
#
# Bug #54476: crash when group_concat and 'with rollup' in prepared statements
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2);
PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
EXECUTE stmt;
GROUP_CONCAT(t1.a ORDER BY t1.a)
1,1
2,2
1,1,2,2
EXECUTE stmt;
GROUP_CONCAT(t1.a ORDER BY t1.a)
1,1
2,2
1,1,2,2
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests
......@@ -336,4 +336,19 @@ End of 5.0 tests
select connection_id() > 0;
connection_id() > 0
1
#
# Bug #54461: crash with longblob and union or update with subquery
#
CREATE TABLE t1 (a INT, b LONGBLOB);
INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
LEAST(a, (SELECT b FROM t1 LIMIT 1))
1
2
SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
GREATEST(a, (SELECT b FROM t1 LIMIT 1))
2
3
1
DROP TABLE t1;
End of tests
......@@ -1810,4 +1810,39 @@ MAX(t2.a)
2
DROP TABLE t1, t2;
#
# Bug#55188: GROUP BY, GROUP_CONCAT and TEXT - inconsistent results
#
CREATE TABLE t1 (a text, b varchar(10));
INSERT INTO t1 VALUES (repeat('1', 1300),'one'), (repeat('1', 1300),'two');
EXPLAIN
SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
id 1
select_type SIMPLE
table t1
type ALL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows 2
Extra Using filesort
SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
SUBSTRING(a,1,10) LENGTH(a) GROUP_CONCAT(b)
1111111111 1300 one,two
EXPLAIN
SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
id 1
select_type SIMPLE
table t1
type ALL
possible_keys NULL
key NULL
key_len NULL
ref NULL
rows 2
Extra Using temporary; Using filesort
SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
SUBSTRING(a,1,10) LENGTH(a)
1111111111 1300
DROP TABLE t1;
# End of 5.1 tests
......@@ -530,3 +530,19 @@ MAX(t2.f2)
NULL
DROP TABLE t1,t2;
End of 5.0 tests
#
# Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set
#
CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1));
INSERT INTO t1 VALUES (1,'f');
CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1));
INSERT INTO t2 VALUES (2,'m');
INSERT INTO t2 VALUES (3,'m');
INSERT INTO t2 VALUES (11,NULL);
INSERT INTO t2 VALUES (12,'k');
SELECT MAX(t1.f1) field1
FROM t1 JOIN t2 ON t2.f2 LIKE 'x'
HAVING field1 < 7;
field1
DROP TABLE t1,t2;
End of 5.1 tests
......@@ -1757,4 +1757,21 @@ WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables';
COLUMN_DEFAULT TABLE_NAME
NULL variables
DROP TABLE variables;
#
# Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19,
# should be 20
#
CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED);
SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION
FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig';
TABLE_NAME COLUMN_NAME NUMERIC_PRECISION
ubig a 19
ubig b 20
INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
SELECT length(CAST(b AS CHAR)) FROM ubig;
length(CAST(b AS CHAR))
20
DROP TABLE ubig;
End of 5.1 tests.
......@@ -503,4 +503,33 @@ DROP TABLE t1;
CREATE TABLE t1 (id INT NOT NULL);
LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;
DROP TABLE t1;
#
# Bug #51876 : crash/memory underrun when loading data with ucs2
# and reverse() function
#
# Problem # 1 (original report): wrong parsing of ucs2 data
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
Warnings:
Warning 1366 Incorrect integer value: '00' for column 'a' at row 1
Warning 1366 Incorrect integer value: '10' for column 'a' at row 2
# should return 2 zeroes (as the value is truncated)
SELECT * FROM t1;
a
0
0
DROP TABLE t1;
# Problem # 2 : if you write and read ucs2 data to a file they're lost
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
# should return 0 and 1 (10 reversed)
SELECT * FROM t1;
a
0
1
DROP TABLE t1;
End of 5.1 tests
......@@ -56,6 +56,7 @@ CREATE DATABASE `TEST_$1`;
SHOW DATABASES LIKE "TEST%";
Database (TEST%)
TEST_$1
test
DROP DATABASE `test_$1`;
CREATE TABLE T1 (a int) engine=innodb;
INSERT INTO T1 VALUES (1);
......@@ -171,6 +172,6 @@ create table myUC (i int);
select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES
where TABLE_SCHEMA ='mysqltest_LC2';
TABLE_SCHEMA TABLE_NAME
mysqltest_LC2 myUC
mysqltest_lc2 myUC
use test;
drop database mysqltest_LC2;
......@@ -148,3 +148,20 @@ a
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests.
#
# Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
# returns nothing
#
CREATE TABLE `ttt` (
`f1` char(3) NOT NULL,
PRIMARY KEY (`f1`)
) ENGINE=myisam DEFAULT CHARSET=latin1;
SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
'TTT';
count(COLUMN_NAME)
1
SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
count(*)
1
DROP TABLE `ttt`;
End of 5.0 tests.
SET @old_general_log= @@global.general_log;
SET @old_slow_query_log= @@global.slow_query_log;
ok
SET @@global.general_log= @old_general_log;
SET @@global.slow_query_log= @old_slow_query_log;
......@@ -169,3 +169,45 @@ DROP PROCEDURE testproc;
WARNING: NULL values of the 'character_set_client' column ('mysql.proc' table) have been updated with a default value (latin1). Please verify if necessary.
WARNING: NULL values of the 'collation_connection' column ('mysql.proc' table) have been updated with a default value (latin1_swedish_ci). Please verify if necessary.
WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been updated with default values. Please verify if necessary.
#
# Bug #53613: mysql_upgrade incorrectly revokes
# TRIGGER privilege on given table
#
GRANT USAGE ON *.* TO 'user3'@'%';
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
Run mysql_upgrade with all privileges on a user
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log
Error : You can't use locks with log tables.
status : OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
mysql.slow_log
Error : You can't use locks with log tables.
status : OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
SHOW GRANTS FOR 'user3'@'%';
Grants for user3@%
GRANT USAGE ON *.* TO 'user3'@'%'
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'
DROP USER 'user3'@'%';
End of 5.1 tests
......@@ -527,3 +527,17 @@ ERROR HY000: You are using safe update mode and you tried to update a table with
SET SESSION sql_safe_updates = DEFAULT;
DROP TABLE t1;
DROP VIEW v1;
#
# Bug#54734 assert in Diagnostics_area::set_ok_status
#
DROP TABLE IF EXISTS t1, not_exists;
DROP FUNCTION IF EXISTS f1;
DROP VIEW IF EXISTS v1;
CREATE TABLE t1 (PRIMARY KEY(pk)) AS SELECT 1 AS pk;
CREATE FUNCTION f1() RETURNS INTEGER RETURN (SELECT 1 FROM not_exists);
CREATE VIEW v1 AS SELECT pk FROM t1 WHERE f1() = 13;
UPDATE v1 SET pk = 7 WHERE pk > 0;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;
This diff is collapsed.
This diff is collapsed.
......@@ -328,7 +328,7 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
SELECT table_schema,table_name FROM information_schema.tables
WHERE table_schema = 'information_schema' AND table_name = 'tables';
table_schema table_name
information_schema tables
information_schema TABLES
SELECT * FROM information_schema.table_privileges
WHERE table_schema = 'information_schema';
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
......
......@@ -450,9 +450,9 @@ NULL test tb1 f27 27 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zero
NULL test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
NULL test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
NULL test tb1 f3 3 NULL YES char 0 0 NULL NULL latin1 latin1_swedish_ci char(0) select,insert,update,references
NULL test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f33 33 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
NULL test tb1 f34 34 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
NULL test tb1 f35 35 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
......@@ -565,9 +565,9 @@ NULL test tb3 f143 26 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned s
NULL test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
NULL test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
NULL test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
NULL test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
NULL test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
NULL test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
......
......@@ -437,9 +437,9 @@ NULL test tb1 f27 19 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zero
NULL test tb1 f28 20 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
NULL test tb1 f29 21 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
NULL test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references
NULL test tb1 f30 22 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb1 f31 23 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f32 24 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f30 22 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb1 f31 23 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f32 24 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f33 25 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
NULL test tb1 f34 26 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
NULL test tb1 f35 27 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
......@@ -540,9 +540,9 @@ NULL test tb3 f143 20 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned s
NULL test tb3 f144 21 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
NULL test tb3 f145 22 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
NULL test tb3 f146 23 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
NULL test tb3 f147 24 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f147 24 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f150 27 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
NULL test tb3 f151 28 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
NULL test tb3 f152 29 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
......
......@@ -479,9 +479,9 @@ NULL test tb1 f27 27 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zero
NULL test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
NULL test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
NULL test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references
NULL test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb1 f33 33 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
NULL test tb1 f34 34 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
NULL test tb1 f35 35 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
......@@ -602,9 +602,9 @@ NULL test tb3 f143 26 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned s
NULL test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
NULL test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
NULL test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
NULL test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
NULL test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
NULL test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
NULL test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
......
......@@ -97,13 +97,13 @@ NULL mysql host Select_priv 3 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum(
NULL mysql host Show_view_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
NULL mysql host Trigger_priv 20 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
NULL mysql host Update_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
NULL mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references
NULL mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references
NULL mysql ndb_binlog_index File 2 NULL NO varchar 255 255 NULL NULL latin1 latin1_swedish_ci varchar(255) select,insert,update,references
NULL mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
NULL mysql plugin dl 2 NO char 128 384 NULL NULL utf8 utf8_bin char(128) select,insert,update,references
NULL mysql plugin name 1 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references
NULL mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL longblob select,insert,update,references
......
DROP TABLE IF EXISTS bug_53756 ;
CREATE TABLE bug_53756 (pk INT, c1 INT) ENGINE=InnoDB;
ALTER TABLE bug_53756 ADD PRIMARY KEY (pk);
INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44);
# Select a less restrictive isolation level.
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
COMMIT;
# Start a transaction in the default connection for isolation.
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
SELECT * FROM bug_53756;
pk c1
1 11
2 22
3 33
4 44
# connection con1 deletes row 1
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
DELETE FROM bug_53756 WHERE pk=1;
# connection con2 deletes row 2
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
DELETE FROM bug_53756 WHERE pk=2;
# connection con3 updates row 3
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
UPDATE bug_53756 SET c1=77 WHERE pk=3;
# connection con4 updates row 4
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
UPDATE bug_53756 SET c1=88 WHERE pk=4;
# connection con5 inserts row 5
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
INSERT INTO bug_53756 VALUES(5, 55);
# connection con6 inserts row 6
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
READ-COMMITTED
INSERT INTO bug_53756 VALUES(6, 66);
# connection con1 commits.
COMMIT;
# connection con3 commits.
COMMIT;
# connection con4 rolls back.
ROLLBACK;
# connection con6 rolls back.
ROLLBACK;
# The connections 2 and 5 stay open.
# connection default selects resulting data.
# Delete of row 1 was committed.
# Update of row 3 was committed.
# Due to isolation level read committed, these should be included.
# All other changes should not be included.
SELECT * FROM bug_53756;
pk c1
2 22
3 77
4 44
# connection default
#
# Crash server.
START TRANSACTION;
INSERT INTO bug_53756 VALUES (666,666);
SET SESSION debug="+d,crash_commit_before";
COMMIT;
ERROR HY000: Lost connection to MySQL server during query
#
# disconnect con1, con2, con3, con4, con5, con6.
#
# Restart server.
#
# Select recovered data.
# Delete of row 1 was committed.
# Update of row 3 was committed.
# These should be included.
# All other changes should not be included.
# Delete of row 2 and insert of row 5 should be rolled back
SELECT * FROM bug_53756;
pk c1
2 22
3 77
4 44
# Clean up.
DROP TABLE bug_53756;
......@@ -2499,4 +2499,12 @@ ORDER BY f1 DESC LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where
DROP TABLE t1;
#
# Bug#54117 crash in thr_multi_unlock, temporary table
#
CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB;
LOCK TABLES t1 READ;
ALTER TABLE t1 COMMENT 'test';
UNLOCK TABLES;
DROP TABLE t1;
End of 5.1 tests
--skip-stack-trace --skip-core-file
# This is the test case for bug #53756. Alter table operation could
# leave a deleted record for the temp table (later renamed to the altered
# table) in the SYS_TABLES secondary index, we should ignore this row and
# find the first non-deleted row for the specified table_id when load table
# metadata in the function dict_load_table_on_id() during crash recovery.
#
# innobackup needs to connect to the server. Not supported in embedded.
--source include/not_embedded.inc
#
# This test case needs to crash the server. Needs a debug server.
--source include/have_debug.inc
#
# Don't test this under valgrind, memory leaks will occur.
--source include/not_valgrind.inc
#
# This test case needs InnoDB.
--source include/have_innodb.inc
#
# Precautionary clean up.
#
--disable_warnings
DROP TABLE IF EXISTS bug_53756 ;
--enable_warnings
#
# Create test data.
#
CREATE TABLE bug_53756 (pk INT, c1 INT) ENGINE=InnoDB;
ALTER TABLE bug_53756 ADD PRIMARY KEY (pk);
INSERT INTO bug_53756 VALUES(1, 11), (2, 22), (3, 33), (4, 44);
--echo
--echo # Select a less restrictive isolation level.
# Don't use user variables. They won't survive server crash.
--let $global_isolation= `SELECT @@global.tx_isolation`;
--let $session_isolation= `SELECT @@session.tx_isolation`;
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
COMMIT;
--echo
--echo # Start a transaction in the default connection for isolation.
START TRANSACTION;
SELECT @@tx_isolation;
SELECT * FROM bug_53756;
--echo
--echo # connection con1 deletes row 1
--connect (con1,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
DELETE FROM bug_53756 WHERE pk=1;
--echo
--echo # connection con2 deletes row 2
--connect (con2,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
DELETE FROM bug_53756 WHERE pk=2;
--echo
--echo # connection con3 updates row 3
--connect (con3,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
UPDATE bug_53756 SET c1=77 WHERE pk=3;
--echo
--echo # connection con4 updates row 4
--connect (con4,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
UPDATE bug_53756 SET c1=88 WHERE pk=4;
--echo
--echo # connection con5 inserts row 5
--connect (con5,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
INSERT INTO bug_53756 VALUES(5, 55);
--echo
--echo # connection con6 inserts row 6
--connect (con6,localhost,root,,)
START TRANSACTION;
SELECT @@tx_isolation;
INSERT INTO bug_53756 VALUES(6, 66);
--echo
--echo # connection con1 commits.
--connection con1
COMMIT;
--echo
--echo # connection con3 commits.
--connection con3
COMMIT;
--echo
--echo # connection con4 rolls back.
--connection con4
ROLLBACK;
--echo
--echo # connection con6 rolls back.
--connection con6
ROLLBACK;
--echo
--echo # The connections 2 and 5 stay open.
--echo
--echo # connection default selects resulting data.
--echo # Delete of row 1 was committed.
--echo # Update of row 3 was committed.
--echo # Due to isolation level read committed, these should be included.
--echo # All other changes should not be included.
--connection default
SELECT * FROM bug_53756;
--echo
--echo # connection default
--connection default
--echo #
--echo # Crash server.
#
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#
START TRANSACTION;
INSERT INTO bug_53756 VALUES (666,666);
#
# Request a crash on next execution of commit.
SET SESSION debug="+d,crash_commit_before";
#
# Execute the statement that causes the crash.
--error 2013
COMMIT;
--echo
--echo #
--echo # disconnect con1, con2, con3, con4, con5, con6.
--disconnect con1
--disconnect con2
--disconnect con3
--disconnect con4
--disconnect con5
--disconnect con6
--echo #
--echo # Restart server.
#
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
#
# Turn on reconnect
--enable_reconnect
#
# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc
#
# Turn off reconnect again
--disable_reconnect
--echo
--echo #
--echo # Select recovered data.
--echo # Delete of row 1 was committed.
--echo # Update of row 3 was committed.
--echo # These should be included.
--echo # All other changes should not be included.
--echo # Delete of row 2 and insert of row 5 should be rolled back
SELECT * FROM bug_53756;
--echo
--echo # Clean up.
DROP TABLE bug_53756;
--disable_query_log
eval SET GLOBAL tx_isolation= '$global_isolation';
eval SET SESSION tx_isolation= '$session_isolation';
--enable_query_log
......@@ -737,4 +737,18 @@ ORDER BY f1 DESC LIMIT 5;
DROP TABLE t1;
--echo #
--echo # Bug#54117 crash in thr_multi_unlock, temporary table
--echo #
CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB;
LOCK TABLES t1 READ;
ALTER TABLE t1 COMMENT 'test';
UNLOCK TABLES;
DROP TABLE t1;
--echo End of 5.1 tests
#
# Bug#54453: Failing assertion: trx->active_trans when renaming a table with active trx
#
DROP TABLE IF EXISTS bug54453;
CREATE TABLE bug54453(a INT) ENGINE=InnoDB;
ALTER TABLE bug54453 RENAME TO bug54453_2;
SELECT * FROM bug54453_2;
a
DROP TABLE bug54453_2;
-- source include/have_innodb_plugin.inc
# embedded server ignores 'delayed', so skip this
-- source include/not_embedded.inc
# remove the next line after bug #55503 is fixed
-- source include/not_valgrind.inc
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
......
-- source include/have_innodb_plugin.inc
# embedded server ignores 'delayed', so skip this
-- source include/not_embedded.inc
# remove the next line after bug #55503 is fixed
-- source include/not_valgrind.inc
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
......
--source include/have_innodb_plugin.inc
--source include/have_log_bin.inc
--echo #
--echo # Bug#54453: Failing assertion: trx->active_trans when renaming a table with active trx
--echo #
--disable_warnings
DROP TABLE IF EXISTS bug54453;
--enable_warnings
CREATE TABLE bug54453(a INT) ENGINE=InnoDB;
ALTER TABLE bug54453 RENAME TO bug54453_2;
SELECT * FROM bug54453_2;
DROP TABLE bug54453_2;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1(c1 INT);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT)
# Case 1:
# ------------------------------------------------------------------
# In a statement, some CCs are applied while others are not. The CCs
# which are not applied on master will be binlogged as common comments.
/*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; /* 99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /* 99999 ,(11)*/
Comparing tables master:test.t1 and slave:test.t1
# Case 2:
# -----------------------------------------------------------------
# Verify whether it can be binlogged correctly when executing prepared
# statement.
PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/';
EXECUTE stmt;
DROP TABLE t1;
CREATE TABLE t1(c1 INT);
EXECUTE stmt;
Comparing tables master:test.t1 and slave:test.t1
SET @value=62;
PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/';
EXECUTE stmt USING @value;
DROP TABLE t1;
CREATE TABLE t1(c1 INT);
EXECUTE stmt USING @value;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/
master-bin.000001 # Query # # use `test`; DROP TABLE t1
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT)
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/
master-bin.000001 # Query # # use `test`; DROP TABLE t1
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(c1 INT)
master-bin.000001 # Query # # use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/
Comparing tables master:test.t1 and slave:test.t1
# Case 3:
# -----------------------------------------------------------------
# Verify it can restore the '!', if the it is an uncomplete conditional
# comments
SELECT c1 FROM /*!99999 t1 WHEREN;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*!99999 t1 WHEREN' at line 1
DROP TABLE t1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
# On slave2
# Connect slave2 to slave
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_MYPORT;,
MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root';
START SLAVE;
# [On master]
DROP VIEW IF EXISTS v_user;
DROP VIEW IF EXISTS v_tables_priv;
DROP VIEW IF EXISTS v_procs_priv;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS my_grant;
DROP PROCEDURE IF EXISTS my_revoke;
DROP FUNCTION IF EXISTS my_user;
DROP EVENT IF EXISTS e1;
CREATE TABLE t1(c1 char(100));
CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%';
CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%';
CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%';
CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1';
CREATE PROCEDURE p1() SELECT 1;
# bug48321_1-01234 has the max length(16) of user.
GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION;
# Make sure the max lengths of user and host
# the user name is too lengh
GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost';
ERROR HY000: String '01234567890123456' is too long for user name (should be no longer than 16)
# the host name is too lengh
GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890';
ERROR HY000: String '0123456789012345678901234567890123456789012345678901234567890' is too long for host name (should be no longer than 60)
# User 'bug48321_1-01234' connects to master by conn1
# [On conn1]
# Verify 'REVOKE ALL' statement
REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER();
Comparing tables master:test.v_user and slave:test.v_user
Comparing tables master:test.v_user and slave2:test.v_user
# Verify 'GRANT ... ON TABLE ...' statement
GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
# Verify 'GRANT ... ON PROCEDURE...' statement
GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER();
Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv
Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv
# Verify 'GRANT ... ON *.* ...' statement
GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION;
Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv
Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv
# Verify 'REVOKE ... ON TABLE ...' statement
REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
# Verify 'REVOKE ... ON PROCEDURE...' statement
REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER();
Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv
Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv
# Verify 'REVOKE ... ON *.* ...' statement
REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER();
Comparing tables master:test.v_user and slave:test.v_user
Comparing tables master:test.v_user and slave2:test.v_user
# Verify 'GRANT ...' statement in the procedure
CREATE PROCEDURE my_grant()
GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
call my_grant;
Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
# Verify 'REVOKE ... ON TABLE ...' statement in the procedure
CREATE PROCEDURE my_revoke()
REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
call my_revoke;
Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
# Verify 'RENAME USER ...' statement
RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost';
Comparing tables master:test.v_user and slave:test.v_user
Comparing tables master:test.v_user and slave2:test.v_user
# Verify 'DROP USER ...' statement
GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost';
DROP USER CURRENT_USER();
Comparing tables master:test.v_user and slave:test.v_user
Comparing tables master:test.v_user and slave2:test.v_user
# Verify 'ALTER EVENT...' statement
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1;
# Explicitly assign CURRENT_USER() to definer
ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE;
Comparing tables master:test.v_event and slave:test.v_event
Comparing tables master:test.v_event and slave2:test.v_event
# Session user will be set as definer, if the statement does not assign
# a definer
ALTER EVENT e1 ENABLE;
Comparing tables master:test.v_event and slave:test.v_event
Comparing tables master:test.v_event and slave2:test.v_event
# Verify that this patch does not affect the calling of CURRENT_USER()
# in the other statements
# [On master]
INSERT INTO t1 VALUES(CURRENT_USER()), ('1234');
Warnings:
Note 1592 Statement may not be safe to log in statement format.
SELECT * FROM t1;
c1
root@localhost
1234
# [On slave]
SELECT * FROM t1;
c1
@
1234
# [On slave2]
SELECT * FROM t1;
c1
@
1234
# [On master]
UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234';
Warnings:
Note 1592 Statement may not be safe to log in statement format.
SELECT * FROM t1;
c1
root@localhost
root@localhost
# [On slave]
SELECT * FROM t1;
c1
@
@
# [On slave2]
SELECT * FROM t1;
c1
@
@
# [On master]
DELETE FROM t1 WHERE c1=CURRENT_USER();
Warnings:
Note 1592 Statement may not be safe to log in statement format.
SELECT * FROM t1;
c1
# [On slave]
SELECT * FROM t1;
c1
# [On slave2]
SELECT * FROM t1;
c1
# [On master]
CREATE TABLE t2(c1 char(100));
CREATE FUNCTION my_user() RETURNS VARCHAR(64)
SQL SECURITY INVOKER
BEGIN
INSERT INTO t2 VALUES(CURRENT_USER());
RETURN CURRENT_USER();
END |
INSERT INTO t1 VALUES(my_user());
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Statement may not be safe to log in statement format.
SELECT * FROM t1;
c1
root@localhost
SELECT * FROM t2;
c1
root@localhost
# [On slave]
SELECT * FROM t1;
c1
@
SELECT * FROM t2;
c1
@
# [On slave2]
SELECT * FROM t1;
c1
@
SELECT * FROM t2;
c1
@
# END
DROP TABLE t1, t2;
DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event;
DROP PROCEDURE p1;
DROP PROCEDURE my_grant;
DROP PROCEDURE my_revoke;
DROP FUNCTION my_user;
DROP EVENT e1;
......@@ -8,3 +8,27 @@ drop table if exists t1, t2;
create table t1 (a int);
drop table t1, t2;
ERROR 42S02: Unknown table 't2'
include/stop_slave.inc
SET @old_binlog_format= @@global.binlog_format;
SET GLOBAL binlog_format = ROW;
include/start_slave.inc
SET @old_binlog_format= @@global.binlog_format;
SET binlog_format = ROW;
CREATE TABLE t2(a INT) ENGINE=MYISAM;
CREATE TABLE t3(a INT) ENGINE=INNODB;
CREATE FUNCTION f1() RETURNS INT
BEGIN
insert into t2 values(1);
insert into t3 values(1);
return 1;
END|
CREATE TABLE t1(UNIQUE(a)) ENGINE=MYISAM SELECT 1 AS a UNION ALL SELECT f1();
ERROR 23000: Duplicate entry '1' for key 'a'
CREATE TABLE t1(UNIQUE(a)) ENGINE=INNODB SELECT 1 AS a UNION ALL SELECT f1();
ERROR 23000: Duplicate entry '1' for key 'a'
show binlog events in 'master-bin.000001' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
DROP FUNCTION f1;
DROP TABLE t2, t3;
SET @@global.binlog_format= @old_binlog_format;
SET @@global.binlog_format= @old_binlog_format;
......@@ -750,7 +750,7 @@ test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 lat
USE test_rpl;
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
test_rpl e2 @ SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
==========MASTER==========
SELECT COUNT(*) FROM t1;
COUNT(*)
......
......@@ -49,6 +49,14 @@ Slave_IO_Running = No (expect No)
SELECT "Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'" AS Last_IO_Error;
Last_IO_Error
Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master'
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
SET @max_allowed_packet_0= @@session.max_allowed_packet;
SHOW BINLOG EVENTS;
SET @max_allowed_packet_1= @@session.max_allowed_packet;
SHOW BINLOG EVENTS;
SET @max_allowed_packet_2= @@session.max_allowed_packet;
==== clean up ====
DROP TABLE t1;
SET @@global.max_allowed_packet= 1024;
......
###############################################################################
# After the patch for BUG#49124:
# - Use ' ' instead of '!' in the conditional comments which are not applied on
# master. So they become common comments and will not be applied on slave.
#
# - Example:
# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!99999 ,(3)*/
# will be binlogged as
# 'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/'.
###############################################################################
source include/master-slave.inc;
source include/have_binlog_format_statement.inc;
CREATE TABLE t1(c1 INT);
source include/show_binlog_events.inc;
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo
--echo # Case 1:
--echo # ------------------------------------------------------------------
--echo # In a statement, some CCs are applied while others are not. The CCs
--echo # which are not applied on master will be binlogged as common comments.
/*!99999 --- */INSERT /*!INTO*/ /*!10000 t1 */ VALUES(10) /*!99999 ,(11)*/;
source include/show_binlog_events.inc;
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
sync_slave_with_master;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
source include/diff_tables.inc;
--echo
--echo # Case 2:
--echo # -----------------------------------------------------------------
--echo # Verify whether it can be binlogged correctly when executing prepared
--echo # statement.
PREPARE stmt FROM 'INSERT INTO /*!99999 blabla*/ t1 VALUES(60) /*!99999 ,(61)*/';
EXECUTE stmt;
DROP TABLE t1;
CREATE TABLE t1(c1 INT);
EXECUTE stmt;
sync_slave_with_master;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
source include/diff_tables.inc;
--echo
SET @value=62;
PREPARE stmt FROM 'INSERT INTO /*!99999 blabla */ t1 VALUES(?) /*!99999 ,(63)*/';
EXECUTE stmt USING @value;
DROP TABLE t1;
CREATE TABLE t1(c1 INT);
EXECUTE stmt USING @value;
source include/show_binlog_events.inc;
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
sync_slave_with_master;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
source include/diff_tables.inc;
--echo
--echo # Case 3:
--echo # -----------------------------------------------------------------
--echo # Verify it can restore the '!', if the it is an uncomplete conditional
--echo # comments
--error 1064
SELECT c1 FROM /*!99999 t1 WHEREN;
DROP TABLE t1;
source include/master-slave-end.inc;
!include ../my.cnf
[mysqld.3]
server-id=3
log-bin=slave-bin
[ENV]
SLAVE_MYPORT1= @mysqld.3.port
SLAVE_MYSOCK1= @mysqld.3.socket
##############################################################################
# BUG#48321 CURRENT_USER() incorrectly replicated for DROP/RENAME USER,
# REVOKE, GRANT, ALTER EVENT
#
# Calling CURRENT_USER() results into inconsistency between slave and master,
# as the slave SQL thread has different user with common users.
#
# After the patch for bug#48321, session's user will be written into query log
# event if CURRENT_USER() is called in 'DROP/RENAME USER', 'REVOKE', 'GRANT',
# 'ALTER EVENT'.
#
##############################################################################
source include/master-slave.inc;
source include/have_binlog_format_statement.inc;
--echo
--echo # On slave2
connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
connection slave2;
--echo # Connect slave2 to slave
--replace_result $SLAVE_MYPORT SLAVE_MYPORT;
eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT,
MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root';
START SLAVE;
source include/wait_for_slave_to_start.inc;
--echo
--echo # [On master]
connection master;
--disable_warnings
DROP VIEW IF EXISTS v_user;
DROP VIEW IF EXISTS v_tables_priv;
DROP VIEW IF EXISTS v_procs_priv;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS my_grant;
DROP PROCEDURE IF EXISTS my_revoke;
DROP FUNCTION IF EXISTS my_user;
DROP EVENT IF EXISTS e1;
--enable_warnings
CREATE TABLE t1(c1 char(100));
CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%';
CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%';
CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%';
CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1';
CREATE PROCEDURE p1() SELECT 1;
--echo # bug48321_1-01234 has the max length(16) of user.
GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION;
--echo
--echo # Make sure the max lengths of user and host
--echo # the user name is too lengh
--error 1470
GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost';
--echo # the host name is too lengh
--error 1470
GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890';
--echo
--echo # User 'bug48321_1-01234' connects to master by conn1
connect (conn1, 127.0.0.1, 'bug48321_1-01234'@'localhost',,);
connection conn1;
--echo # [On conn1]
--echo # Verify 'REVOKE ALL' statement
REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER();
let $diff_table= test.v_user;
let $diff_server_list= master, slave, slave2;
source include/rpl_diff_tables.inc;
--echo
--echo # Verify 'GRANT ... ON TABLE ...' statement
connection conn1;
GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
let $diff_table= test.v_tables_priv;
source include/rpl_diff_tables.inc;
--echo
--echo # Verify 'GRANT ... ON PROCEDURE...' statement
connection conn1;
GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER();
let $diff_table= test.v_procs_priv;
source include/rpl_diff_tables.inc;
--echo
--echo # Verify 'GRANT ... ON *.* ...' statement
connection conn1;
GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION;
source include/rpl_diff_tables.inc;
--echo
--echo # Verify 'REVOKE ... ON TABLE ...' statement
connection conn1;
REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
let $diff_table= test.v_tables_priv;
source include/rpl_diff_tables.inc;
--echo
--echo # Verify 'REVOKE ... ON PROCEDURE...' statement
connection conn1;
REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER();
let $diff_table= test.v_procs_priv;
source include/rpl_diff_tables.inc;
--echo
--echo # Verify 'REVOKE ... ON *.* ...' statement
connection conn1;
REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER();
let $diff_table= test.v_user;
source include/rpl_diff_tables.inc;
--echo
--echo # Verify 'GRANT ...' statement in the procedure
connection conn1;
CREATE PROCEDURE my_grant()
GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
call my_grant;
let $diff_table= test.v_tables_priv;
source include/rpl_diff_tables.inc;
--echo
--echo # Verify 'REVOKE ... ON TABLE ...' statement in the procedure
connection conn1;
CREATE PROCEDURE my_revoke()
REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
call my_revoke;
let $diff_table= test.v_tables_priv;
source include/rpl_diff_tables.inc;
--echo
--echo # Verify 'RENAME USER ...' statement
connection conn1;
RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost';
let $diff_table= test.v_user;
source include/rpl_diff_tables.inc;
disconnect conn1;
--echo
--echo # Verify 'DROP USER ...' statement
connection master;
GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost';
connect (conn1, 127.0.0.1, 'bug48321_2'@'localhost',,);
connection conn1;
DROP USER CURRENT_USER();
source include/rpl_diff_tables.inc;
--echo
--echo # Verify 'ALTER EVENT...' statement
connection master;
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1;
--echo # Explicitly assign CURRENT_USER() to definer
ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE;
let $diff_table= test.v_event;
source include/rpl_diff_tables.inc;
connection master;
--echo
--echo # Session user will be set as definer, if the statement does not assign
--echo # a definer
ALTER EVENT e1 ENABLE;
sync_slave_with_master;
source include/rpl_diff_tables.inc;
--echo
--echo # Verify that this patch does not affect the calling of CURRENT_USER()
--echo # in the other statements
connection master;
--echo # [On master]
INSERT INTO t1 VALUES(CURRENT_USER()), ('1234');
SELECT * FROM t1;
sync_slave_with_master;
--echo # [On slave]
SELECT * FROM t1;
--echo # [On slave2]
sync_slave_with_master slave2;
SELECT * FROM t1;
connection master;
--echo # [On master]
UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234';
SELECT * FROM t1;
sync_slave_with_master;
--echo # [On slave]
SELECT * FROM t1;
sync_slave_with_master slave2;
--echo # [On slave2]
SELECT * FROM t1;
connection master;
--echo # [On master]
DELETE FROM t1 WHERE c1=CURRENT_USER();
SELECT * FROM t1;
sync_slave_with_master;
--echo # [On slave]
SELECT * FROM t1;
sync_slave_with_master slave2;
--echo # [On slave2]
SELECT * FROM t1;
connection master;
--echo # [On master]
CREATE TABLE t2(c1 char(100));
DELIMITER |;
CREATE FUNCTION my_user() RETURNS VARCHAR(64)
SQL SECURITY INVOKER
BEGIN
INSERT INTO t2 VALUES(CURRENT_USER());
RETURN CURRENT_USER();
END |
DELIMITER ;|
INSERT INTO t1 VALUES(my_user());
SELECT * FROM t1;
SELECT * FROM t2;
sync_slave_with_master;
--echo # [On slave]
SELECT * FROM t1;
SELECT * FROM t2;
sync_slave_with_master slave2;
--echo # [On slave2]
SELECT * FROM t1;
SELECT * FROM t2;
--echo
--echo # END
connection master;
DROP TABLE t1, t2;
DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event;
DROP PROCEDURE p1;
DROP PROCEDURE my_grant;
DROP PROCEDURE my_revoke;
DROP FUNCTION my_user;
DROP EVENT e1;
sync_slave_with_master;
sync_slave_with_master slave2;
source include/master-slave-end.inc;
# Testcase for BUG#4552 (DROP on two tables, one of which does not
# exist, must be binlogged with a non-zero error code)
source include/master-slave.inc;
source include/have_innodb.inc;
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
......@@ -10,7 +11,57 @@ drop table t1, t2;
save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests
# BUG#55625 RBR breaks on failing 'CREATE TABLE'
# A CREATE...SELECT that fails is written to the binary log if a non-transactional
# statement is updated. If the logging format is ROW, the CREATE statement and the
# changes are written to the binary log as distinct events and by consequence the
# created table is not rolled back in the slave.
# To fix the problem, we do not write a CREATE...SELECT that fails to the binary
# log. Howerver, the changes to non-transactional tables are not replicated and
# thus the slave goes out of sync. This should be fixed after BUG#47899.
#
# In the test case, we verify if the binary log contains no information for a
# CREATE...SELECT that fails.
connection slave;
--source include/stop_slave.inc
SET @old_binlog_format= @@global.binlog_format;
SET GLOBAL binlog_format = ROW;
--source include/start_slave.inc
connection master;
SET @old_binlog_format= @@global.binlog_format;
SET binlog_format = ROW;
CREATE TABLE t2(a INT) ENGINE=MYISAM;
CREATE TABLE t3(a INT) ENGINE=INNODB;
delimiter |;
CREATE FUNCTION f1() RETURNS INT
BEGIN
insert into t2 values(1);
insert into t3 values(1);
return 1;
END|
delimiter ;|
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
let $binlog_file= query_get_value("SHOW MASTER STATUS", File, 1);
--error 1062
CREATE TABLE t1(UNIQUE(a)) ENGINE=MYISAM SELECT 1 AS a UNION ALL SELECT f1();
--error 1062
CREATE TABLE t1(UNIQUE(a)) ENGINE=INNODB SELECT 1 AS a UNION ALL SELECT f1();
--source include/show_binlog_events.inc
DROP FUNCTION f1;
DROP TABLE t2, t3;
SET @@global.binlog_format= @old_binlog_format;
--sync_slave_with_master
SET @@global.binlog_format= @old_binlog_format;
# End of 5.1 tests
# ==== Purpose ====
#
# Check replication protocol packet size handling
# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
#
# ==== Related bugs ====
# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits
# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors
# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
# max-out size db name
source include/master-slave.inc;
......@@ -119,6 +124,38 @@ let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1);
let $last_io_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
eval SELECT "$last_io_error" AS Last_IO_Error;
# Remove the bad binlog and clear error status on slave.
STOP SLAVE;
RESET SLAVE;
--connection master
RESET MASTER;
#
# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
#
# In BUG#55322, @@session.max_allowed_packet increased each time SHOW
# BINLOG EVENTS was issued. To verify that this bug is fixed, we
# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet
# never changes. We turn off the result log because we don't care
# about the contents of the binlog.
--disable_result_log
SET @max_allowed_packet_0= @@session.max_allowed_packet;
SHOW BINLOG EVENTS;
SET @max_allowed_packet_1= @@session.max_allowed_packet;
SHOW BINLOG EVENTS;
SET @max_allowed_packet_2= @@session.max_allowed_packet;
--enable_result_log
if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`)
{
--echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS
--source include/show_rpl_debug_info.inc
SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2;
--die @max_allowed_packet changed after executing SHOW BINLOG EVENTS
}
--echo ==== clean up ====
connection master;
DROP TABLE t1;
......
......@@ -708,6 +708,7 @@ SELECT 1 FROM
DROP TABLE t1;
--echo End of 5.0 tests
--echo #
--echo # Bug #52397: another crash with explain extended and group_concat
......@@ -719,5 +720,18 @@ EXPLAIN EXTENDED SELECT 1 FROM
t1 t2, t1 GROUP BY t1.a) AS d;
DROP TABLE t1;
--echo #
--echo # Bug #54476: crash when group_concat and 'with rollup' in prepared statements
--echo #
--echo End of 5.0 tests
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2);
PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo End of 5.1 tests
......@@ -467,4 +467,16 @@ select NAME_CONST('_id',1234) as id;
select connection_id() > 0;
--echo #
--echo # Bug #54461: crash with longblob and union or update with subquery
--echo #
CREATE TABLE t1 (a INT, b LONGBLOB);
INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
DROP TABLE t1;
--echo End of tests
......@@ -1221,5 +1221,19 @@ DROP TABLE t1, t2;
--echo #
--echo # Bug#55188: GROUP BY, GROUP_CONCAT and TEXT - inconsistent results
--echo #
CREATE TABLE t1 (a text, b varchar(10));
INSERT INTO t1 VALUES (repeat('1', 1300),'one'), (repeat('1', 1300),'two');
query_vertical EXPLAIN
SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
query_vertical EXPLAIN
SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
DROP TABLE t1;
--echo # End of 5.1 tests
......@@ -544,3 +544,24 @@ ORDER BY t1.f2;
DROP TABLE t1,t2;
--echo End of 5.0 tests
--echo #
--echo # Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set
--echo #
CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1));
INSERT INTO t1 VALUES (1,'f');
CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1));
INSERT INTO t2 VALUES (2,'m');
INSERT INTO t2 VALUES (3,'m');
INSERT INTO t2 VALUES (11,NULL);
INSERT INTO t2 VALUES (12,'k');
SELECT MAX(t1.f1) field1
FROM t1 JOIN t2 ON t2.f2 LIKE 'x'
HAVING field1 < 7;
DROP TABLE t1,t2;
--echo End of 5.1 tests
......@@ -1455,6 +1455,22 @@ FROM INFORMATION_SCHEMA.COLUMNS
WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables';
DROP TABLE variables;
--echo #
--echo # Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19,
--echo # should be 20
--echo #
CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED);
SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION
FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig';
INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF);
SELECT length(CAST(b AS CHAR)) FROM ubig;
DROP TABLE ubig;
--echo End of 5.1 tests.
# Wait till all disconnects are completed
......
......@@ -580,4 +580,36 @@ DROP TABLE t1;
connection default;
disconnect con1;
--echo #
--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
--echo # and reverse() function
--echo #
--echo # Problem # 1 (original report): wrong parsing of ucs2 data
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
--echo # should return 2 zeroes (as the value is truncated)
SELECT * FROM t1;
DROP TABLE t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/tmpp.txt;
--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
CREATE TABLE t1(a INT);
LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
(@b) SET a=REVERSE(@b);
--echo # should return 0 and 1 (10 reversed)
SELECT * FROM t1;
DROP TABLE t1;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
--echo End of 5.1 tests
......@@ -160,4 +160,26 @@ SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;
--echo End of 5.0 tests.
--echo #
--echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
--echo # returns nothing
--echo #
CREATE TABLE `ttt` (
`f1` char(3) NOT NULL,
PRIMARY KEY (`f1`)
) ENGINE=myisam DEFAULT CHARSET=latin1;
SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
'TTT';
SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
DROP TABLE `ttt`;
--echo End of 5.0 tests.
......@@ -2,6 +2,7 @@
-- source include/not_embedded.inc
SET @old_general_log= @@global.general_log;
SET @old_slow_query_log= @@global.slow_query_log;
# We run with different binaries for normal and --embedded-server
#
......@@ -17,3 +18,4 @@ SET @old_general_log= @@global.general_log;
echo ok;
SET @@global.general_log= @old_general_log;
SET @@global.slow_query_log= @old_slow_query_log;
......@@ -108,3 +108,19 @@ CALL testproc();
DROP PROCEDURE testproc;
--cat_file $MYSQLTEST_VARDIR/tmp/41569.txt
--remove_file $MYSQLTEST_VARDIR/tmp/41569.txt
--echo #
--echo # Bug #53613: mysql_upgrade incorrectly revokes
--echo # TRIGGER privilege on given table
--echo #
GRANT USAGE ON *.* TO 'user3'@'%';
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
--echo Run mysql_upgrade with all privileges on a user
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
SHOW GRANTS FOR 'user3'@'%';
DROP USER 'user3'@'%';
--echo End of 5.1 tests
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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