Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new

into serg.mylan:/usr/home/serg/Abk/mysql-5.1


sql/ha_innodb.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_plugin.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
This commit is contained in:
unknown 2006-01-07 14:50:03 +01:00
commit 4770190ab8
129 changed files with 2801 additions and 5914 deletions

View File

@ -53,9 +53,8 @@ enum options_client
OPT_MYSQL_ONLY_PRINT, OPT_MYSQL_ONLY_PRINT,
OPT_MYSQL_LOCK_DIRECTORY, OPT_MYSQL_LOCK_DIRECTORY,
OPT_MYSQL_SLAP_SLAVE, OPT_MYSQL_SLAP_SLAVE,
OPT_MYSQL_NUMBER_OF_QUERY, OPT_MYSQL_NUMBER_OF_ROWS, OPT_MYSQL_NUMBER_OF_QUERY,
OPT_MYSQL_REPEAT_DATA, OPT_MYSQL_REPEAT_QUERY, OPT_MYSQL_PRESERVE_SCHEMA,
OPT_MYSQL_PRESERVE_SCHEMA_ENTER, OPT_MYSQL_PRESERVE_SCHEMA_EXIT,
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA, OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA,
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID

View File

@ -663,7 +663,8 @@ end:
static struct my_option my_long_options[] = static struct my_option my_long_options[] =
{ {
{"help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NETWARE__ #ifdef __NETWARE__
{"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -683,13 +684,13 @@ static struct my_option my_long_options[] =
{"character-sets-dir", OPT_CHARSETS_DIR, {"character-sets-dir", OPT_CHARSETS_DIR,
"Directory where character sets are.", (gptr*) &charsets_dir, "Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'd', "List entries for just this database (local log only).",
(gptr*) &database, (gptr*) &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF #ifndef DBUG_OFF
{"debug", '#', "Output debug log.", (gptr*) &default_dbug_option, {"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"database", 'd', "List entries for just this database (local log only).",
(gptr*) &database, (gptr*) &database, 0, GET_STR_ALLOC, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"disable-log-bin", 'D', "Disable binary log. This is useful, if you " {"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
"enabled --to-last-log and are sending the output to the same MySQL server. " "enabled --to-last-log and are sending the output to the same MySQL server. "
"This way you could avoid an endless loop. You would also like to use it " "This way you could avoid an endless loop. You would also like to use it "
@ -700,13 +701,14 @@ static struct my_option my_long_options[] =
{"force-read", 'f', "Force reading unknown binlog events.", {"force-read", 'f', "Force reading unknown binlog events.",
(gptr*) &force_opt, (gptr*) &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, (gptr*) &force_opt, (gptr*) &force_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0}, 0, 0},
{"help", '?', "Display this help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"hexdump", 'H', "Augment output with hexadecimal and ASCII event dump.", {"hexdump", 'H', "Augment output with hexadecimal and ASCII event dump.",
(gptr*) &opt_hexdump, (gptr*) &opt_hexdump, 0, GET_BOOL, NO_ARG, (gptr*) &opt_hexdump, (gptr*) &opt_hexdump, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Get the binlog from server.", (gptr*) &host, (gptr*) &host, {"host", 'h', "Get the binlog from server.", (gptr*) &host, (gptr*) &host,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"local-load", 'l', "Prepare local temporary files for LOAD DATA INFILE in the specified directory.",
(gptr*) &dirname_for_local_load, (gptr*) &dirname_for_local_load, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"offset", 'o', "Skip the first N entries.", (gptr*) &offset, (gptr*) &offset, {"offset", 'o', "Skip the first N entries.", (gptr*) &offset, (gptr*) &offset,
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p', "Password to connect to remote server.", {"password", 'p', "Password to connect to remote server.",
@ -722,15 +724,15 @@ static struct my_option my_long_options[] =
{"protocol", OPT_MYSQL_PROTOCOL, {"protocol", OPT_MYSQL_PROTOCOL,
"The protocol of connection (tcp,socket,pipe,memory).", "The protocol of connection (tcp,socket,pipe,memory).",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"read-from-remote-server", 'R', "Read binary logs from a MySQL server", {"read-from-remote-server", 'R', "Read binary logs from a MySQL server",
(gptr*) &remote_opt, (gptr*) &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, (gptr*) &remote_opt, (gptr*) &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0}, 0, 0},
{"open_files_limit", OPT_OPEN_FILES_LIMIT, {"result-file", 'r', "Direct output to a given file.", 0, 0, 0, GET_STR,
"Used to reserve file descriptors for usage by this program", REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
(gptr*) &open_files_limit, (gptr*) &open_files_limit, 0, GET_ULONG, {"server-id", OPT_SERVER_ID,
REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0}, "Extract only binlog entries created by the server having the given id.",
(gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"short-form", 's', "Just show the queries, no extra info.", {"short-form", 's', "Just show the queries, no extra info.",
(gptr*) &short_form, (gptr*) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, (gptr*) &short_form, (gptr*) &short_form, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0}, 0, 0},
@ -745,6 +747,13 @@ static struct my_option my_long_options[] =
"(you should probably use quotes for your shell to set it properly).", "(you should probably use quotes for your shell to set it properly).",
(gptr*) &start_datetime_str, (gptr*) &start_datetime_str, (gptr*) &start_datetime_str, (gptr*) &start_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"start-position", OPT_START_POSITION,
"Start reading the binlog at position N. Applies to the first binlog "
"passed on the command line.",
(gptr*) &start_position, (gptr*) &start_position, 0, GET_ULL,
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
(ulonglong)(~(uint32)0), 0, 0, 0},
{"stop-datetime", OPT_STOP_DATETIME, {"stop-datetime", OPT_STOP_DATETIME,
"Stop reading the binlog at first event having a datetime equal or " "Stop reading the binlog at first event having a datetime equal or "
"posterior to the argument; the argument must be a date and time " "posterior to the argument; the argument must be a date and time "
@ -753,24 +762,12 @@ static struct my_option my_long_options[] =
"(you should probably use quotes for your shell to set it properly).", "(you should probably use quotes for your shell to set it properly).",
(gptr*) &stop_datetime_str, (gptr*) &stop_datetime_str, (gptr*) &stop_datetime_str, (gptr*) &stop_datetime_str,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"start-position", OPT_START_POSITION,
"Start reading the binlog at position N. Applies to the first binlog "
"passed on the command line.",
(gptr*) &start_position, (gptr*) &start_position, 0, GET_ULL,
REQUIRED_ARG, BIN_LOG_HEADER_SIZE, BIN_LOG_HEADER_SIZE,
/* COM_BINLOG_DUMP accepts only 4 bytes for the position */
(ulonglong)(~(uint32)0), 0, 0, 0},
{"stop-position", OPT_STOP_POSITION, {"stop-position", OPT_STOP_POSITION,
"Stop reading the binlog at position N. Applies to the last binlog " "Stop reading the binlog at position N. Applies to the last binlog "
"passed on the command line.", "passed on the command line.",
(gptr*) &stop_position, (gptr*) &stop_position, 0, GET_ULL, (gptr*) &stop_position, (gptr*) &stop_position, 0, GET_ULL,
REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE, REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
(ulonglong)(~(my_off_t)0), 0, 0, 0}, (ulonglong)(~(my_off_t)0), 0, 0, 0},
{"server-id", OPT_SERVER_ID,
"Only extract binlog entries created by a certain server id "
"passed on the command line.",
(gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \ {"to-last-log", 't', "Requires -R. Will not stop at the end of the \
requested binlog but rather continue printing until the end of the last \ requested binlog but rather continue printing until the end of the last \
binlog of the MySQL server. If you send the output to the same MySQL server, \ binlog of the MySQL server. If you send the output to the same MySQL server, \
@ -780,11 +777,12 @@ that may lead to an endless loop.",
{"user", 'u', "Connect to the remote server as username.", {"user", 'u', "Connect to the remote server as username.",
(gptr*) &user, (gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, (gptr*) &user, (gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
0, 0}, 0, 0},
{"local-load", 'l', "Prepare local temporary files for LOAD DATA INFILE in the specified directory.",
(gptr*) &dirname_for_local_load, (gptr*) &dirname_for_local_load, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, {"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0}, 0, 0, 0, 0, 0},
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
"Used to reserve file descriptors for usage by this program",
(gptr*) &open_files_limit, (gptr*) &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,11 @@ functions */
#define _WIN32_WINNT 0x0500 #define _WIN32_WINNT 0x0500
#endif #endif
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Avoid endless warnings about sprintf() etc. being unsafe. */
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#include <sys/locking.h> #include <sys/locking.h>
#include <windows.h> #include <windows.h>
#include <math.h> /* Because of rint() */ #include <math.h> /* Because of rint() */
@ -341,6 +346,11 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_SETFILEPOINTER #define HAVE_SETFILEPOINTER
#define HAVE_VIO_READ_BUFF #define HAVE_VIO_READ_BUFF
#if defined(_WIN64) && defined(_M_X64)
/* Avoid type conflicts with built-in functions. */
#define HAVE_STRNLEN
#endif
#ifndef __NT__ #ifndef __NT__
#undef FILE_SHARE_DELETE #undef FILE_SHARE_DELETE
#define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */ #define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */

View File

@ -33,7 +33,7 @@ typedef void (*hash_free_key)(void *);
typedef struct st_hash { typedef struct st_hash {
uint key_offset,key_length; /* Length of key if const length */ uint key_offset,key_length; /* Length of key if const length */
uint records,blength,current_record; uint records, blength;
uint flags; uint flags;
DYNAMIC_ARRAY array; /* Place for hash_keys */ DYNAMIC_ARRAY array; /* Place for hash_keys */
hash_get_key get_key; hash_get_key get_key;
@ -41,6 +41,9 @@ typedef struct st_hash {
CHARSET_INFO *charset; CHARSET_INFO *charset;
} HASH; } HASH;
/* A search iterator state */
typedef uint HASH_SEARCH_STATE;
#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,B,C,D,E,F,G, H CALLER_INFO) #define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,B,C,D,E,F,G, H CALLER_INFO)
my_bool _hash_init(HASH *hash, CHARSET_INFO *charset, my_bool _hash_init(HASH *hash, CHARSET_INFO *charset,
uint default_array_elements, uint key_offset, uint default_array_elements, uint key_offset,
@ -49,12 +52,15 @@ my_bool _hash_init(HASH *hash, CHARSET_INFO *charset,
void hash_free(HASH *tree); void hash_free(HASH *tree);
void my_hash_reset(HASH *hash); void my_hash_reset(HASH *hash);
byte *hash_element(HASH *hash,uint idx); byte *hash_element(HASH *hash,uint idx);
gptr hash_search(HASH *info,const byte *key,uint length); gptr hash_search(const HASH *info, const byte *key, uint length);
gptr hash_next(HASH *info,const byte *key,uint length); gptr hash_first(const HASH *info, const byte *key, uint length,
HASH_SEARCH_STATE *state);
gptr hash_next(const HASH *info, const byte *key, uint length,
HASH_SEARCH_STATE *state);
my_bool my_hash_insert(HASH *info,const byte *data); my_bool my_hash_insert(HASH *info,const byte *data);
my_bool hash_delete(HASH *hash,byte *record); my_bool hash_delete(HASH *hash,byte *record);
my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length); my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
void hash_replace(HASH *hash, uint idx, byte *new_row); void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, byte *new_row);
my_bool hash_check(HASH *hash); /* Only in debug library */ my_bool hash_check(HASH *hash); /* Only in debug library */
#define hash_clear(H) bzero((char*) (H),sizeof(*(H))) #define hash_clear(H) bzero((char*) (H),sizeof(*(H)))

View File

@ -17,7 +17,9 @@
#ifndef _my_bitmap_h_ #ifndef _my_bitmap_h_
#define _my_bitmap_h_ #define _my_bitmap_h_
#ifdef THREAD
#include <my_pthread.h> #include <my_pthread.h>
#endif
#define MY_BIT_NONE (~(uint) 0) #define MY_BIT_NONE (~(uint) 0)

View File

@ -961,6 +961,7 @@ typedef off_t os_off_t;
#define SOCKET_EAGAIN WSAEINPROGRESS #define SOCKET_EAGAIN WSAEINPROGRESS
#define SOCKET_ETIMEDOUT WSAETIMEDOUT #define SOCKET_ETIMEDOUT WSAETIMEDOUT
#define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK #define SOCKET_EWOULDBLOCK WSAEWOULDBLOCK
#define SOCKET_EADDRINUSE WSAEADDRINUSE
#define SOCKET_ENFILE ENFILE #define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE #define SOCKET_EMFILE EMFILE
#elif defined(OS2) #elif defined(OS2)
@ -969,6 +970,7 @@ typedef off_t os_off_t;
#define SOCKET_EAGAIN SOCEINPROGRESS #define SOCKET_EAGAIN SOCEINPROGRESS
#define SOCKET_ETIMEDOUT SOCKET_EINTR #define SOCKET_ETIMEDOUT SOCKET_EINTR
#define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK #define SOCKET_EWOULDBLOCK SOCEWOULDBLOCK
#define SOCKET_EADDRINUSE SOCEADDRINUSE
#define SOCKET_ENFILE SOCENFILE #define SOCKET_ENFILE SOCENFILE
#define SOCKET_EMFILE SOCEMFILE #define SOCKET_EMFILE SOCEMFILE
#define closesocket(A) soclose(A) #define closesocket(A) soclose(A)
@ -979,6 +981,7 @@ typedef off_t os_off_t;
#define SOCKET_EAGAIN EAGAIN #define SOCKET_EAGAIN EAGAIN
#define SOCKET_ETIMEDOUT SOCKET_EINTR #define SOCKET_ETIMEDOUT SOCKET_EINTR
#define SOCKET_EWOULDBLOCK EWOULDBLOCK #define SOCKET_EWOULDBLOCK EWOULDBLOCK
#define SOCKET_EADDRINUSE EADDRINUSE
#define SOCKET_ENFILE ENFILE #define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE #define SOCKET_EMFILE EMFILE
#endif #endif

View File

@ -49,7 +49,8 @@ dist-hook:
-$(INSTALL_DATA) $(srcdir)/t/*.imtest $(distdir)/t -$(INSTALL_DATA) $(srcdir)/t/*.imtest $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.sql $(distdir)/t $(INSTALL_DATA) $(srcdir)/t/*.sql $(distdir)/t
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t -$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(srcdir)/t/*.slave-mi $(distdir)/t $(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.slave-mi $(distdir)/t
$(INSTALL_SCRIPT) $(srcdir)/t/*.sh $(distdir)/t
$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(distdir)/extra/binlog_tests $(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(distdir)/extra/binlog_tests
$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(distdir)/extra/rpl_tests $(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(distdir)/extra/rpl_tests
-$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(distdir)/extra/binlog_tests -$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(distdir)/extra/binlog_tests

View File

@ -1,28 +0,0 @@
# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
# exist.
# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
-- source include/master-slave.inc
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
connection slave;
stop slave; # don't need slave for this test
# Test logging on master
connection master;
# 'test' is the current database
create database mysqltest;
use mysqltest;
create table t1(a int, b int, unique(b));
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
# Starting from 5.0.3 LOAD DATA is replicated much in the same way as ordinary
# query so "show binlog ..." should show two events (before 5.0.3 no events
# were returned).
--replace_column 2 # 5 #
show binlog events from 102;
drop database mysqltest;

View File

@ -0,0 +1,179 @@
#################################################
# Author: JBM
# Date: 2006-01-06
# Purpose: Test test that BLOBs are replicated
# correctly.
################################################
# Includes
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
# Pre test clean up section
connection master;
--disable_warnings
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
--enable_warnings
# Start test section
--echo ***** Table Create Section ****
--echo
--disable_warnings
--replace_result $engine_type engine_type
CREATE TABLE test.t1 (c1 int not null auto_increment,
data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type;
--enable_warnings
--echo
--echo **** Data Insert Section test.t1 *****
--echo
INSERT INTO test.t1 VALUES (NULL, NULL);
INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
CHECK TABLE test.t1;
--echo
--echo **** Data Insert Validation Master Section test.t1 ****
--echo
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
save_master_pos;
connection slave;
sync_with_master;
--echo
--echo **** Data Insert Validation Slave Section test.t1 ****
--echo
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
connection master;
--echo
--echo **** Data Update Section test.t1 ****
--echo
UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
--echo
--echo **** Data Update Validation Master Section test.t1 ****
--echo
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
save_master_pos;
connection slave;
sync_with_master;
--echo
--echo **** Data Update Validation Slave Section test.t1 ****
--echo
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
connection master;
--echo
--echo **** End Test Section test.t1 ****
--echo
--echo **** Create Table test.t2 ****
--echo
--disable_warnings
--replace_result $engine_type engine_type
CREATE TABLE test.t2 (
c1 INT NOT NULL PRIMARY KEY,
c2 TEXT,
c3 INT,
c4 LONGBLOB,
KEY(c3))ENGINE=$engine_type;
--enable_warnings
--echo
--echo *** Setup Values For test.t2 ***
# x0 size 256 (current inline size)
set @x0 = '01234567012345670123456701234567';
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
# b1 length 2000+256 (blob part aligned)
set @b1 = 'b1';
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@x0);
# d1 length 3000
set @d1 = 'dd1';
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
# b2 length 20000
set @b2 = 'b2';
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
# d2 length 30000
set @d2 = 'dd2';
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
--echo
--echo **** Data Insert Section test.t2 *****
--echo
INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
--echo
--echo **** Data Insert Validation Master Section test.t2 ****
--echo
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
save_master_pos;
connection slave;
sync_with_master;
--echo
--echo **** Data Insert Validation Slave Section test.t2 ****
--echo
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
connection master;
--echo
--echo **** Data Update Section test.t2 ****
--echo
UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
--echo
--echo **** Data Update Validation Master Section test.t2 ****
--echo
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
save_master_pos;
connection slave;
sync_with_master;
--echo
--echo **** Data Update Validation Slave Section test.t2 ****
--echo
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
connection master;
--echo
# Post test clean up section
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_blob_master.sql
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > ./var/tmp/rpl_row_blob_slave.sql
--exec diff ./var/tmp/rpl_row_blob_master.sql ./var/tmp/rpl_row_blob_slave.sql
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;

View File

@ -890,7 +890,14 @@ sub mtr_exit ($) {
# cluck("Called mtr_exit()"); # cluck("Called mtr_exit()");
mtr_timer_stop_all($::glob_timers); mtr_timer_stop_all($::glob_timers);
local $SIG{HUP} = 'IGNORE'; local $SIG{HUP} = 'IGNORE';
kill('HUP', -$$); # ToDo: Signalling -$$ will only work if we are the process group
# leader (in fact on QNX it will signal our session group leader,
# which might be Do-compile or Pushbuild, causing tests to be
# aborted). So we only do it if we are the group leader. We might
# set ourselves as the group leader at startup (with
# POSIX::setpgrp(0,0)), but then care must be needed to always do
# proper child process cleanup.
kill('HUP', -$$) if $$ == getpgrp();
sleep 2; sleep 2;
exit($code); exit($code);
} }

View File

@ -805,6 +805,12 @@ sub command_line_setup () {
} }
} }
# On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
# considered different, so avoid the extra slash (/) in the socket
# paths.
my $sockdir = $opt_tmpdir;
$sockdir =~ s|/+$||;
# Put this into a hash, will be a C struct # Put this into a hash, will be a C struct
$master->[0]= $master->[0]=
@ -813,7 +819,7 @@ sub command_line_setup () {
path_myerr => "$opt_vardir/log/master.err", path_myerr => "$opt_vardir/log/master.err",
path_mylog => "$opt_vardir/log/master.log", path_mylog => "$opt_vardir/log/master.log",
path_mypid => "$opt_vardir/run/master.pid", path_mypid => "$opt_vardir/run/master.pid",
path_mysock => "$opt_tmpdir/master.sock", path_mysock => "$sockdir/master.sock",
path_myport => $opt_master_myport, path_myport => $opt_master_myport,
start_timeout => 400, # enough time create innodb tables start_timeout => 400, # enough time create innodb tables
@ -826,7 +832,7 @@ sub command_line_setup () {
path_myerr => "$opt_vardir/log/master1.err", path_myerr => "$opt_vardir/log/master1.err",
path_mylog => "$opt_vardir/log/master1.log", path_mylog => "$opt_vardir/log/master1.log",
path_mypid => "$opt_vardir/run/master1.pid", path_mypid => "$opt_vardir/run/master1.pid",
path_mysock => "$opt_tmpdir/master1.sock", path_mysock => "$sockdir/master1.sock",
path_myport => $opt_master_myport + 1, path_myport => $opt_master_myport + 1,
start_timeout => 400, # enough time create innodb tables start_timeout => 400, # enough time create innodb tables
}; };
@ -837,7 +843,7 @@ sub command_line_setup () {
path_myerr => "$opt_vardir/log/slave.err", path_myerr => "$opt_vardir/log/slave.err",
path_mylog => "$opt_vardir/log/slave.log", path_mylog => "$opt_vardir/log/slave.log",
path_mypid => "$opt_vardir/run/slave.pid", path_mypid => "$opt_vardir/run/slave.pid",
path_mysock => "$opt_tmpdir/slave.sock", path_mysock => "$sockdir/slave.sock",
path_myport => $opt_slave_myport, path_myport => $opt_slave_myport,
start_timeout => 400, start_timeout => 400,
}; };
@ -848,7 +854,7 @@ sub command_line_setup () {
path_myerr => "$opt_vardir/log/slave1.err", path_myerr => "$opt_vardir/log/slave1.err",
path_mylog => "$opt_vardir/log/slave1.log", path_mylog => "$opt_vardir/log/slave1.log",
path_mypid => "$opt_vardir/run/slave1.pid", path_mypid => "$opt_vardir/run/slave1.pid",
path_mysock => "$opt_tmpdir/slave1.sock", path_mysock => "$sockdir/slave1.sock",
path_myport => $opt_slave_myport + 1, path_myport => $opt_slave_myport + 1,
start_timeout => 300, start_timeout => 300,
}; };
@ -859,7 +865,7 @@ sub command_line_setup () {
path_myerr => "$opt_vardir/log/slave2.err", path_myerr => "$opt_vardir/log/slave2.err",
path_mylog => "$opt_vardir/log/slave2.log", path_mylog => "$opt_vardir/log/slave2.log",
path_mypid => "$opt_vardir/run/slave2.pid", path_mypid => "$opt_vardir/run/slave2.pid",
path_mysock => "$opt_tmpdir/slave2.sock", path_mysock => "$sockdir/slave2.sock",
path_myport => $opt_slave_myport + 2, path_myport => $opt_slave_myport + 2,
start_timeout => 300, start_timeout => 300,
}; };
@ -869,7 +875,7 @@ sub command_line_setup () {
path_err => "$opt_vardir/log/im.err", path_err => "$opt_vardir/log/im.err",
path_log => "$opt_vardir/log/im.log", path_log => "$opt_vardir/log/im.log",
path_pid => "$opt_vardir/run/im.pid", path_pid => "$opt_vardir/run/im.pid",
path_sock => "$opt_tmpdir/im.sock", path_sock => "$sockdir/im.sock",
port => $im_port, port => $im_port,
start_timeout => $master->[0]->{'start_timeout'}, start_timeout => $master->[0]->{'start_timeout'},
admin_login => 'im_admin', admin_login => 'im_admin',
@ -884,7 +890,7 @@ sub command_line_setup () {
server_id => 1, server_id => 1,
port => $im_mysqld1_port, port => $im_mysqld1_port,
path_datadir => "$opt_vardir/im_mysqld_1.data", path_datadir => "$opt_vardir/im_mysqld_1.data",
path_sock => "$opt_tmpdir/mysqld_1.sock", path_sock => "$sockdir/mysqld_1.sock",
path_pid => "$opt_vardir/run/mysqld_1.pid", path_pid => "$opt_vardir/run/mysqld_1.pid",
}; };
@ -893,7 +899,7 @@ sub command_line_setup () {
server_id => 2, server_id => 2,
port => $im_mysqld2_port, port => $im_mysqld2_port,
path_datadir => "$opt_vardir/im_mysqld_2.data", path_datadir => "$opt_vardir/im_mysqld_2.data",
path_sock => "$opt_tmpdir/mysqld_2.sock", path_sock => "$sockdir/mysqld_2.sock",
path_pid => "$opt_vardir/run/mysqld_2.pid", path_pid => "$opt_vardir/run/mysqld_2.pid",
nonguarded => 1, nonguarded => 1,
}; };
@ -2503,7 +2509,8 @@ sub run_mysqltest ($) {
{ {
$cmdline_mysqlslap= "$exe_mysqlslap -uroot " . $cmdline_mysqlslap= "$exe_mysqlslap -uroot " .
"--port=$master->[0]->{'path_myport'} " . "--port=$master->[0]->{'path_myport'} " .
"--socket=$master->[0]->{'path_mysock'} --password="; "--socket=$master->[0]->{'path_mysock'} --password= " .
"--lock-directory=$opt_tmpdir";
if ( $opt_debug ) if ( $opt_debug )
{ {
$cmdline_mysqlslap .= $cmdline_mysqlslap .=

View File

@ -1957,4 +1957,9 @@ d varchar(255) character set utf8,
e varchar(255) character set utf8, e varchar(255) character set utf8,
key (a,b,c,d,e)) engine=bdb; key (a,b,c,d,e)) engine=bdb;
ERROR 42000: Specified key was too long; max key length is 3072 bytes ERROR 42000: Specified key was too long; max key length is 3072 bytes
set autocommit=0;
create table t1 (a int) engine=bdb;
commit;
alter table t1 add primary key(a);
drop table t1;
End of 5.0 tests End of 5.0 tests

View File

@ -121,6 +121,7 @@ master-bin.000001 # Query 1 # use `test`; replace into t1 values(100)
master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../../std_data/words.dat' into table t2 ;file_id=1 master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../../std_data/words.dat' into table t2 ;file_id=1
master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; COMMIT
master-bin.000001 # Query 1 # use `test`; alter table t1 add b int master-bin.000001 # Query 1 # use `test`; alter table t1 add b int

View File

@ -279,7 +279,6 @@ a b
create table if not exists t1 select 3 as 'a',4 as 'b'; create table if not exists t1 select 3 as 'a',4 as 'b';
Warnings: Warnings:
Note 1050 Table 't1' already exists Note 1050 Table 't1' already exists
Warning 1364 Field 'a' doesn't have a default value
create table if not exists t1 select 3 as 'a',3 as 'b'; create table if not exists t1 select 3 as 'a',3 as 'b';
ERROR 23000: Duplicate entry '3' for key 1 ERROR 23000: Duplicate entry '3' for key 1
select * from t1; select * from t1;
@ -635,8 +634,6 @@ create table t1 (
a varchar(112) charset utf8 collate utf8_bin not null, a varchar(112) charset utf8 collate utf8_bin not null,
primary key (a) primary key (a)
) select 'test' as a ; ) select 'test' as a ;
Warnings:
Warning 1364 Field 'a' doesn't have a default value
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@ -652,9 +649,6 @@ create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null, a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a) b int not null, primary key (a)
) select a, 1 as b from t2 ; ) select a, 1 as b from t2 ;
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1364 Field 'b' doesn't have a default value
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@ -664,12 +658,37 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 ( create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a)
) select a, 1 as c from t2 ;
Warnings:
Warning 1364 Field 'b' doesn't have a default value
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) NOT NULL,
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
`c` bigint(1) NOT NULL default '0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int null, primary key (a)
) select a, 1 as c from t2 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` int(11) default NULL,
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL,
`c` bigint(1) NOT NULL default '0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null, a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a) b int not null, primary key (a)
) select 'a' as a , 1 as b from t2 ; ) select 'a' as a , 1 as b from t2 ;
Warnings:
Warning 1364 Field 'a' doesn't have a default value
Warning 1364 Field 'b' doesn't have a default value
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@ -682,8 +701,6 @@ create table t1 (
a varchar(12) charset utf8 collate utf8_bin, a varchar(12) charset utf8 collate utf8_bin,
b int not null, primary key (a) b int not null, primary key (a)
) select 'a' as a , 1 as b from t2 ; ) select 'a' as a , 1 as b from t2 ;
Warnings:
Warning 1364 Field 'b' doesn't have a default value
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@ -702,8 +719,6 @@ a1 varchar(12) charset utf8 collate utf8_bin not null,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
primary key (a1) primary key (a1)
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
Warnings:
Warning 1364 Field 'a1' doesn't have a default value
drop table t2; drop table t2;
create table t2 ( create table t2 (
a1 varchar(12) charset utf8 collate utf8_bin, a1 varchar(12) charset utf8 collate utf8_bin,
@ -719,8 +734,6 @@ a1 varchar(12) charset utf8 collate utf8_bin not null,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
primary key (a1) primary key (a1)
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ; ) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
Warnings:
Warning 1364 Field 'a1' doesn't have a default value
drop table t2; drop table t2;
create table t2 ( a int default 3, b int default 3) create table t2 ( a int default 3, b int default 3)
select a1,a2 from t1; select a1,a2 from t1;

View File

@ -1,4 +1,4 @@
drop table if exists t1; drop table if exists t1,t3,t4,t5;
create table t1 (a int, b char(10), key a(a), key b(a,b)); create table t1 (a int, b char(10), key a(a), key b(a,b));
insert into t1 values insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),

View File

@ -1077,6 +1077,22 @@ character_maximum_length character_octet_length
32 32 32 32
64 64 64 64
drop table t1; drop table t1;
CREATE TABLE t1 (f1 BIGINT, f2 VARCHAR(20), f3 BIGINT);
INSERT INTO t1 SET f1 = 1, f2 = 'Schoenenbourg', f3 = 1;
CREATE FUNCTION func2() RETURNS BIGINT RETURN 1;
CREATE FUNCTION func1() RETURNS BIGINT
BEGIN
RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.VIEWS);
END//
CREATE VIEW v1 AS SELECT 1 FROM t1
WHERE f3 = (SELECT func2 ());
SELECT func1();
func1()
1
DROP TABLE t1;
DROP VIEW v1;
DROP FUNCTION func1;
DROP FUNCTION func2;
select * from information_schema.engines WHERE ENGINE="MyISAM"; select * from information_schema.engines WHERE ENGINE="MyISAM";
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
MyISAM ENABLED Default engine as of MySQL 3.23 with great performance NO NO NO MyISAM ENABLED Default engine as of MySQL 3.23 with great performance NO NO NO

View File

@ -5,8 +5,6 @@ select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id) ((@id := kill_id) - kill_id)
0 0
kill @id; kill @id;
select 1;
Got one of the listed errors
select ((@id := kill_id) - kill_id) from t1; select ((@id := kill_id) - kill_id) from t1;
((@id := kill_id) - kill_id) ((@id := kill_id) - kill_id)
0 0

View File

@ -1,4 +1,4 @@
DROP TABLE IF EXISTS t1,t2; DROP TABLE IF EXISTS t1,t2,test1,test2;
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t1 VALUES (1),(2),(3);
CREATE TABLE t2 (a int, b int); CREATE TABLE t2 (a int, b int);

File diff suppressed because it is too large Load Diff

View File

@ -31,5 +31,5 @@ use test;
select * from t1; select * from t1;
n n
1234 1234
drop table t1; DROP DATABASE mysqltest1;
stop slave; stop slave;

View File

@ -0,0 +1,42 @@
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 (a int primary key);
create table t4 (a int primary key);
insert into t1 values (1),(1);
ERROR 23000: Duplicate entry '1' for key 1
insert into t4 values (1),(2);
show tables like 't1';
Tables_in_test (t1)
show tables like 't4';
Tables_in_test (t4)
t4
SELECT * FROM test.t4;
a
1
2
drop table t1;
select get_lock('crash_lock%20C', 10);
get_lock('crash_lock%20C', 10)
1
create table t2 (a int primary key);
insert into t2 values(1);
create table t3 (id int);
insert into t3 values(connection_id());
update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
select (@id := id) - id from t3;
(@id := id) - id
0
kill @id;
drop table t2,t3;
insert into t4 values (3),(4);
SELECT * FROM test.t4;
a
1
2
3
4
DROP TABLE test.t4;

View File

@ -0,0 +1,38 @@
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;
drop database if exists mysqltest;
USE test;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
2
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
COUNT(*)
2
SHOW DATABASES;
Database
information_schema
mysql
mysqltest
test
USE test;
SHOW TABLES;
Tables_in_test
USE mysqltest;
SHOW TABLES;
Tables_in_mysqltest
t1
SELECT COUNT(*) FROM mysqltest.t1;
COUNT(*)
2
DROP DATABASE mysqltest;
DROP TABLE test.t1;

View File

@ -363,3 +363,4 @@ id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id; select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t id hex(b1) vc bc d f total y t
DROP TABLE t1; DROP TABLE t1;
DROP DATABASE mysqltest1;

View File

@ -0,0 +1,45 @@
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 DATABASE test_ignore;
**** On Master ****
SHOW DATABASES;
Database
information_schema
mysql
test
test_ignore
USE test;
CREATE TABLE t1 (a INT, b INT);
SHOW TABLES;
Tables_in_test
t1
INSERT INTO t1 VALUES (1,1), (2,2);
USE test_ignore;
CREATE TABLE t2 (a INT, b INT);
SHOW TABLES;
Tables_in_test_ignore
t2
INSERT INTO t2 VALUES (3,3), (4,4);
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 102 Server ver: 5.1.5-alpha-debug-log, Binlog ver: 4
master-bin.000001 102 Query 1 195 use `test`; CREATE TABLE t1 (a INT, b INT)
master-bin.000001 195 Table_map 1 235 test.t1
master-bin.000001 235 Write_rows 1 282
**** On Slave ****
SHOW DATABASES;
Database
information_schema
mysql
test
USE test;
SHOW TABLES;
Tables_in_test
t1
USE test_ignore;
ERROR 42000: Unknown database 'test_ignore'
DROP DATABASE test_ignore;

View File

@ -0,0 +1,159 @@
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;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
***** Table Create Section ****
CREATE TABLE test.t1 (c1 int not null auto_increment,
data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type;
**** Data Insert Section test.t1 *****
INSERT INTO test.t1 VALUES (NULL, NULL);
INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
CHECK TABLE test.t1;
Table Op Msg_type Msg_text
test.t1 check status OK
**** Data Insert Validation Master Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
NULL
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
LENGTH(data)
16384
**** Data Insert Validation Slave Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
NULL
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
LENGTH(data)
16384
**** Data Update Section test.t1 ****
UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
**** Data Update Validation Master Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
18432
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
17408
**** Data Update Validation Slave Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
18432
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
17408
**** End Test Section test.t1 ****
**** Create Table test.t2 ****
CREATE TABLE test.t2 (
c1 INT NOT NULL PRIMARY KEY,
c2 TEXT,
c3 INT,
c4 LONGBLOB,
KEY(c3))ENGINE=$engine_type;
*** Setup Values For test.t2 ***
set @x0 = '01234567012345670123456701234567';
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
set @b1 = 'b1';
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@x0);
set @d1 = 'dd1';
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
set @b2 = 'b2';
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @d2 = 'dd2';
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
**** Data Insert Section test.t2 *****
INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
**** Data Insert Validation Master Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 2256 b1 3000 dd1
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 20000 b2 30000 dd2
**** Data Insert Validation Slave Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 2256 b1 3000 dd1
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 20000 b2 30000 dd2
**** Data Update Section test.t2 ****
UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
**** Data Update Validation Master Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 20000 b2 30000 dd2
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 2256 b1 3000 dd1
**** Data Update Validation Slave Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 20000 b2 30000 dd2
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 2256 b1 3000 dd1
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;

View File

@ -0,0 +1,159 @@
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;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
***** Table Create Section ****
CREATE TABLE test.t1 (c1 int not null auto_increment,
data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type;
**** Data Insert Section test.t1 *****
INSERT INTO test.t1 VALUES (NULL, NULL);
INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
CHECK TABLE test.t1;
Table Op Msg_type Msg_text
test.t1 check status OK
**** Data Insert Validation Master Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
NULL
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
LENGTH(data)
16384
**** Data Insert Validation Slave Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
NULL
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
1024
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
LENGTH(data)
16384
**** Data Update Section test.t1 ****
UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
**** Data Update Validation Master Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
18432
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
17408
**** Data Update Validation Slave Section test.t1 ****
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
LENGTH(data)
18432
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
LENGTH(data)
17408
**** End Test Section test.t1 ****
**** Create Table test.t2 ****
CREATE TABLE test.t2 (
c1 INT NOT NULL PRIMARY KEY,
c2 TEXT,
c3 INT,
c4 LONGBLOB,
KEY(c3))ENGINE=$engine_type;
*** Setup Values For test.t2 ***
set @x0 = '01234567012345670123456701234567';
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
set @b1 = 'b1';
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
set @b1 = concat(@b1,@x0);
set @d1 = 'dd1';
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
set @b2 = 'b2';
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @d2 = 'dd2';
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
**** Data Insert Section test.t2 *****
INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
**** Data Insert Validation Master Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 2256 b1 3000 dd1
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 20000 b2 30000 dd2
**** Data Insert Validation Slave Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 2256 b1 3000 dd1
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 20000 b2 30000 dd2
**** Data Update Section test.t2 ****
UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
**** Data Update Validation Master Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 20000 b2 30000 dd2
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 2256 b1 3000 dd1
**** Data Update Validation Slave Section test.t2 ****
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=1;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
1 20000 b2 30000 dd2
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
FROM test.t2 WHERE c1=2;
c1 LENGTH(c2) SUBSTR(c2,1+2*900,2) LENGTH(c4) SUBSTR(c4,1+3*900,3)
2 2256 b1 3000 dd1
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;

View File

@ -58,6 +58,9 @@ insert into t1 values (15);
grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
SELECT 1;
1
1
create procedure foo4() create procedure foo4()
deterministic deterministic
begin begin

File diff suppressed because it is too large Load Diff

View File

@ -1,39 +0,0 @@
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 (a int primary key);
insert into t1 values (1),(1);
ERROR 23000: Duplicate entry '1' for key 1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 292 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 292 # None 0 No #
show tables like 't1';
Tables_in_test (t1)
drop table t1;
select get_lock('crash_lock%20C', 10);
get_lock('crash_lock%20C', 10)
1
create table t2 (a int primary key);
insert into t2 values(1);
create table t3 (id int);
insert into t3 values(connection_id());
update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
select (@id := id) - id from t3;
(@id := id) - id
0
kill @id;
drop table t2,t3;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1 (a int primary key)
master-bin.000001 # Query 1 # use `test`; insert into t1 values (1),(1)
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t2 (a int primary key)
master-bin.000001 # Query 1 # use `test`; insert into t2 values(1)
master-bin.000001 # Query 1 # use `test`; create table t3 (id int)
master-bin.000001 # Query 1 # use `test`; insert into t3 values(connection_id())
master-bin.000001 # Query 1 # use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
master-bin.000001 # Query 1 # use `test`; drop table t2,t3

View File

@ -1,20 +0,0 @@
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;
drop database if exists mysqltest;
stop slave;
create database mysqltest;
use mysqltest;
create table t1(a int, b int, unique(b));
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest
master-bin.000001 # Query 1 # create database mysqltest
master-bin.000001 # Query 1 # use `mysqltest`; create table t1(a int, b int, unique(b))
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=12
master-bin.000001 # Execute_load_query 1 # use `mysqltest`; load data infile '../../std_data/rpl_loaddata.dat' into table t1 ;file_id=1
drop database mysqltest;

View File

@ -1,93 +0,0 @@
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;
drop database if exists mysqltest1;
create database mysqltest1;
use mysqltest1;
create table t1 (a int);
insert into t1 values(9);
select * from mysqltest1.t1;
a
9
show databases like 'mysqltest1';
Database (mysqltest1)
mysqltest1
select * from test.t1;
a
9
drop table t1;
drop database mysqltest1;
drop database if exists rewrite;
create database rewrite;
use test;
create table t1 (a date, b date, c date not null, d date);
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'd' at row 1
Warning 1265 Data truncated for column 'a' at row 2
Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 2
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
select * from rewrite.t1;
a b c d
0000-00-00 NULL 0000-00-00 0000-00-00
0000-00-00 0000-00-00 0000-00-00 0000-00-00
2003-03-03 2003-03-03 2003-03-03 NULL
2003-03-03 2003-03-03 2003-03-03 NULL
truncate table t1;
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'd' at row 1
Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 2
select * from rewrite.t1;
a b c d
NULL NULL 0000-00-00 0000-00-00
NULL 0000-00-00 0000-00-00 0000-00-00
NULL 2003-03-03 2003-03-03 NULL
drop table t1;
create table t1 (a text, b text);
load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
concat('|',a,'|') concat('|',b,'|')
|Field A| |Field B|
|Field 1| |Field 2'
Field 3,'Field 4|
|Field 5' ,'Field 6| NULL
|Field 6| | 'Field 7'|
drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
Warning 1264 Out of range value for column 'a' at row 3
Warning 1262 Row 3 was truncated; it contained more data than there were input columns
Warning 1264 Out of range value for column 'a' at row 5
Warning 1262 Row 5 was truncated; it contained more data than there were input columns
select * from rewrite.t1;
a b
1 row 1
2 row 2
0 1234567890
3 row 3
0 1234567890
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
Warnings:
Warning 1264 Out of range value for column 'a' at row 4
Warning 1261 Row 4 doesn't contain data for all columns
select * from rewrite.t1;
a b
1 row 1
2 row 2
3 row 3
0
drop database rewrite;
drop table t1;

View File

@ -57,6 +57,9 @@ insert into t1 values (15);
grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
SELECT 1;
1
1
create procedure foo4() create procedure foo4()
deterministic deterministic
begin begin

View File

@ -1,127 +0,0 @@
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;
set timestamp=100000000;
create table t1 (t timestamp);
create table t2 (t char(32));
select @@time_zone;
@@time_zone
Japan
select @@time_zone;
@@time_zone
Europe/Moscow
insert into t1 values ('20050101000000'), ('20050611093902');
set time_zone='UTC';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
t
2004-12-31 21:00:00
2005-06-11 05:39:02
2004-01-01 00:00:00
2004-06-11 09:39:02
set time_zone='UTC';
select * from t1;
t
2004-12-31 21:00:00
2005-06-11 05:39:02
2004-01-01 00:00:00
2004-06-11 09:39:02
delete from t1;
set time_zone='Europe/Moscow';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
set time_zone='Europe/Moscow';
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
use test;
SET TIMESTAMP=100000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (t timestamp);
SET TIMESTAMP=100000000;
create table t2 (t char(32));
SET TIMESTAMP=100000000;
SET @@session.time_zone='Europe/Moscow';
insert into t1 values ('20050101000000'), ('20050611093902');
SET TIMESTAMP=100000000;
SET @@session.time_zone='UTC';
insert into t1 values ('20040101000000'), ('20040611093902');
SET TIMESTAMP=100000000;
delete from t1;
SET TIMESTAMP=100000000;
SET @@session.time_zone='Europe/Moscow';
insert into t1 values ('20040101000000'), ('20040611093902');
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
delete from t1;
set time_zone='UTC';
load data infile '../../std_data/rpl_timezone.dat' into table t1;
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
set time_zone='UTC';
select * from t1;
t
2004-01-01 00:00:00
2004-06-11 09:39:02
set time_zone='Europe/Moscow';
set time_zone='Europe/Moscow';
delete from t1;
insert into t1 values ('20040101000000'), ('20040611093902');
set time_zone='MET';
insert into t2 (select t from t1);
select * from t1;
t
2003-12-31 22:00:00
2004-06-11 07:39:02
select * from t2;
t
2003-12-31 22:00:00
2004-06-11 07:39:02
delete from t2;
set timestamp=1000072000;
insert into t2 values (current_timestamp), (current_date), (current_time);
select * from t2;
t
2001-09-09 23:46:40
2001-09-09
23:46:40
delete from t2;
insert into t2 values (from_unixtime(1000000000)),
(unix_timestamp('2001-09-09 03:46:40'));
select * from t2;
t
2001-09-09 03:46:40
1000000000
select * from t2;
t
2001-09-09 03:46:40
1000000000
set global time_zone='MET';
delete from t2;
set time_zone='UTC';
insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone));
insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'));
select * from t2;
t
2003-12-31 23:00:00
2005-01-01 08:00:00
select * from t2;
t
2003-12-31 23:00:00
2005-01-01 08:00:00
drop table t1, t2;

View File

@ -1,82 +0,0 @@
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;
reset master;
create table t1(n char(30));
set @i1:=12345678901234, @i2:=-12345678901234, @i3:=0, @i4:=-1;
set @s1:='This is a test', @r1:=12.5, @r2:=-12.5;
set @n1:=null;
set @s2:='', @s3:='abc\'def', @s4:= 'abc\\def', @s5:= 'abc''def';
insert into t1 values (@i1), (@i2), (@i3), (@i4);
insert into t1 values (@r1), (@r2);
insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5);
insert into t1 values (@n1);
insert into t1 values (@n2);
insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1);
insert into t1 values (@a+(@b:=@a+1));
set @q:='abc';
insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'));
set @a:=5;
insert into t1 values (@a),(@a);
select * from t1 where n = '<nonexistant>';
n
insert into t1 values (@a),(@a),(@a*5);
select * from t1;
n
12345678901234
-12345678901234
0
-1
12.5
-12.5
This is a test
abc'def
abc\def
abc'def
NULL
NULL
0
1
2
5
abc
abcn1
abcn1n2
5
5
NULL
NULL
NULL
select * from t1;
n
12345678901234
-12345678901234
0
-1
12.5
-12.5
This is a test
abc'def
abc\def
abc'def
NULL
NULL
0
1
2
5
abc
abcn1
abcn1n2
5
5
NULL
NULL
NULL
drop table t1;
stop slave;

View File

@ -1,56 +0,0 @@
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;
drop table if exists t1,v1;
drop view if exists t1,v1;
reset master;
create table t1 (a int);
insert into t1 values (1);
create view v1 as select a from t1;
insert into v1 values (2);
select * from v1 order by a;
a
1
2
select * from v1 order by a;
a
1
2
update v1 set a=3 where a=1;
select * from v1 order by a;
a
2
3
select * from v1 order by a;
a
2
3
delete from v1 where a=2;
select * from v1 order by a;
a
3
select * from v1 order by a;
a
3
alter view v1 as select a as b from t1;
select * from v1 order by 1;
b
3
drop view v1;
select * from v1 order by a;
ERROR 42S02: Table 'test.v1' doesn't exist
drop table t1;
show binlog events limit 1,100;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Query 1 # use `test`; create table t1 (a int)
slave-bin.000001 # Query 1 # use `test`; insert into t1 values (1)
slave-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=root@localhost SQL SECURITY DEFINER VIEW v1 AS select a from t1
slave-bin.000001 # Query 1 # use `test`; insert into v1 values (2)
slave-bin.000001 # Query 1 # use `test`; update v1 set a=3 where a=1
slave-bin.000001 # Query 1 # use `test`; delete from v1 where a=2
slave-bin.000001 # Query 1 # use `test`; ALTER ALGORITHM=UNDEFINED DEFINER=root@localhost SQL SECURITY DEFINER VIEW v1 AS select a as b from t1
slave-bin.000001 # Query 1 # use `test`; drop view v1
slave-bin.000001 # Query 1 # use `test`; drop table t1

View File

@ -9,7 +9,7 @@ create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n));
create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n)); create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n));
select @@time_zone; select @@time_zone;
@@time_zone @@time_zone
Europe/Moscow Japan
select @@time_zone; select @@time_zone;
@@time_zone @@time_zone
Europe/Moscow Europe/Moscow
@ -23,10 +23,10 @@ t n
2004-06-11 09:39:02 4 2004-06-11 09:39:02 4
select * from t1; select * from t1;
t n t n
2005-01-01 00:00:00 1 2005-01-01 06:00:00 1
2005-06-11 09:39:02 2 2005-06-11 14:39:02 2
2004-01-01 00:00:00 3 2004-01-01 06:00:00 3
2004-06-11 09:39:02 4 2004-06-11 14:39:02 4
delete from t1; delete from t1;
set time_zone='Europe/Moscow'; set time_zone='Europe/Moscow';
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL); insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
@ -39,22 +39,6 @@ select * from t1;
t n t n
2004-01-01 00:00:00 5 2004-01-01 00:00:00 5
2004-06-11 09:39:02 6 2004-06-11 09:39:02 6
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
ROLLBACK;
use test;
SET TIMESTAMP=100000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n));
SET TIMESTAMP=100000000;
create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n));
SET TIMESTAMP=100000000;
delete from t1;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
delete from t1; delete from t1;
set time_zone='UTC'; set time_zone='UTC';
load data infile '../../std_data/rpl_timezone2.dat' into table t1; load data infile '../../std_data/rpl_timezone2.dat' into table t1;

View File

@ -6,6 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
drop table if exists t1,v1; drop table if exists t1,v1;
drop view if exists t1,v1; drop view if exists t1,v1;
reset master;
create table t1 (a int); create table t1 (a int);
insert into t1 values (1); insert into t1 values (1);
create view v1 as select a from t1; create view v1 as select a from t1;

View File

@ -767,8 +767,7 @@ deallocate prepare stmt1;
drop procedure p1; drop procedure p1;
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (a int); create table t1 (a int);
drop procedure if exists p2; CREATE PROCEDURE `p1`()
CREATE PROCEDURE `p2`()
begin begin
insert into t1 values (1); insert into t1 values (1);
end// end//
@ -777,8 +776,8 @@ begin
declare done int default 0; declare done int default 0;
set done= not done; set done= not done;
end// end//
CALL p2(); CALL p1();
drop procedure p2; drop procedure p1;
drop table t1; drop table t1;
create trigger t1_bi before insert on test.t1 for each row set @a:=0; create trigger t1_bi before insert on test.t1 for each row set @a:=0;
ERROR 3D000: No database selected ERROR 3D000: No database selected

View File

@ -2423,6 +2423,9 @@ drop view v1;
drop table t1; drop table t1;
create table t1(f1 int, f2 int); create table t1(f1 int, f2 int);
insert into t1 values (null, 10), (null,2); insert into t1 values (null, 10), (null,2);
select f1, sum(f2) from t1 group by f1;
f1 sum(f2)
NULL 12
create view v1 as select * from t1; create view v1 as select * from t1;
select f1, sum(f2) from v1 group by f1; select f1, sum(f2) from v1 group by f1;
f1 sum(f2) f1 sum(f2)

View File

@ -1036,4 +1036,13 @@ create table t1 (a varchar(255) character set utf8,
e varchar(255) character set utf8, e varchar(255) character set utf8,
key (a,b,c,d,e)) engine=bdb; key (a,b,c,d,e)) engine=bdb;
#
# Bug #14212: Server crash after COMMIT + ALTER TABLE
#
set autocommit=0;
create table t1 (a int) engine=bdb;
commit;
alter table t1 add primary key(a);
drop table t1;
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@ -565,6 +565,22 @@ create table t1 (
show create table t1; show create table t1;
drop table t1; drop table t1;
--warning 1364
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a)
) select a, 1 as c from t2 ;
show create table t1;
drop table t1;
--warning 1364
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int null, primary key (a)
) select a, 1 as c from t2 ;
show create table t1;
drop table t1;
--warning 1364 --warning 1364
create table t1 ( create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null, a varchar(12) charset utf8 collate utf8_bin not null,

View File

@ -11,17 +11,16 @@
############################################################################## ##############################################################################
sp-goto : GOTO is currently is disabled - will be fixed in the future sp-goto : GOTO is currently is disabled - will be fixed in the future
kill : Unstable test case, bug#9712
rpl_bit_npk : Bug #13418 rpl_bit_npk : Bug #13418
ndb_cache2 : Bug #15004 ndb_cache2 : Bug #15004
ndb_cache_multi2: Bug #15004 ndb_cache_multi2: Bug #15004
func_group : Bug #15448 func_group : Bug #15448
func_math : Bug #15448 func_math : Bug #15448
group_min_max : Bug #15448 group_min_max : Bug #15448
#mysqlslap : Bug #15483
innodb_concurrent : Results are not deterministic, Elliot will fix (BUG#3300) innodb_concurrent : Results are not deterministic, Elliot will fix (BUG#3300)
subselect : Bug#15706 subselect : Bug#15706
type_time : Bug#15805 type_time : Bug#15805
#rpl000002 : Bug#15920 Temporary tables are not binlogged in SBR #rpl000002 : Bug#15920 Temporary tables are not binlogged in SBR
ps_7ndb : Bug#15923 Core dump in RBR mode when executing test suite ps_7ndb : Bug#15923 Core dump in RBR mode when executing test suite
sp_trans : Bug#15924 Code dump in RBR mode when executing test suite rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
mysqlslap : Bug#16167

View File

@ -3,7 +3,7 @@
# #
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1,t3,t4,t5;
--enable_warnings --enable_warnings
create table t1 (a int, b char(10), key a(a), key b(a,b)); create table t1 (a int, b char(10), key a(a), key b(a,b));

View File

@ -769,6 +769,27 @@ from information_schema.columns where table_name='t1';
drop table t1; drop table t1;
# #
# Bug#15533 crash, information_schema, function, view
#
CREATE TABLE t1 (f1 BIGINT, f2 VARCHAR(20), f3 BIGINT);
INSERT INTO t1 SET f1 = 1, f2 = 'Schoenenbourg', f3 = 1;
CREATE FUNCTION func2() RETURNS BIGINT RETURN 1;
delimiter //;
CREATE FUNCTION func1() RETURNS BIGINT
BEGIN
RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.VIEWS);
END//
delimiter ;//
CREATE VIEW v1 AS SELECT 1 FROM t1
WHERE f3 = (SELECT func2 ());
SELECT func1();
DROP TABLE t1;
DROP VIEW v1;
DROP FUNCTION func1;
DROP FUNCTION func2;
# Show engines # Show engines
# #

View File

@ -25,11 +25,18 @@ select ((@id := kill_id) - kill_id) from t1;
kill @id; kill @id;
connection con1; connection con1;
--sleep 1 --sleep 2
# this statement should fail --disable_query_log
--error 2006,2013 --disable_result_log
# One of the following statements should fail
--error 0,2006,2013
select 1; select 1;
--error 0,2006,2013
select 1;
--enable_query_log
--enable_result_log
--enable_reconnect --enable_reconnect
# this should work, and we should have a new connection_id() # this should work, and we should have a new connection_id()
select ((@id := kill_id) - kill_id) from t1; select ((@id := kill_id) - kill_id) from t1;

View File

@ -2,7 +2,7 @@
-- source include/not_embedded.inc -- source include/not_embedded.inc
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1,t2; DROP TABLE IF EXISTS t1,t2,test1,test2;
--enable_warnings --enable_warnings
# #

View File

@ -2,12 +2,12 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/not_windows.inc --source include/not_windows.inc
--exec $MYSQL_SLAP --silent --concurrency=5 --concurrency-load=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql
--exec $MYSQL_SLAP --only-print --concurrency=1 --concurrency-load=1 --iterations=20 --query="select * from t1" --data="INSERT INTO t1 VALUES (1, 'This is a test')" --create="CREATE TABLE t1 (id int, name varchar(64))" --exec $MYSQL_SLAP --only-print --iterations=20 --query="select * from t1" --create="CREATE TABLE t1 (id int, name varchar(64)); INSERT INTO t1 VALUES (1, 'This is a test')" --delimiter=";"
--exec $MYSQL_SLAP --silent --concurrency=5 --concurrency-load=5 --iterations=20 --query="select * from t1" --data="INSERT INTO t1 VALUES (1, 'This is a test')" --create="CREATE TABLE t1 (id int, name varchar(64))" --exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --query="select * from t1" --create="CREATE TABLE t1 (id int, name varchar(64)); INSERT INTO t1 VALUES (1, 'This is a test')" --delimiter=";"
--exec $MYSQL_SLAP --only-print --concurrency=1 --concurrency-load=1 --iterations=1 --delimiter=";" --query="select * from t1;select * from t2" --data="INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32))" --engine="archive,myisam" --exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam"
--exec $MYSQL_SLAP --silent --concurrency=5 --concurrency-load=5 --iterations=20 --delimiter=";" --query="select * from t1;select * from t2" --data="INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32))" --exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')"

View File

@ -29,7 +29,6 @@
# #
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc --source include/master-slave.inc
let $engine_type= "InnoDB"; let $engine_type= "InnoDB";
-- source extra/rpl_tests/rpl_ddl.test -- source extra/rpl_tests/rpl_ddl.test

View File

@ -46,12 +46,13 @@ show tables;
use test; use test;
select * from t1; select * from t1;
system rm var/master-data/mysqltest1/f1.txt;
connection master; connection master;
drop table t1; DROP DATABASE mysqltest1;
sync_slave_with_master; sync_slave_with_master;
#cleanup #cleanup
connection slave; connection slave;
stop slave; stop slave;
system rm -rf var/master-data/mysqltest1; #system rm -rf var/master-data/mysqltest1;

View File

@ -7,20 +7,19 @@
connection master; connection master;
create table t1 (a int primary key); create table t1 (a int primary key);
create table t4 (a int primary key);
# generate an error that goes to the binlog # generate an error that goes to the binlog
--error 1062 --error 1062
insert into t1 values (1),(1); insert into t1 values (1),(1);
insert into t4 values (1),(2);
save_master_pos; save_master_pos;
connection slave; connection slave;
# as the t1 table is ignored on the slave, the slave should be able to sync # as the t1 table is ignored on the slave, the slave should be able to sync
sync_with_master; sync_with_master;
# The port number is different when doing the release build with
# Do-compile, hence we have to replace the port number here accordingly
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
# check that the table has been ignored, because otherwise the test is nonsense # check that the table has been ignored, because otherwise the test is nonsense
show tables like 't1'; show tables like 't1';
show tables like 't4';
SELECT * FROM test.t4;
connection master; connection master;
drop table t1; drop table t1;
save_master_pos; save_master_pos;
@ -46,17 +45,20 @@ real_sleep 2;
select (@id := id) - id from t3; select (@id := id) - id from t3;
kill @id; kill @id;
drop table t2,t3; drop table t2,t3;
insert into t4 values (3),(4);
connection master; connection master;
--error 0,1053,2013 --error 0,1053,2013
reap; reap;
connection master1; connection master1;
--replace_column 2 # 5 #
show binlog events from 102;
save_master_pos; save_master_pos;
connection slave; connection slave;
# SQL slave thread should not have stopped (because table of the killed
# query is in the ignore list).
sync_with_master; sync_with_master;
SELECT * FROM test.t4;
connection master1;
DROP TABLE test.t4;
save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests # End of 4.1 tests
# Adding comment for force manual merge 5.0 -> wl1012. delete me if needed # Adding comment for force manual merge 5.0 -> wl1012. delete me if needed

View File

@ -0,0 +1,49 @@
# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
# exist.
# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
######################################################
# Change Author: JBM
# Change Date: 2005-12-22
# Change: Test rewritten to remove show binlog events
# and to test the option better + Cleanup
######################################################
-- source include/master-slave.inc
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
connection master;
# 'test' database should be ignored by the slave
USE test;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
SELECT COUNT(*) FROM test.t1;
# 'mysqltest' database should NOT be ignored by the slave
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
# Now lets check the slave to see what we have :-)
save_master_pos;
connection slave;
sync_with_master;
SHOW DATABASES;
USE test;
SHOW TABLES;
USE mysqltest;
SHOW TABLES;
SELECT COUNT(*) FROM mysqltest.t1;
#show binlog events;
connection master;
DROP DATABASE mysqltest;
DROP TABLE test.t1;
# End of test

View File

@ -94,6 +94,8 @@ show create table t1;
# cleanup # cleanup
connection master; connection master;
DROP TABLE t1; DROP TABLE t1;
# Need to drop mysqltest1 as well so other test will pass.
DROP DATABASE mysqltest1;
sync_slave_with_master; sync_slave_with_master;
# End of 5.1 test case # End of 5.1 test case

View File

@ -0,0 +1 @@
--binlog_ignore_db=test_ignore;

View File

@ -0,0 +1,31 @@
--source include/have_row_based.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
# Bug#15942 (RBR ignores --binlog_ignore_db and tries to map to table
# on slave for writes)
CREATE DATABASE test_ignore; # --binlog_ignore_db=mysqltest_ignore
--echo **** On Master ****
SHOW DATABASES;
USE test;
CREATE TABLE t1 (a INT, b INT);
SHOW TABLES;
INSERT INTO t1 VALUES (1,1), (2,2);
USE test_ignore;
CREATE TABLE t2 (a INT, b INT);
SHOW TABLES;
INSERT INTO t2 VALUES (3,3), (4,4);
SHOW BINLOG EVENTS;
sync_slave_with_master;
--echo **** On Slave ****
SHOW DATABASES;
USE test;
SHOW TABLES;
--error 1049
USE test_ignore;
connection master;
DROP DATABASE test_ignore;
sync_slave_with_master;

View File

@ -0,0 +1,7 @@
#################################
# Wrapper for rpl_row_blob.test#
#################################
-- source include/have_innodb.inc
let $engine_type=INNODB;
-- source extra/rpl_tests/rpl_row_blob.test

View File

@ -0,0 +1,6 @@
#################################
# Wrapper for rpl_row_blob.test#
#################################
let $engine_type=myisam;
-- source extra/rpl_tests/rpl_row_blob.test

View File

@ -1,4 +1,4 @@
# Requires statement logging # Requires row base logging
-- source include/have_binlog_format_row.inc -- source include/have_binlog_format_row.inc
-- source extra/rpl_tests/rpl_log.test -- source extra/rpl_tests/rpl_log.test

View File

@ -1,83 +0,0 @@
# TBF - difference in row level logging
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
--disable_warnings
drop database if exists mysqltest1;
--enable_warnings
create database mysqltest1;
use mysqltest1;
create table t1 (a int);
insert into t1 values(9);
select * from mysqltest1.t1;
sync_slave_with_master;
show databases like 'mysqltest1'; # should be empty
select * from test.t1;
# cleanup
connection master;
drop table t1;
drop database mysqltest1;
sync_slave_with_master;
#
# BUG#6353:
# Option --replicate-rewrite-db should work together with LOAD DATA INFILE
#
connection slave;
--disable_warnings
drop database if exists rewrite;
--enable_warnings
create database rewrite;
connection master;
use test;
create table t1 (a date, b date, c date not null, d date);
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
sync_slave_with_master;
connection slave;
select * from rewrite.t1;
connection master;
truncate table t1;
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
sync_slave_with_master;
connection slave;
select * from rewrite.t1;
connection master;
drop table t1;
create table t1 (a text, b text);
load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
sync_slave_with_master;
connection slave;
select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
connection master;
drop table t1;
create table t1 (a int, b char(10));
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
sync_slave_with_master;
connection slave;
select * from rewrite.t1;
connection master;
truncate table t1;
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
sync_slave_with_master;
connection slave;
# The empty line last comes from the end line field in the file
select * from rewrite.t1;
drop database rewrite;
connection master;
drop table t1;

View File

@ -82,6 +82,14 @@ grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
# ToDo: BUG#14931: There is a race between the last grant binlogging, and
# the binlogging in the new connection made below, causing sporadic test
# failures due to switched statement order in binlog. To fix this we do
# SELECT 1 in the first connection before starting the second, ensuring
# that binlogging is done in the expected order.
# Please remove this SELECT 1 when BUG#14931 is fixed.
SELECT 1;
connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,); connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,);
connection con1; connection con1;

View File

@ -1,2 +0,0 @@
--default-time-zone=Europe/Moscow

View File

@ -1,4 +0,0 @@
# row-based and statement binlog difference in result files
-- source include/have_binlog_format_row.inc
-- source extra/rpl_tests/rpl_user_variables.test

View File

@ -1,47 +0,0 @@
# NYI - row-based cannot use CREATE ... SELECT
--source include/have_binlog_format_row.inc
source include/master-slave.inc;
--disable_warnings
drop table if exists t1,v1;
drop view if exists t1,v1;
sync_slave_with_master;
--enable_warnings
#
# Check that createion drop of view is replicated, also check replication of
# updating of view
#
connection master;
create table t1 (a int);
insert into t1 values (1);
create view v1 as select a from t1;
insert into v1 values (2);
select * from v1 order by a;
sync_slave_with_master;
# view already have to be on slave
select * from v1 order by a;
connection master;
update v1 set a=3 where a=1;
select * from v1 order by a;
sync_slave_with_master;
select * from v1 order by a;
connection master;
delete from v1 where a=2;
select * from v1 order by a;
sync_slave_with_master;
select * from v1 order by a;
connection master;
# 'alter view' internally maped to creation, but still check that it works
alter view v1 as select a as b from t1;
sync_slave_with_master;
select * from v1 order by 1;
connection master;
drop view v1;
sync_slave_with_master;
#error, because view have to be removed from slave
-- error 1146
select * from v1 order by a;
connection master;
drop table t1;
sync_slave_with_master;

View File

@ -1,7 +1,4 @@
# Test of replication of stored procedures (WL#2146 for MySQL 5.0) # Test of replication of stored procedures (WL#2146 for MySQL 5.0)
# Make this statement only until bug 13115 is corrected [jbm]
# TODO: Remove statement include once bug 13115 is patched.
-- source include/have_binlog_format_statement.inc
-- source include/master-slave.inc -- source include/master-slave.inc
# **************************************************************** # ****************************************************************

View File

@ -1,35 +0,0 @@
######################## rpl_ddl.test ########################
# #
# DDL statements (sometimes with implicit COMMIT) executed #
# by the master and it's propagation into the slave #
# #
##############################################################
#
# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
#
# 1. !All! objects to be dropped, renamed, altered ... must be created
# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test
# sequences start.
#
# 2. Never use a test object, which was direct or indirect affected by a
# preceeding test sequence again.
# Except table d1.t1 where ONLY DML is allowed.
#
# If one preceeding test sequence hits a (sometimes not good visible,
# because the sql error code of the statement might be 0) bug
# and these rules are ignored, a following test sequence might earn ugly
# effects like failing 'sync_slave_with_master', crashes of the slave or
# abort of the test case etc..
#
# 3. The assignment of the DDL command to be tested to $my_stmt can
# be a bit difficult. "'" must be avoided, because the test
# routine "include/rpl_stmt_seq.inc" performs a
# eval SELECT CONCAT('######## ','$my_stmt',' ########') as "";
#
--source include/have_innodb.inc
--source include/have_binlog_format_statement.inc
--source include/master-slave.inc
let $engine_type= "InnoDB";
-- source extra/rpl_tests/rpl_ddl.test

View File

@ -1,8 +0,0 @@
# Test for
# Bug #797: If a query is ignored on slave (replicate-ignore-table) the slave
# still checks that it has the same error as on the master.
# Requires statement logging
-- source include/have_binlog_format_statement.inc
-- source extra/rpl_tests/rpl_err_ignoredtable.test

View File

@ -1,10 +0,0 @@
# See if the master logs LOAD DATA INFILE correctly when binlog_*_db rules
# exist.
# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
# Requires statement logging
-- source include/have_binlog_format_statement.inc
-- source extra/rpl_tests/rpl_loaddata_m.test
# End of 4.1 tests
# Adding comment for force manual merge 5.0 -> wl1012: Delete me

View File

@ -1 +0,0 @@
"--replicate-rewrite-db=test->rewrite" "--replicate-rewrite-db=mysqltest1->test"

View File

@ -90,6 +90,14 @@ grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1;
grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1;
grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1;
# ToDo: BUG#14931: There is a race between the last grant binlogging, and
# the binlogging in the new connection made below, causing sporadic test
# failures due to switched statement order in binlog. To fix this we do
# SELECT 1 in the first connection before starting the second, ensuring
# that binlogging is done in the expected order.
# Please remove this SELECT 1 when BUG#14931 is fixed.
SELECT 1;
connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,); connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,);
connection con1; connection con1;

View File

@ -1 +0,0 @@
--default-time-zone=Europe/Moscow

View File

@ -1,129 +0,0 @@
# TBF - difference in row level logging
-- source include/have_binlog_format_statement.inc
# Test of replication of time zones.
# There is currently some bug possibly in prepared statements (this
# test fails with --ps-protocol): sys_var_thd_time_zone::value_ptr()
# is called only at prepare time, not at execution time. So,
# thd->time_zone_used is not equal to 1 (it is back to 0, because of
# reset_thd_for_next_command called at execution time), so the
# timezone used in CONVERT_TZ is not binlogged. To debug (by Guilhem
# and possibly Konstantin).
--disable_ps_protocol
source include/master-slave.inc;
# Some preparations
let $VERSION=`select version()`;
set timestamp=100000000; # for fixed output of mysqlbinlog
create table t1 (t timestamp);
create table t2 (t char(32));
connection slave;
select @@time_zone;
#
# Let us check how well replication works when we are saving datetime
# value in TIMESTAMP field.
#
connection master;
select @@time_zone;
insert into t1 values ('20050101000000'), ('20050611093902');
set time_zone='UTC';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
sync_slave_with_master;
set time_zone='UTC';
select * from t1;
# Let us check also that setting of time_zone back to default also works
# well
connection master;
delete from t1;
set time_zone='Europe/Moscow';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
sync_slave_with_master;
set time_zone='Europe/Moscow';
select * from t1;
connection master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
# Let us check with LOAD DATA INFILE
# (we do it after mysqlbinlog because the temp files names are not constant)
connection master;
delete from t1;
set time_zone='UTC';
load data infile '../../std_data/rpl_timezone.dat' into table t1;
select * from t1;
sync_slave_with_master;
set time_zone='UTC';
select * from t1;
set time_zone='Europe/Moscow';
# Put back values of before the LOAD
connection master;
set time_zone='Europe/Moscow';
delete from t1;
insert into t1 values ('20040101000000'), ('20040611093902');
#
# Now let us check how well we replicate statments reading TIMESTAMP fields
# (We should see the same data on master and on slave but it should differ
# from originally inserted)
#
set time_zone='MET';
insert into t2 (select t from t1);
select * from t1;
sync_slave_with_master;
select * from t2;
#
# Now let us check how well we replicate various CURRENT_* functions
#
connection master;
delete from t2;
set timestamp=1000072000;
insert into t2 values (current_timestamp), (current_date), (current_time);
sync_slave_with_master;
select * from t2;
#
# At last let us check replication of FROM_UNIXTIME/UNIX_TIMESTAMP functions.
#
connection master;
delete from t2;
insert into t2 values (from_unixtime(1000000000)),
(unix_timestamp('2001-09-09 03:46:40'));
select * from t2;
sync_slave_with_master;
# We should get same result on slave as on master
select * from t2;
#
# Let us check that we are allowing to set global time_zone with
# replication
#
connection master;
set global time_zone='MET';
#
# Let us see if CONVERT_TZ(@@time_zone) replicates
#
delete from t2;
set time_zone='UTC';
insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone));
insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'));
select * from t2;
sync_slave_with_master;
select * from t2;
# Clean up
connection master;
drop table t1, t2;
sync_slave_with_master;
# End of 4.1 tests

View File

@ -1,5 +0,0 @@
# row-based and statement binlog difference in result files
-- source include/have_binlog_format_statement.inc
-- source extra/rpl_tests/rpl_user_variables.test
# End of 4.1 tests

View File

@ -1,6 +1,3 @@
# TBF - difference in row level logging
-- source include/have_binlog_format_row.inc
# Test of replication of time zones. # Test of replication of time zones.
# There is currently some bug possibly in prepared statements (this # There is currently some bug possibly in prepared statements (this
@ -51,8 +48,11 @@ sync_slave_with_master;
set time_zone='Europe/Moscow'; set time_zone='Europe/Moscow';
select * from t1; select * from t1;
connection master; connection master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR # Change Author: JBM
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001 # Change Date: 2005-12-22
# Change: Comment out the exec of the binlog so test works for both SBR and RBR
#--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
#--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
# Let us check with LOAD DATA INFILE # Let us check with LOAD DATA INFILE
# (we do it after mysqlbinlog because the temp files names are not constant) # (we do it after mysqlbinlog because the temp files names are not constant)
@ -74,7 +74,7 @@ insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
# #
# Now let us check how well we replicate statments reading TIMESTAMP fields # Now let us check how well we replicate statments reading TIMESTAMP fields
# (We should see the same data on master and on slave but it should differ # (We should see the same data on master and on slave but it should differ
# from originally inserted) # from originally inserted)
# #
set time_zone='MET'; set time_zone='MET';
@ -127,3 +127,4 @@ select * from t2;
connection master; connection master;
drop table t1, t2; drop table t1, t2;
sync_slave_with_master; sync_slave_with_master;

View File

@ -1,4 +1,3 @@
# row-based and statement binlog difference in result files
# #
# Test of replicating user variables # Test of replicating user variables
# #

View File

@ -1,5 +1,4 @@
# NYI - row-based cannot use CREATE ... SELECT # NYI - row-based cannot use CREATE ... SELECT
--source include/have_binlog_format_statement.inc
source include/master-slave.inc; source include/master-slave.inc;
--disable_warnings --disable_warnings
@ -10,7 +9,7 @@ reset master;
--enable_warnings --enable_warnings
# #
# Check that createion drop of view is replicated, also check replication of # Check that creation drop of view is replicated, also check replication of
# updating of view # updating of view
# #
connection master; connection master;
@ -46,5 +45,8 @@ select * from v1 order by a;
connection master; connection master;
drop table t1; drop table t1;
sync_slave_with_master; sync_slave_with_master;
--replace_column 2 # 5 # # Change Author: JBM
show binlog events limit 1,100; # Change Date: 2005-12-22
# Change: Commented out binlog events to work with SBR and RBR
#--replace_column 2 # 5 #
# show binlog events limit 1,100;

View File

@ -930,11 +930,8 @@ drop table t1, t2, t3;
# operator. # operator.
# #
create table t1 (a int); create table t1 (a int);
--disable_warnings
drop procedure if exists p2;
--enable_warnings
DELIMITER //; DELIMITER //;
CREATE PROCEDURE `p2`() CREATE PROCEDURE `p1`()
begin begin
insert into t1 values (1); insert into t1 values (1);
end// end//
@ -944,8 +941,8 @@ begin
set done= not done; set done= not done;
end// end//
DELIMITER ;// DELIMITER ;//
CALL p2(); CALL p1();
drop procedure p2; drop procedure p1;
drop table t1; drop table t1;
# #

View File

@ -2279,6 +2279,7 @@ drop table t1;
# #
create table t1(f1 int, f2 int); create table t1(f1 int, f2 int);
insert into t1 values (null, 10), (null,2); insert into t1 values (null, 10), (null,2);
select f1, sum(f2) from t1 group by f1;
create view v1 as select * from t1; create view v1 as select * from t1;
select f1, sum(f2) from v1 group by f1; select f1, sum(f2) from v1 group by f1;
drop view v1; drop view v1;

View File

@ -36,9 +36,10 @@ typedef struct st_hash_info {
static uint hash_mask(uint hashnr,uint buffmax,uint maxlength); static uint hash_mask(uint hashnr,uint buffmax,uint maxlength);
static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink); static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink);
static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length); static int hashcmp(const HASH *hash, HASH_LINK *pos, const byte *key,
uint length);
static uint calc_hash(HASH *hash,const byte *key,uint length) static uint calc_hash(const HASH *hash, const byte *key, uint length)
{ {
ulong nr1=1, nr2=4; ulong nr1=1, nr2=4;
hash->charset->coll->hash_sort(hash->charset,(uchar*) key,length,&nr1,&nr2); hash->charset->coll->hash_sort(hash->charset,(uchar*) key,length,&nr1,&nr2);
@ -63,7 +64,6 @@ _hash_init(HASH *hash,CHARSET_INFO *charset,
hash->key_offset=key_offset; hash->key_offset=key_offset;
hash->key_length=key_length; hash->key_length=key_length;
hash->blength=1; hash->blength=1;
hash->current_record= NO_RECORD; /* For the future */
hash->get_key=get_key; hash->get_key=get_key;
hash->free=free_element; hash->free=free_element;
hash->flags=flags; hash->flags=flags;
@ -135,7 +135,6 @@ void my_hash_reset(HASH *hash)
reset_dynamic(&hash->array); reset_dynamic(&hash->array);
/* Set row pointers so that the hash can be reused at once */ /* Set row pointers so that the hash can be reused at once */
hash->blength= 1; hash->blength= 1;
hash->current_record= NO_RECORD;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -147,7 +146,8 @@ void my_hash_reset(HASH *hash)
*/ */
static inline char* static inline char*
hash_key(HASH *hash,const byte *record,uint *length,my_bool first) hash_key(const HASH *hash, const byte *record, uint *length,
my_bool first)
{ {
if (hash->get_key) if (hash->get_key)
return (*hash->get_key)(record,length,first); return (*hash->get_key)(record,length,first);
@ -163,8 +163,8 @@ static uint hash_mask(uint hashnr,uint buffmax,uint maxlength)
return (hashnr & ((buffmax >> 1) -1)); return (hashnr & ((buffmax >> 1) -1));
} }
static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax, static uint hash_rec_mask(const HASH *hash, HASH_LINK *pos,
uint maxlength) uint buffmax, uint maxlength)
{ {
uint length; uint length;
byte *key= (byte*) hash_key(hash,pos->data,&length,0); byte *key= (byte*) hash_key(hash,pos->data,&length,0);
@ -186,14 +186,25 @@ unsigned int rec_hashnr(HASH *hash,const byte *record)
} }
/* Search after a record based on a key */ gptr hash_search(const HASH *hash, const byte *key, uint length)
/* Sets info->current_ptr to found record */ {
HASH_SEARCH_STATE state;
return hash_first(hash, key, length, &state);
}
gptr hash_search(HASH *hash,const byte *key,uint length) /*
Search after a record based on a key
NOTE
Assigns the number of the found record to HASH_SEARCH_STATE state
*/
gptr hash_first(const HASH *hash, const byte *key, uint length,
HASH_SEARCH_STATE *current_record)
{ {
HASH_LINK *pos; HASH_LINK *pos;
uint flag,idx; uint flag,idx;
DBUG_ENTER("hash_search"); DBUG_ENTER("hash_first");
flag=1; flag=1;
if (hash->records) if (hash->records)
@ -206,7 +217,7 @@ gptr hash_search(HASH *hash,const byte *key,uint length)
if (!hashcmp(hash,pos,key,length)) if (!hashcmp(hash,pos,key,length))
{ {
DBUG_PRINT("exit",("found key at %d",idx)); DBUG_PRINT("exit",("found key at %d",idx));
hash->current_record= idx; *current_record= idx;
DBUG_RETURN (pos->data); DBUG_RETURN (pos->data);
} }
if (flag) if (flag)
@ -218,31 +229,32 @@ gptr hash_search(HASH *hash,const byte *key,uint length)
} }
while ((idx=pos->next) != NO_RECORD); while ((idx=pos->next) != NO_RECORD);
} }
hash->current_record= NO_RECORD; *current_record= NO_RECORD;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/* Get next record with identical key */ /* Get next record with identical key */
/* Can only be called if previous calls was hash_search */ /* Can only be called if previous calls was hash_search */
gptr hash_next(HASH *hash,const byte *key,uint length) gptr hash_next(const HASH *hash, const byte *key, uint length,
HASH_SEARCH_STATE *current_record)
{ {
HASH_LINK *pos; HASH_LINK *pos;
uint idx; uint idx;
if (hash->current_record != NO_RECORD) if (*current_record != NO_RECORD)
{ {
HASH_LINK *data=dynamic_element(&hash->array,0,HASH_LINK*); HASH_LINK *data=dynamic_element(&hash->array,0,HASH_LINK*);
for (idx=data[hash->current_record].next; idx != NO_RECORD ; idx=pos->next) for (idx=data[*current_record].next; idx != NO_RECORD ; idx=pos->next)
{ {
pos=data+idx; pos=data+idx;
if (!hashcmp(hash,pos,key,length)) if (!hashcmp(hash,pos,key,length))
{ {
hash->current_record= idx; *current_record= idx;
return pos->data; return pos->data;
} }
} }
hash->current_record=NO_RECORD; *current_record= NO_RECORD;
} }
return 0; return 0;
} }
@ -281,7 +293,8 @@ static void movelink(HASH_LINK *array,uint find,uint next_link,uint newlink)
!= 0 key of record != key != 0 key of record != key
*/ */
static int hashcmp(HASH *hash,HASH_LINK *pos,const byte *key,uint length) static int hashcmp(const HASH *hash, HASH_LINK *pos, const byte *key,
uint length)
{ {
uint rec_keylength; uint rec_keylength;
byte *rec_key= (byte*) hash_key(hash,pos->data,&rec_keylength,1); byte *rec_key= (byte*) hash_key(hash,pos->data,&rec_keylength,1);
@ -307,7 +320,6 @@ my_bool my_hash_insert(HASH *info,const byte *record)
if (!(empty=(HASH_LINK*) alloc_dynamic(&info->array))) if (!(empty=(HASH_LINK*) alloc_dynamic(&info->array)))
return(TRUE); /* No more memory */ return(TRUE); /* No more memory */
info->current_record= NO_RECORD;
data=dynamic_element(&info->array,0,HASH_LINK*); data=dynamic_element(&info->array,0,HASH_LINK*);
halfbuff= info->blength >> 1; halfbuff= info->blength >> 1;
@ -450,7 +462,6 @@ my_bool hash_delete(HASH *hash,byte *record)
} }
if ( --(hash->records) < hash->blength >> 1) hash->blength>>=1; if ( --(hash->records) < hash->blength >> 1) hash->blength>>=1;
hash->current_record= NO_RECORD;
lastpos=data+hash->records; lastpos=data+hash->records;
/* Remove link to record */ /* Remove link to record */
@ -543,7 +554,6 @@ my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length)
if ((idx=pos->next) == NO_RECORD) if ((idx=pos->next) == NO_RECORD)
DBUG_RETURN(1); /* Not found in links */ DBUG_RETURN(1); /* Not found in links */
} }
hash->current_record= NO_RECORD;
org_link= *pos; org_link= *pos;
empty=idx; empty=idx;
@ -593,10 +603,10 @@ byte *hash_element(HASH *hash,uint idx)
isn't changed isn't changed
*/ */
void hash_replace(HASH *hash, uint idx, byte *new_row) void hash_replace(HASH *hash, HASH_SEARCH_STATE *current_record, byte *new_row)
{ {
if (idx != NO_RECORD) /* Safety */ if (*current_record != NO_RECORD) /* Safety */
dynamic_element(&hash->array,idx,HASH_LINK*)->data=new_row; dynamic_element(&hash->array, *current_record, HASH_LINK*)->data= new_row;
} }

View File

@ -74,7 +74,7 @@ static int do_test()
bzero((char*) key1,sizeof(key1[0])*1000); bzero((char*) key1,sizeof(key1[0])*1000);
printf("- Creating hash\n"); printf("- Creating hash\n");
if (hash_init(&hash,recant/2,0,6,0,free_record,0)) if (hash_init(&hash, default_charset_info, recant/2, 0, 6, 0, free_record, 0))
goto err; goto err;
printf("- Writing records:\n"); printf("- Writing records:\n");
@ -172,15 +172,16 @@ static int do_test()
break; break;
if (key1[j] > 1) if (key1[j] > 1)
{ {
HASH_SEARCH_STATE state;
printf("- Testing identical read\n"); printf("- Testing identical read\n");
sprintf(key,"%6d",j); sprintf(key,"%6d",j);
pos=1; pos=1;
if (!(recpos=hash_search(&hash,key,0))) if (!(recpos= hash_first(&hash, key, 0, &state)))
{ {
printf("can't find key1: \"%s\"\n",key); printf("can't find key1: \"%s\"\n",key);
goto err; goto err;
} }
while (hash_next(&hash,key,0) && pos < (ulong) (key1[j]+10)) while (hash_next(&hash, key, 0, &state) && pos < (ulong) (key1[j]+10))
pos++; pos++;
if (pos != (ulong) key1[j]) if (pos != (ulong) key1[j])
{ {
@ -189,7 +190,7 @@ static int do_test()
} }
} }
printf("- Creating output heap-file 2\n"); printf("- Creating output heap-file 2\n");
if (hash_init(&hash2,hash.records,0,0,hash2_key,free_record,0)) if (hash_init(&hash2, default_charset_info, hash.records, 0, 0, hash2_key, free_record,0))
goto err; goto err;
printf("- Copying and removing records\n"); printf("- Copying and removing records\n");

View File

@ -92,7 +92,9 @@ esac
mkdir $BASE $BASE/bin $BASE/docs \ mkdir $BASE $BASE/bin $BASE/docs \
$BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \ $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \
$BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \ $BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \
$BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/mysql-test/lib $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/mysql-test/lib \
$BASE/mysql-test/extra \
$BASE/mysql-test/extra/binlog_tests $BASE/mysql-test/extra/rpl_tests
if [ $BASE_SYSTEM != "netware" ] ; then if [ $BASE_SYSTEM != "netware" ] ; then
mkdir $BASE/share/mysql $BASE/tests $BASE/sql-bench $BASE/man \ mkdir $BASE/share/mysql $BASE/tests $BASE/sql-bench $BASE/man \
@ -242,6 +244,8 @@ $CP mysql-test/t/*.test mysql-test/t/*.imtest \
mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t
$CP mysql-test/r/*.result mysql-test/r/*.require \ $CP mysql-test/r/*.result mysql-test/r/*.require \
$BASE/mysql-test/r $BASE/mysql-test/r
$CP mysql-test/extra/binlog_tests/*.test $BASE/mysql-test/extra/binlog_tests
$CP mysql-test/extra/rpl_tests/*.test $BASE/mysql-test/extra/rpl_tests
if [ $BASE_SYSTEM != "netware" ] ; then if [ $BASE_SYSTEM != "netware" ] ; then
chmod a+x $BASE/bin/* chmod a+x $BASE/bin/*

View File

@ -447,7 +447,7 @@ All benchmarks takes the following options:
--create-options=# --create-options=#
Extra argument to all create statements. If you for example want to Extra argument to all create statements. If you for example want to
create all MySQL tables as BDB tables use: create all MySQL tables as BDB tables use:
--create-options=TYPE=BDB --create-options=ENGINE=BDB
--database (Default $opt_database) --database (Default $opt_database)
In which database the test tables are created. In which database the test tables are created.

View File

@ -174,29 +174,29 @@ sub new
# Some fixes that depends on the environment # Some fixes that depends on the environment
if (defined($main::opt_create_options) && if (defined($main::opt_create_options) &&
$main::opt_create_options =~ /type=heap/i) $main::opt_create_options =~ /engine=heap/i)
{ {
$limits{'working_blobs'} = 0; # HEAP tables can't handle BLOB's $limits{'working_blobs'} = 0; # HEAP tables can't handle BLOB's
} }
if (defined($main::opt_create_options) && if (defined($main::opt_create_options) &&
$main::opt_create_options =~ /type=innodb/i) $main::opt_create_options =~ /engine=innodb/i)
{ {
$self->{'transactions'} = 1; # Transactions enabled $self->{'transactions'} = 1; # Transactions enabled
} }
if (defined($main::opt_create_options) && if (defined($main::opt_create_options) &&
$main::opt_create_options =~ /type=ndb/i) $main::opt_create_options =~ /engine=ndb/i)
{ {
$self->{'transactions'} = 1; # Transactions enabled $self->{'transactions'} = 1; # Transactions enabled
$limits{'max_columns'} = 90; # Max number of columns in table $limits{'max_columns'} = 90; # Max number of columns in table
$limits{'max_tables'} = 32; # No comments $limits{'max_tables'} = 32; # No comments
} }
if (defined($main::opt_create_options) && if (defined($main::opt_create_options) &&
$main::opt_create_options =~ /type=bdb/i) $main::opt_create_options =~ /engine=bdb/i)
{ {
$self->{'transactions'} = 1; # Transactions enabled $self->{'transactions'} = 1; # Transactions enabled
} }
if (defined($main::opt_create_options) && if (defined($main::opt_create_options) &&
$main::opt_create_options =~ /type=gemini/i) $main::opt_create_options =~ /engine=gemini/i)
{ {
$limits{'working_blobs'} = 0; # Blobs not implemented yet $limits{'working_blobs'} = 0; # Blobs not implemented yet
$limits{'max_tables'} = 500; $limits{'max_tables'} = 500;

View File

@ -2607,8 +2607,7 @@ int ha_federated::stash_remote_error()
{ {
DBUG_ENTER("ha_federated::stash_remote_error()"); DBUG_ENTER("ha_federated::stash_remote_error()");
remote_error_number= mysql_errno(mysql); remote_error_number= mysql_errno(mysql);
my_snprintf(remote_error_buf, sizeof(remote_error_buf), "%s", strmake(remote_error_buf, mysql_error(mysql), sizeof(remote_error_buf)-1);
mysql_error(mysql));
DBUG_RETURN(HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM); DBUG_RETURN(HA_FEDERATED_ERROR_WITH_REMOTE_SYSTEM);
} }

View File

@ -370,7 +370,8 @@ Thd_ndb::~Thd_ndb()
if (ndb) if (ndb)
{ {
#ifndef DBUG_OFF #ifndef DBUG_OFF
Ndb::Free_list_usage tmp; tmp.m_name= 0; Ndb::Free_list_usage tmp;
tmp.m_name= 0;
while (ndb->get_free_list_usage(&tmp)) while (ndb->get_free_list_usage(&tmp))
{ {
uint leaked= (uint) tmp.m_created - tmp.m_free; uint leaked= (uint) tmp.m_created - tmp.m_free;
@ -382,8 +383,8 @@ Thd_ndb::~Thd_ndb()
} }
#endif #endif
delete ndb; delete ndb;
ndb= NULL;
} }
ndb= NULL;
changed_tables.empty(); changed_tables.empty();
} }
@ -3359,6 +3360,10 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
if (lock_type != F_UNLCK) if (lock_type != F_UNLCK)
{ {
DBUG_PRINT("info", ("lock_type != F_UNLCK")); DBUG_PRINT("info", ("lock_type != F_UNLCK"));
if (!thd->transaction.on)
m_transaction_on= FALSE;
else
m_transaction_on= thd->variables.ndb_use_transactions;
if (!thd_ndb->lock_count++) if (!thd_ndb->lock_count++)
{ {
PRINT_OPTION_FLAGS(thd); PRINT_OPTION_FLAGS(thd);
@ -3373,7 +3378,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
ERR_RETURN(ndb->getNdbError()); ERR_RETURN(ndb->getNdbError());
no_uncommitted_rows_reset(thd); no_uncommitted_rows_reset(thd);
thd_ndb->stmt= trans; thd_ndb->stmt= trans;
trans_register_ha(thd, FALSE, &ndbcluster_hton); if (m_transaction_on)
trans_register_ha(thd, FALSE, &ndbcluster_hton);
} }
else else
{ {
@ -3388,7 +3394,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
ERR_RETURN(ndb->getNdbError()); ERR_RETURN(ndb->getNdbError());
no_uncommitted_rows_reset(thd); no_uncommitted_rows_reset(thd);
thd_ndb->all= trans; thd_ndb->all= trans;
trans_register_ha(thd, TRUE, &ndbcluster_hton); if (m_transaction_on)
trans_register_ha(thd, TRUE, &ndbcluster_hton);
/* /*
If this is the start of a LOCK TABLE, a table look If this is the start of a LOCK TABLE, a table look
@ -3422,10 +3429,6 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
m_ha_not_exact_count= !thd->variables.ndb_use_exact_count; m_ha_not_exact_count= !thd->variables.ndb_use_exact_count;
m_autoincrement_prefetch= m_autoincrement_prefetch=
(ha_rows) thd->variables.ndb_autoincrement_prefetch_sz; (ha_rows) thd->variables.ndb_autoincrement_prefetch_sz;
if (!thd->transaction.on)
m_transaction_on= FALSE;
else
m_transaction_on= thd->variables.ndb_use_transactions;
m_active_trans= thd_ndb->all ? thd_ndb->all : thd_ndb->stmt; m_active_trans= thd_ndb->all ? thd_ndb->all : thd_ndb->stmt;
DBUG_ASSERT(m_active_trans); DBUG_ASSERT(m_active_trans);
@ -5172,7 +5175,8 @@ int ndbcluster_end(ha_panic_function type)
if (g_ndb) if (g_ndb)
{ {
#ifndef DBUG_OFF #ifndef DBUG_OFF
Ndb::Free_list_usage tmp; tmp.m_name= 0; Ndb::Free_list_usage tmp;
tmp.m_name= 0;
while (g_ndb->get_free_list_usage(&tmp)) while (g_ndb->get_free_list_usage(&tmp))
{ {
uint leaked= (uint) tmp.m_created - tmp.m_free; uint leaked= (uint) tmp.m_created - tmp.m_free;
@ -5184,10 +5188,9 @@ int ndbcluster_end(ha_panic_function type)
} }
#endif #endif
delete g_ndb; delete g_ndb;
g_ndb= NULL;
} }
g_ndb= NULL; delete g_ndb_cluster_connection;
if (g_ndb_cluster_connection)
delete g_ndb_cluster_connection;
g_ndb_cluster_connection= NULL; g_ndb_cluster_connection= NULL;
hash_free(&ndbcluster_open_tables); hash_free(&ndbcluster_open_tables);
@ -8075,7 +8078,8 @@ ndbcluster_show_status(THD* thd, stat_print_fn *stat_print,
if (get_thd_ndb(thd) && get_thd_ndb(thd)->ndb) if (get_thd_ndb(thd) && get_thd_ndb(thd)->ndb)
{ {
Ndb* ndb= (get_thd_ndb(thd))->ndb; Ndb* ndb= (get_thd_ndb(thd))->ndb;
Ndb::Free_list_usage tmp; tmp.m_name= 0; Ndb::Free_list_usage tmp;
tmp.m_name= 0;
while (ndb->get_free_list_usage(&tmp)) while (ndb->get_free_list_usage(&tmp))
{ {
uint buflen= uint buflen=

View File

@ -1178,6 +1178,7 @@ int ha_release_temporary_latches(THD *thd)
#ifdef WITH_INNOBASE_STORAGE_ENGINE #ifdef WITH_INNOBASE_STORAGE_ENGINE
innobase_release_temporary_latches(thd); innobase_release_temporary_latches(thd);
#endif #endif
return 0;
} }
int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv) int ha_rollback_to_savepoint(THD *thd, SAVEPOINT *sv)
@ -2074,7 +2075,8 @@ int ha_enable_transaction(THD *thd, bool on)
is an optimization hint that storage engine is free to ignore. is an optimization hint that storage engine is free to ignore.
So, let's commit an open transaction (if any) now. So, let's commit an open transaction (if any) now.
*/ */
error= end_trans(thd, COMMIT); if (!(error= ha_commit_stmt(thd)))
error= end_trans(thd, COMMIT);
} }
DBUG_RETURN(error); DBUG_RETURN(error);
} }
@ -2788,7 +2790,7 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
- Row-based replication is on - Row-based replication is on
- It is not a temporary table - It is not a temporary table
- The binlog is enabled - The binlog is enabled
- The table shall be binlogged (binlog_*_db rules) [Seems disabled /Matz] - The table shall be binlogged (binlog_*_db rules)
*/ */
#ifdef HAVE_ROW_BASED_REPLICATION #ifdef HAVE_ROW_BASED_REPLICATION
@ -2797,7 +2799,8 @@ static bool check_table_binlog_row_based(THD *thd, TABLE *table)
return return
binlog_row_based && binlog_row_based &&
thd && (thd->options & OPTION_BIN_LOG) && thd && (thd->options & OPTION_BIN_LOG) &&
(table->s->tmp_table == NO_TMP_TABLE); (table->s->tmp_table == NO_TMP_TABLE) &&
binlog_filter->db_ok(table->s->db.str);
} }
template<class RowsEventT> int binlog_log_row(TABLE* table, template<class RowsEventT> int binlog_log_row(TABLE* table,

View File

@ -4925,6 +4925,12 @@ int Item_ref::save_in_field(Field *to, bool no_conversions)
} }
void Item_ref::save_org_in_field(Field *field)
{
(*ref)->save_org_in_field(field);
}
void Item_ref::make_field(Send_field *field) void Item_ref::make_field(Send_field *field)
{ {
(*ref)->make_field(field); (*ref)->make_field(field);

View File

@ -1782,11 +1782,7 @@ public:
void make_field(Send_field *field); void make_field(Send_field *field);
bool fix_fields(THD *, Item **); bool fix_fields(THD *, Item **);
int save_in_field(Field *field, bool no_conversions); int save_in_field(Field *field, bool no_conversions);
void save_org_in_field(Field *field) void save_org_in_field(Field *field);
{
(*ref)->save_org_in_field(field);
null_value= (*ref)->null_value;
}
enum Item_result result_type () const { return (*ref)->result_type(); } enum Item_result result_type () const { return (*ref)->result_type(); }
enum_field_types field_type() const { return (*ref)->field_type(); } enum_field_types field_type() const { return (*ref)->field_type(); }
Field *get_tmp_table_field() Field *get_tmp_table_field()

View File

@ -715,7 +715,7 @@ String *Item_nodeset_func_predicate::val_nodeset(String *str)
((XPathFilter*)str)->append_element(flt->num, pos++); ((XPathFilter*)str)->append_element(flt->num, pos++);
} }
return str; return str;
}; }
String *Item_nodeset_func_elementbyindex::val_nodeset(String *nodeset) String *Item_nodeset_func_elementbyindex::val_nodeset(String *nodeset)

View File

@ -731,15 +731,16 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
char key[MAX_DBKEY_LENGTH]; char key[MAX_DBKEY_LENGTH];
char *db= table_list->db; char *db= table_list->db;
uint key_length; uint key_length;
HASH_SEARCH_STATE state;
DBUG_ENTER("lock_table_name"); DBUG_ENTER("lock_table_name");
DBUG_PRINT("enter",("db: %s name: %s", db, table_list->table_name)); DBUG_PRINT("enter",("db: %s name: %s", db, table_list->table_name));
key_length= create_table_def_key(thd, key, table_list, 0); key_length= create_table_def_key(thd, key, table_list, 0);
/* Only insert the table if we haven't insert it already */ /* Only insert the table if we haven't insert it already */
for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ; for (table=(TABLE*) hash_first(&open_cache, (byte*)key, key_length, &state);
table ; table ;
table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length)) table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length, &state))
{ {
if (table->in_use == thd) if (table->in_use == thd)
{ {

View File

@ -241,13 +241,15 @@ static int binlog_savepoint_set(THD *thd, void *sv)
DBUG_ENTER("binlog_savepoint_set"); DBUG_ENTER("binlog_savepoint_set");
binlog_trx_data *const trx_data= binlog_trx_data *const trx_data=
(binlog_trx_data*) thd->ha_data[binlog_hton.slot]; (binlog_trx_data*) thd->ha_data[binlog_hton.slot];
IO_CACHE *trans_log= &trx_data->trans_log; DBUG_ASSERT(mysql_bin_log.is_open() && my_b_tell(&trx_data->trans_log));
DBUG_ASSERT(mysql_bin_log.is_open() && my_b_tell(trans_log));
*(my_off_t *)sv= my_b_tell(trans_log); *(my_off_t *)sv= my_b_tell(&trx_data->trans_log);
/* Write it to the binary log */ /* Write it to the binary log */
Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE, FALSE);
DBUG_RETURN(mysql_bin_log.write(&qinfo)); int const error=
thd->binlog_query(THD::STMT_QUERY_TYPE,
thd->query, thd->query_length, TRUE, FALSE);
DBUG_RETURN(error);
} }
static int binlog_savepoint_rollback(THD *thd, void *sv) static int binlog_savepoint_rollback(THD *thd, void *sv)
@ -265,8 +267,10 @@ static int binlog_savepoint_rollback(THD *thd, void *sv)
*/ */
if (unlikely(thd->options & OPTION_STATUS_NO_TRANS_UPDATE)) if (unlikely(thd->options & OPTION_STATUS_NO_TRANS_UPDATE))
{ {
Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE, FALSE); int const error=
DBUG_RETURN(mysql_bin_log.write(&qinfo)); thd->binlog_query(THD::STMT_QUERY_TYPE,
thd->query, thd->query_length, TRUE, FALSE);
DBUG_RETURN(error);
} }
reinit_io_cache(trans_log, WRITE_CACHE, *(my_off_t *)sv, 0, 0); reinit_io_cache(trans_log, WRITE_CACHE, *(my_off_t *)sv, 0, 0);
DBUG_RETURN(0); DBUG_RETURN(0);

View File

@ -118,13 +118,24 @@ static char *pretty_print_str(char *packet, char *str, int len)
/* /*
slave_load_file_stem() Creates a temporary name for load data infile:
SYNOPSIS
slave_load_file_stem()
buf Store new filename here
file_id File_id (part of file name)
event_server_id Event_id (part of file name)
ext Extension for file name
RETURN
Pointer to start of extension
*/ */
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
static inline char* slave_load_file_stem(char*buf, uint file_id, static char *slave_load_file_stem(char *buf, uint file_id,
int event_server_id) int event_server_id, const char *ext)
{ {
char *res;
fn_format(buf,"SQL_LOAD-",slave_load_tmpdir, "", MY_UNPACK_FILENAME); fn_format(buf,"SQL_LOAD-",slave_load_tmpdir, "", MY_UNPACK_FILENAME);
to_unix_path(buf); to_unix_path(buf);
@ -133,7 +144,9 @@ static inline char* slave_load_file_stem(char*buf, uint file_id,
*buf++ = '-'; *buf++ = '-';
buf = int10_to_str(event_server_id, buf, 10); buf = int10_to_str(event_server_id, buf, 10);
*buf++ = '-'; *buf++ = '-';
return int10_to_str(file_id, buf, 10); res= int10_to_str(file_id, buf, 10);
strmov(res, ext); // Add extension last
return res; // Pointer to extension
} }
#endif #endif
@ -928,7 +941,6 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info)
/* Pretty-print event common header if header is exactly 19 bytes */ /* Pretty-print event common header if header is exactly 19 bytes */
if (print_event_info->common_header_len == LOG_EVENT_MINIMAL_HEADER_LEN) if (print_event_info->common_header_len == LOG_EVENT_MINIMAL_HEADER_LEN)
{ {
DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
fprintf(file, "# Position Timestamp Type Master ID " fprintf(file, "# Position Timestamp Type Master ID "
"Size Master Pos Flags \n"); "Size Master Pos Flags \n");
fprintf(file, "# %8.8lx %02x %02x %02x %02x %02x " fprintf(file, "# %8.8lx %02x %02x %02x %02x %02x "
@ -954,7 +966,6 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info)
if (i % 16 == 15) if (i % 16 == 15)
{ {
DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
fprintf(file, "# %8.8lx %-48.48s |%16s|\n", fprintf(file, "# %8.8lx %-48.48s |%16s|\n",
(unsigned long) (hexdump_from + (i & 0xfffffff0)), (unsigned long) (hexdump_from + (i & 0xfffffff0)),
hex_string, char_string); hex_string, char_string);
@ -968,12 +979,10 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info)
*c= '\0'; *c= '\0';
/* Non-full last line */ /* Non-full last line */
if (hex_string[0]) { if (hex_string[0])
DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
fprintf(file, "# %8.8lx %-48.48s |%s|\n# ", fprintf(file, "# %8.8lx %-48.48s |%s|\n# ",
(unsigned long) (hexdump_from + (i & 0xfffffff0)), (unsigned long) (hexdump_from + (i & 0xfffffff0)),
hex_string, char_string); hex_string, char_string);
}
} }
} }
@ -4238,16 +4247,15 @@ void Create_file_log_event::pack_info(Protocol *protocol)
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Create_file_log_event::exec_event(struct st_relay_log_info* rli) int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
{ {
char proc_info[17+FN_REFLEN+10], *fname_buf= proc_info+17; char proc_info[17+FN_REFLEN+10], *fname_buf;
char *p; char *ext;
int fd = -1; int fd = -1;
IO_CACHE file; IO_CACHE file;
int error = 1; int error = 1;
bzero((char*)&file, sizeof(file)); bzero((char*)&file, sizeof(file));
p = slave_load_file_stem(fname_buf, file_id, server_id); fname_buf= strmov(proc_info, "Making temp file ");
strmov(p, ".info"); // strmov takes less code than memcpy ext= slave_load_file_stem(fname_buf, file_id, server_id, ".info");
strnmov(proc_info, STRING_WITH_LEN("Making temp file ")); // no end 0
thd->proc_info= proc_info; thd->proc_info= proc_info;
my_delete(fname_buf, MYF(0)); // old copy may exist already my_delete(fname_buf, MYF(0)); // old copy may exist already
if ((fd= my_create(fname_buf, CREATE_MODE, if ((fd= my_create(fname_buf, CREATE_MODE,
@ -4262,12 +4270,11 @@ int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
} }
// a trick to avoid allocating another buffer // a trick to avoid allocating another buffer
strmov(p, ".data"); fname= fname_buf;
fname = fname_buf; fname_len= (uint) (strmov(ext, ".data") - fname);
fname_len = (uint)(p-fname) + 5;
if (write_base(&file)) if (write_base(&file))
{ {
strmov(p, ".info"); // to have it right in the error message strmov(ext, ".info"); // to have it right in the error message
slave_print_msg(ERROR_LEVEL, rli, my_errno, slave_print_msg(ERROR_LEVEL, rli, my_errno,
"Error in Create_file event: could not write to file '%s'", "Error in Create_file event: could not write to file '%s'",
fname_buf); fname_buf);
@ -4413,13 +4420,12 @@ int Append_block_log_event::get_create_or_append() const
int Append_block_log_event::exec_event(struct st_relay_log_info* rli) int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
{ {
char proc_info[17+FN_REFLEN+10], *fname= proc_info+17; char proc_info[17+FN_REFLEN+10], *fname= proc_info+17;
char *p= slave_load_file_stem(fname, file_id, server_id);
int fd; int fd;
int error = 1; int error = 1;
DBUG_ENTER("Append_block_log_event::exec_event"); DBUG_ENTER("Append_block_log_event::exec_event");
memcpy(p, ".data", 6); fname= strmov(proc_info, "Making temp file ");
strnmov(proc_info, STRING_WITH_LEN("Making temp file ")); // no end 0 slave_load_file_stem(fname, file_id, server_id, ".data");
thd->proc_info= proc_info; thd->proc_info= proc_info;
if (get_create_or_append()) if (get_create_or_append())
{ {
@ -4545,10 +4551,9 @@ void Delete_file_log_event::pack_info(Protocol *protocol)
int Delete_file_log_event::exec_event(struct st_relay_log_info* rli) int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
{ {
char fname[FN_REFLEN+10]; char fname[FN_REFLEN+10];
char *p= slave_load_file_stem(fname, file_id, server_id); char *ext= slave_load_file_stem(fname, file_id, server_id, ".data");
memcpy(p, ".data", 6);
(void) my_delete(fname, MYF(MY_WME)); (void) my_delete(fname, MYF(MY_WME));
memcpy(p, ".info", 6); strmov(ext, ".info");
(void) my_delete(fname, MYF(MY_WME)); (void) my_delete(fname, MYF(MY_WME));
return Log_event::exec_event(rli); return Log_event::exec_event(rli);
} }
@ -4641,13 +4646,13 @@ void Execute_load_log_event::pack_info(Protocol *protocol)
int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
{ {
char fname[FN_REFLEN+10]; char fname[FN_REFLEN+10];
char *p= slave_load_file_stem(fname, file_id, server_id); char *ext;
int fd; int fd;
int error = 1; int error= 1;
IO_CACHE file; IO_CACHE file;
Load_log_event* lev = 0; Load_log_event *lev= 0;
memcpy(p, ".info", 6); ext= slave_load_file_stem(fname, file_id, server_id, ".info");
if ((fd = my_open(fname, O_RDONLY | O_BINARY | O_NOFOLLOW, if ((fd = my_open(fname, O_RDONLY | O_BINARY | O_NOFOLLOW,
MYF(MY_WME))) < 0 || MYF(MY_WME))) < 0 ||
init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0, init_io_cache(&file, fd, IO_SIZE, READ_CACHE, (my_off_t)0, 0,
@ -4708,7 +4713,7 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
fd= -1; fd= -1;
} }
(void) my_delete(fname, MYF(MY_WME)); (void) my_delete(fname, MYF(MY_WME));
memcpy(p, ".data", 6); memcpy(ext, ".data", 6);
(void) my_delete(fname, MYF(MY_WME)); (void) my_delete(fname, MYF(MY_WME));
error = 0; error = 0;
@ -4906,11 +4911,10 @@ Execute_load_query_log_event::exec_event(struct st_relay_log_info* rli)
memcpy(p, query, fn_pos_start); memcpy(p, query, fn_pos_start);
p+= fn_pos_start; p+= fn_pos_start;
fname= (p= strmake(p, STRING_WITH_LEN(" INFILE \'"))); fname= (p= strmake(p, STRING_WITH_LEN(" INFILE \'")));
p= slave_load_file_stem(p, file_id, server_id); p= slave_load_file_stem(p, file_id, server_id, ".data");
fname_end= (p= strmake(p, STRING_WITH_LEN(".data"))); fname_end= p= strend(p); // Safer than p=p+5
*(p++)='\''; *(p++)='\'';
switch (dup_handling) switch (dup_handling) {
{
case LOAD_DUP_IGNORE: case LOAD_DUP_IGNORE:
p= strmake(p, STRING_WITH_LEN(" IGNORE")); p= strmake(p, STRING_WITH_LEN(" IGNORE"));
break; break;

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