Auto Merge
This commit is contained in:
commit
08399602a6
@ -389,6 +389,9 @@ client/readline.cpp
|
||||
client/rpl_constants.h
|
||||
client/rpl_record_old.cc
|
||||
client/rpl_record_old.h
|
||||
client/rpl_tblmap.h
|
||||
client/rpl_tblmap.cc
|
||||
client/rpl_utility.h
|
||||
client/select_test
|
||||
client/sql_string.cpp
|
||||
client/ssl_test
|
||||
|
@ -176,7 +176,7 @@ check_cpu () {
|
||||
fi
|
||||
|
||||
cc_ver=`$cc --version | sed 1q`
|
||||
cc_verno=`echo $cc_ver | sed -e 's/^.*gcc/gcc/g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
|
||||
cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
|
||||
set -- `echo $cc_verno | tr '.' ' '`
|
||||
cc_major=$1
|
||||
cc_minor=$2
|
||||
|
@ -49,7 +49,7 @@ bin-dist: all
|
||||
$(top_builddir)/scripts/make_binary_distribution @MAKE_BINARY_DISTRIBUTION_OPTIONS@
|
||||
|
||||
# Remove BK's "SCCS" subdirectories from source distribution
|
||||
# Create initial database files for Windows installations.
|
||||
# Create initial database files for Windows installations and check them.
|
||||
dist-hook:
|
||||
rm -rf `find $(distdir) -type d -name SCCS -print`
|
||||
mkdir -p $(distdir)/win
|
||||
@ -57,6 +57,7 @@ dist-hook:
|
||||
--builddir=$(top_builddir) \
|
||||
--datadir=$(distdir)/win/data \
|
||||
--srcdir=$(top_srcdir)
|
||||
storage/myisam/myisamchk --silent --fast $(distdir)/win/data/mysql/*.MYI
|
||||
|
||||
tags:
|
||||
support-files/build-tags
|
||||
|
@ -104,6 +104,7 @@ DEFS = -DUNDEF_THREADS_HACK \
|
||||
-DDATADIR="\"$(localstatedir)\""
|
||||
|
||||
sql_src=log_event.h mysql_priv.h rpl_constants.h \
|
||||
rpl_utility.h rpl_tblmap.h rpl_tblmap.cc \
|
||||
log_event.cc my_decimal.h my_decimal.cc \
|
||||
log_event_old.h log_event_old.cc \
|
||||
rpl_record_old.h rpl_record_old.cc
|
||||
|
@ -64,7 +64,8 @@ static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
|
||||
static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0;
|
||||
static bool opt_hexdump= 0;
|
||||
const char *base64_output_mode_names[]= {"NEVER", "AUTO", "ALWAYS", NullS};
|
||||
const char *base64_output_mode_names[]=
|
||||
{"NEVER", "AUTO", "ALWAYS", "UNSPEC", "DECODE-ROWS", NullS};
|
||||
TYPELIB base64_output_mode_typelib=
|
||||
{ array_elements(base64_output_mode_names) - 1, "",
|
||||
base64_output_mode_names, NULL };
|
||||
@ -83,6 +84,8 @@ static const char* user = 0;
|
||||
static char* pass = 0;
|
||||
static char *charset= 0;
|
||||
|
||||
static uint verbose= 0;
|
||||
|
||||
static ulonglong start_position, stop_position;
|
||||
#define start_position_mot ((my_off_t)start_position)
|
||||
#define stop_position_mot ((my_off_t)stop_position)
|
||||
@ -1063,6 +1066,9 @@ that may lead to an endless loop.",
|
||||
{"user", 'u', "Connect to the remote server as username.",
|
||||
(uchar**) &user, (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
|
||||
0, 0},
|
||||
{"verbose", 'v', "Reconstruct SQL statements out of row events. "
|
||||
"-v -v adds comments on column data types",
|
||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
|
||||
0, 0, 0, 0, 0},
|
||||
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
|
||||
@ -1258,6 +1264,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
(find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1);
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
if (argument == disabled_my_option)
|
||||
verbose= 0;
|
||||
else
|
||||
verbose++;
|
||||
break;
|
||||
case 'V':
|
||||
print_version();
|
||||
exit(0);
|
||||
@ -1343,6 +1355,8 @@ static Exit_status dump_log_entries(const char* logname)
|
||||
*/
|
||||
fprintf(result_file, "DELIMITER /*!*/;\n");
|
||||
strmov(print_event_info.delimiter, "/*!*/;");
|
||||
|
||||
print_event_info.verbose= short_form ? 0 : verbose;
|
||||
|
||||
rc= (remote_opt ? dump_remote_log_entries(&print_event_info, logname) :
|
||||
dump_local_log_entries(&print_event_info, logname));
|
||||
|
@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
|
||||
#
|
||||
# When changing major version number please also check switch statement
|
||||
# in mysqlbinlog::check_master_version().
|
||||
AM_INIT_AUTOMAKE(mysql, 5.1.28)
|
||||
AM_INIT_AUTOMAKE(mysql, 5.1.30)
|
||||
AM_CONFIG_HEADER([include/config.h:config.h.in])
|
||||
|
||||
PROTOCOL_VERSION=10
|
||||
|
@ -246,7 +246,7 @@ extern int NEAR my_umask, /* Default creation mask */
|
||||
NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
|
||||
NEAR my_dont_interrupt; /* call remember_intr when set */
|
||||
extern my_bool NEAR mysys_uses_curses, my_use_symdir;
|
||||
extern ulong sf_malloc_cur_memory, sf_malloc_max_memory;
|
||||
extern size_t sf_malloc_cur_memory, sf_malloc_max_memory;
|
||||
|
||||
extern ulong my_default_record_cache_size;
|
||||
extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
|
||||
@ -577,6 +577,7 @@ extern int my_close(File Filedes,myf MyFlags);
|
||||
extern File my_dup(File file, myf MyFlags);
|
||||
extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
|
||||
extern int my_readlink(char *to, const char *filename, myf MyFlags);
|
||||
extern int my_is_symlink(const char *filename);
|
||||
extern int my_realpath(char *to, const char *filename, myf MyFlags);
|
||||
extern File my_create_with_symlink(const char *linkname, const char *filename,
|
||||
int createflags, int access_flags,
|
||||
|
@ -256,6 +256,10 @@ extern my_bool myisam_flush,myisam_delay_key_write,myisam_single_user;
|
||||
extern my_off_t myisam_max_temp_length;
|
||||
extern ulong myisam_bulk_insert_tree_size, myisam_data_pointer_size;
|
||||
|
||||
/* usually used to check if a symlink points into the mysql data home */
|
||||
/* which is normally forbidden */
|
||||
extern int (*myisam_test_invalid_symlink)(const char *filename);
|
||||
|
||||
/* Prototypes for myisam-functions */
|
||||
|
||||
extern int mi_close(struct st_myisam_info *file);
|
||||
|
@ -1103,6 +1103,9 @@ void Protocol_text::prepare_for_resend()
|
||||
data->embedded_info->prev_ptr= &cur->next;
|
||||
next_field=cur->data;
|
||||
next_mysql_field= data->embedded_info->fields_list;
|
||||
#ifndef DBUG_OFF
|
||||
field_pos= 0;
|
||||
#endif
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ nobase_test_DATA = lib/mtr_cases.pm \
|
||||
lib/My/SafeProcess.pm \
|
||||
lib/My/File/Path.pm \
|
||||
lib/My/SysInfo.pm \
|
||||
lib/My/CoreDump.pm \
|
||||
lib/My/SafeProcess/Base.pm \
|
||||
lib/My/SafeProcess/safe_process.pl
|
||||
|
||||
|
@ -1 +1,3 @@
|
||||
SHOW PROCESSLIST;
|
||||
|
||||
exit;
|
||||
|
@ -4,354 +4,641 @@
|
||||
# Bug#3300
|
||||
# Designed and tested by Sinisa Milivojevic, sinisa@mysql.com
|
||||
#
|
||||
# two non-interfering UPDATE's not changing result set
|
||||
#
|
||||
# The variable
|
||||
# $engine_type -- storage engine to be tested
|
||||
# has to be set before sourcing this script.
|
||||
# These variables have to be set before sourcing this script:
|
||||
# TRANSACTION ISOLATION LEVEL REPEATABLE READ
|
||||
# innodb_locks_unsafe_for_binlog 0 (default) or 1 (by
|
||||
# --innodb_locks_unsafe_for_binlog)
|
||||
# $engine_type storage engine to be tested
|
||||
#
|
||||
# Last update:
|
||||
# 2006-08-02 ML test refactored
|
||||
# old name was t/innodb_concurrent.test
|
||||
# main code went into include/concurrent.inc
|
||||
# 2008-06-03 KP test refactored; removed name locks, added comments.
|
||||
# renamed wrapper t/concurrent_innodb.test ->
|
||||
# t/concurrent_innodb_unsafelog.test
|
||||
# new wrapper t/concurrent_innodb_safelog.test
|
||||
#
|
||||
|
||||
connection default;
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
|
||||
#
|
||||
# Show prerequisites for this test.
|
||||
#
|
||||
SELECT @@global.tx_isolation;
|
||||
SELECT @@global.innodb_locks_unsafe_for_binlog;
|
||||
#
|
||||
# When innodb_locks_unsafe_for_binlog is not set (zero), which is the
|
||||
# default, InnoDB takes "next-key locks"/"gap locks". This means it
|
||||
# locks the gap before the keys that it accessed to find the rows to
|
||||
# use for a statement. In this case we have to expect some more lock
|
||||
# wait timeouts in the tests below as if innodb_locks_unsafe_for_binlog
|
||||
# is set (non-zero). In the latter case no "next-key locks"/"gap locks"
|
||||
# are taken and locks on keys that do not match the WHERE conditon are
|
||||
# released. Hence less lock collisions occur.
|
||||
# We use the variable $keep_locks to set the expectations for
|
||||
# lock wait timeouts accordingly.
|
||||
#
|
||||
let $keep_locks= `SELECT NOT @@global.innodb_locks_unsafe_for_binlog`;
|
||||
--echo # keep_locks == $keep_locks
|
||||
|
||||
#
|
||||
# Set up privileges and remove user level locks, if exist.
|
||||
#
|
||||
GRANT USAGE ON test.* TO mysqltest@localhost;
|
||||
|
||||
#
|
||||
# Preparatory cleanup.
|
||||
#
|
||||
DO release_lock("hello");
|
||||
DO release_lock("hello2");
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",1);
|
||||
connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send update t1 set eta=1+get_lock("hello",1)*0 where tipo=11;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
update t1 set eta=2 where tipo=22;
|
||||
select release_lock("hello");
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
commit;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# two UPDATE's running and one changing result set
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
select release_lock("hello");
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
commit;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** two UPDATE's running and both changing distinct result sets
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
--echo ** Get user level lock (ULL) for thread 1
|
||||
select get_lock("hello",10);
|
||||
|
||||
--echo ** connection thread2
|
||||
connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Start transaction for thread 2
|
||||
begin;
|
||||
--echo ** Update will cause a table scan and a new ULL will
|
||||
--echo ** be created and blocked on the first row where tipo=11.
|
||||
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
|
||||
sleep 1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Start new transaction for thread 1
|
||||
begin;
|
||||
--echo ** Update on t1 will cause a table scan which will be blocked because
|
||||
--echo ** the previously initiated table scan applied exclusive key locks on
|
||||
--echo ** all primary keys.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set eta=2 where tipo=22;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set eta=2 where tipo=22;
|
||||
}
|
||||
--echo ** Release user level name lock from thread 1. This will cause the ULL
|
||||
--echo ** on thread 2 to end its wait.
|
||||
select release_lock("hello");
|
||||
--echo ** Table is now updated with a new eta on tipo=22 for thread 1.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Release the lock and collect result from update on thread 2
|
||||
reap;
|
||||
select release_lock("hello");
|
||||
--echo ** Table should have eta updates where tipo=11 but updates made by
|
||||
--echo ** thread 1 shouldn't be visible yet.
|
||||
select * from t1;
|
||||
--echo ** Sending commit on thread 2.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Make sure table reads didn't change yet on thread 1.
|
||||
select * from t1;
|
||||
--echo ** And send final commit on thread 1.
|
||||
commit;
|
||||
--echo ** Table should now be updated by both updates in the order of
|
||||
--echo ** thread 1,2.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Make sure the output is similar for t1.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# One UPDATE and one INSERT .... Monty's test
|
||||
#
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** two UPDATE's running and one changing result set
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
--echo ** Get ULL "hello" on thread 1
|
||||
select get_lock("hello",10);
|
||||
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
select get_lock("hello2",1000);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send update t1 set b=10+get_lock(concat("hello",a),1000)*0 where
|
||||
a=2;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
insert into t1 values (1,1);
|
||||
select release_lock("hello2");
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
sleep 1;
|
||||
connection thread2;
|
||||
reap;
|
||||
connection default;
|
||||
drop table t1;
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Start transaction on thread 2
|
||||
begin;
|
||||
--echo ** Update will cause a table scan.
|
||||
--echo ** This will cause a hang on the first row where tipo=1 until the
|
||||
--echo ** blocking ULL is released.
|
||||
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
sleep 1;
|
||||
|
||||
#
|
||||
# one UPDATE changing result set and SELECT ... FOR UPDATE
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send select * from t1 where tipo=2 FOR UPDATE;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
--error 1205
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
commit;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
connection default;
|
||||
drop table t1;
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Start transaction on thread 1
|
||||
begin;
|
||||
--echo ** Update on t1 will cause a table scan which will be blocked because
|
||||
--echo ** the previously initiated table scan applied exclusive key locks on
|
||||
--echo ** all primary keys.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
}
|
||||
--echo ** Release ULL. This will release the next waiting ULL on thread 2.
|
||||
select release_lock("hello");
|
||||
--echo ** The table should still be updated with updates for thread 1 only:
|
||||
select * from t1;
|
||||
|
||||
#
|
||||
# one UPDATE not changing result set and SELECT ... FOR UPDATE
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send select * from t1 where tipo=2 FOR UPDATE;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
--error 1205
|
||||
update t1 set tipo=11+get_lock("hello",10)*0 where tipo=22;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
commit;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
connection default;
|
||||
drop table t1;
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Release the lock and collect result from thread 2:
|
||||
reap;
|
||||
select release_lock("hello");
|
||||
--echo ** Seen from thread 2 the table should have been updated on four
|
||||
--echo ** places.
|
||||
select * from t1;
|
||||
commit;
|
||||
|
||||
#
|
||||
# two SELECT ... FOR UPDATE
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send select * from t1 where tipo=2 FOR UPDATE;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
--error 1205
|
||||
select * from t1 where tipo=1 FOR UPDATE;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
commit;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Thread 2 has committed but the result should remain the same for
|
||||
--echo ** thread 1 (updated on three places):
|
||||
select * from t1;
|
||||
commit;
|
||||
--echo ** After a commit the table should be merged with the previous
|
||||
--echo ** commit.
|
||||
--echo ** This select should show both updates:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# one UPDATE changing result set and DELETE
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send delete from t1 where tipo=2;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
--error 1205
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
commit;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** One UPDATE and one INSERT .... Monty's test
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
--echo ** Create ULL 'hello2'
|
||||
select get_lock("hello2",10);
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Begin a new transaction on thread 2
|
||||
begin;
|
||||
--echo ** Update will create a table scan which creates a ULL where a=2;
|
||||
--echo ** this will hang waiting on thread 1.
|
||||
send update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
|
||||
sleep 1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Insert new values to t1 from thread 1; this created an implicit
|
||||
--echo ** commit since there are no on-going transactions.
|
||||
insert into t1 values (1,1);
|
||||
--echo ** Release the ULL (thread 2 updates will finish).
|
||||
select release_lock("hello2");
|
||||
--echo ** ..but thread 1 will still see t1 as if nothing has happend:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Collect results from thread 2 and release the lock.
|
||||
reap;
|
||||
select release_lock("hello2");
|
||||
--echo ** The table should look like the original+updates for thread 2,
|
||||
--echo ** and consist of new rows:
|
||||
select * from t1;
|
||||
--echo ** Commit changes from thread 2
|
||||
commit;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# one UPDATE not changing result set and DELETE
|
||||
#
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send delete from t1 where tipo=2;
|
||||
sleep 1;
|
||||
connection thread1;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=22;
|
||||
select * from t1;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
connection thread1;
|
||||
commit;
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE changing result set and SELECT ... FOR UPDATE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Begin a new transaction on thread 2
|
||||
begin;
|
||||
--echo ** Select a range for update.
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Begin a new transaction on thread 1
|
||||
begin;
|
||||
--echo ** Update the same range which is marked for update on thread 2; this
|
||||
--echo ** will hang because of row locks.
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
--echo ** After the update the table will be unmodified because the previous
|
||||
--echo ** transaction failed and was rolled back.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** The table should look unmodified from thread 2.
|
||||
select * from t1;
|
||||
--echo ** Sending a commit should release the row locks and enable
|
||||
--echo ** thread 1 to complete the transaction.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Commit on thread 1.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** The table should not have been changed.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Even on thread 1:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
sleep 1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE not changing result set and SELECT ... FOR UPDATE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Starting new transaction on thread 2.
|
||||
begin;
|
||||
--echo ** Starting SELECT .. FOR UPDATE
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo
|
||||
--echo ** Starting new transaction on thread 1
|
||||
begin;
|
||||
--echo ** Updating single row using a table scan. This will time out
|
||||
--echo ** because of ongoing transaction on thread 1 holding lock on
|
||||
--echo ** all primary keys in the scan.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
}
|
||||
--echo ** After the time out the transaction is aborted; no rows should
|
||||
--echo ** have changed.
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** The same thing should hold true for the transaction on
|
||||
--echo ** thread 2
|
||||
select * from t1;
|
||||
send commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Even after committing:
|
||||
reap;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** two SELECT ... FOR UPDATE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
--echo ** Begin a new transaction on thread 2
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Begin a new transaction on thread 1
|
||||
begin;
|
||||
--echo ** Selecting a range for update by table scan will be blocked
|
||||
--echo ** because of on-going transaction on thread 2.
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
select * from t1 where tipo=1 FOR UPDATE;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Table will be unchanged and the select command will not be
|
||||
--echo ** blocked:
|
||||
select * from t1;
|
||||
--echo ** Commit transacton on thread 2.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Commit transaction on thread 1.
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
--echo ** Make sure table isn't blocked on thread 2:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
--echo ** Make sure table isn't blocked on thread 1:
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE changing result set and DELETE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send delete from t1 where tipo=2;
|
||||
sleep 1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
begin;
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo
|
||||
--echo **
|
||||
--echo ** one UPDATE not changing result set and DELETE
|
||||
--echo **
|
||||
--echo ** connection thread1
|
||||
#connect (thread1, localhost, mysqltest,,);
|
||||
connection thread1;
|
||||
--echo ** Set up table
|
||||
eval SET SESSION STORAGE_ENGINE = $engine_type;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
|
||||
--echo ** connection thread2
|
||||
#connect (thread2, localhost, mysqltest,,);
|
||||
connection thread2;
|
||||
begin;
|
||||
send delete from t1 where tipo=2;
|
||||
sleep 1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
begin;
|
||||
--echo ** Update on t1 will cause a table scan which will be blocked because
|
||||
--echo ** the previously initiated table scan applied exclusive key locks on
|
||||
--echo ** all primary keys.
|
||||
--echo ** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
--echo ** do not match the WHERE condition are released.
|
||||
if ($keep_locks)
|
||||
{
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
}
|
||||
if (!$keep_locks)
|
||||
{
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
}
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
send commit;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
commit;
|
||||
|
||||
--echo ** connection thread2
|
||||
connection thread2;
|
||||
reap;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection thread1
|
||||
connection thread1;
|
||||
select * from t1;
|
||||
|
||||
--echo ** connection default
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
|
||||
disconnect thread1;
|
||||
disconnect thread2;
|
||||
|
||||
|
4
mysql-test/include/have_case_insensitive_file_system.inc
Normal file
4
mysql-test/include/have_case_insensitive_file_system.inc
Normal file
@ -0,0 +1,4 @@
|
||||
--require r/case_insensitive_file_system.require
|
||||
--disable_query_log
|
||||
show variables like "lower_case_file_system";
|
||||
--enable_query_log
|
@ -1,4 +1,4 @@
|
||||
--require r/lowercase0.require
|
||||
--disable_query_log
|
||||
show variables like 'lower_case_%';
|
||||
show variables like "lower_case_table_names";
|
||||
--enable_query_log
|
||||
|
4
mysql-test/include/have_lowercase2.inc
Normal file
4
mysql-test/include/have_lowercase2.inc
Normal file
@ -0,0 +1,4 @@
|
||||
--require r/lowercase2.require
|
||||
--disable_query_log
|
||||
show variables like 'lower_case_table_names';
|
||||
--enable_query_log
|
@ -8,7 +8,7 @@ use mtr||
|
||||
--
|
||||
CREATE TABLE suspicious_patterns (
|
||||
pattern VARCHAR(255)
|
||||
)||
|
||||
) ENGINE=MyISAM||
|
||||
|
||||
|
||||
--
|
||||
@ -46,7 +46,7 @@ INSERT INTO suspicious_patterns VALUES
|
||||
--
|
||||
CREATE TABLE test_supressions (
|
||||
pattern VARCHAR(255)
|
||||
)||
|
||||
) ENGINE=MyISAM||
|
||||
|
||||
|
||||
--
|
||||
@ -69,7 +69,7 @@ END
|
||||
--
|
||||
CREATE TABLE global_supressions (
|
||||
pattern VARCHAR(255)
|
||||
)||
|
||||
) ENGINE=MyISAM||
|
||||
|
||||
|
||||
-- Declare a trigger that makes sure
|
||||
@ -227,7 +227,7 @@ BEGIN
|
||||
CREATE TEMPORARY TABLE error_log (
|
||||
row INT AUTO_INCREMENT PRIMARY KEY,
|
||||
line mediumtext NULL
|
||||
);
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
SELECT variable_value INTO @log_error
|
||||
FROM information_schema.global_variables
|
||||
@ -255,7 +255,7 @@ BEGIN
|
||||
WHERE line REGEXP "^CURRENT_TEST:";
|
||||
DELETE FROM error_log WHERE row < @max_row;
|
||||
|
||||
CREATE TEMPORARY TABLE suspect_lines AS
|
||||
CREATE TEMPORARY TABLE suspect_lines ENGINE=MyISAM AS
|
||||
SELECT DISTINCT el.line, 0 as "supressed"
|
||||
FROM error_log el, suspicious_patterns ep
|
||||
WHERE el.line REGEXP ep.pattern;
|
||||
|
1922
mysql-test/include/mysqlbinlog_row_engine.inc
Normal file
1922
mysql-test/include/mysqlbinlog_row_engine.inc
Normal file
File diff suppressed because it is too large
Load Diff
25
mysql-test/include/ps_ddl_1.inc
Normal file
25
mysql-test/include/ps_ddl_1.inc
Normal file
@ -0,0 +1,25 @@
|
||||
# include/ps_ddl_1.inc
|
||||
#
|
||||
# Auxiliary script to be used in ps_ddl.test
|
||||
#
|
||||
|
||||
prepare stmt_sf from 'select f_12093();';
|
||||
prepare stmt_sp from 'call p_12093(f_12093())';
|
||||
execute stmt_sf;
|
||||
execute stmt_sp;
|
||||
|
||||
connection con1;
|
||||
eval $my_drop;
|
||||
#
|
||||
connection default;
|
||||
--echo # XXX: used to be a bug
|
||||
execute stmt_sf;
|
||||
--echo # XXX: used to be a bug
|
||||
execute stmt_sp;
|
||||
#
|
||||
--echo # XXX: used to be a bug
|
||||
execute stmt_sf;
|
||||
--echo # XXX: used to be a bug
|
||||
execute stmt_sp;
|
||||
|
||||
connection default;
|
@ -9,3 +9,4 @@ show engines;
|
||||
show variables;
|
||||
--echo ===== STOP =====
|
||||
--enable_query_log
|
||||
exit;
|
@ -27,6 +27,16 @@ sub value {
|
||||
return $self->{value};
|
||||
}
|
||||
|
||||
sub option {
|
||||
my ($self)= @_;
|
||||
my $name= $self->{name};
|
||||
my $value= $self->{value};
|
||||
|
||||
my $opt= $name;
|
||||
$opt= "$name=$value" if ($value);
|
||||
$opt= "--$opt" unless ($opt =~ /^--/);
|
||||
return $opt;
|
||||
}
|
||||
|
||||
package My::Config::Group;
|
||||
|
||||
|
79
mysql-test/lib/My/CoreDump.pm
Normal file
79
mysql-test/lib/My/CoreDump.pm
Normal file
@ -0,0 +1,79 @@
|
||||
# -*- cperl -*-
|
||||
# Copyright (C) 2004-2006 MySQL AB
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
package My::CoreDump;
|
||||
|
||||
use strict;
|
||||
use Carp;
|
||||
use My::Platform;
|
||||
|
||||
use File::Temp qw/ tempfile tempdir /;
|
||||
|
||||
sub _gdb {
|
||||
my ($core_name)= @_;
|
||||
|
||||
return unless -f $core_name;
|
||||
|
||||
my $dir = tempdir( CLEANUP => 1 );
|
||||
my ($tmp, $tmp_name) = tempfile( DIR => $dir );
|
||||
|
||||
print $tmp
|
||||
"thread apply all bt\n",
|
||||
"quit\n";
|
||||
|
||||
# Find out name of binary that generated core
|
||||
my $list= `gdb -c $core_name -x $tmp_name -q --batch 2>&1`
|
||||
or return;
|
||||
|
||||
my $binary;
|
||||
foreach my $line (split('\n', $list))
|
||||
{
|
||||
$binary= $1
|
||||
if ($line =~ /Core was generated by `(\S+)/);
|
||||
}
|
||||
|
||||
return unless $binary;
|
||||
|
||||
print "Generated by '$binary'\n";
|
||||
|
||||
my $list= `gdb $binary -c $core_name -x $tmp_name -q --batch 2>&1`
|
||||
or return;
|
||||
|
||||
print $list, "\n";
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
sub show {
|
||||
my ($class, $core_name)= @_;
|
||||
|
||||
my @debuggers =
|
||||
(
|
||||
\&_gdb,
|
||||
# TODO...
|
||||
);
|
||||
|
||||
foreach my $debugger (@debuggers){
|
||||
if ($debugger->($core_name)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
1;
|
@ -26,7 +26,7 @@ use Carp;
|
||||
use My::Platform;
|
||||
|
||||
use base qw(Exporter);
|
||||
our @EXPORT= qw(my_find_bin my_find_dir NOT_REQUIRED);
|
||||
our @EXPORT= qw(my_find_bin my_find_dir my_find_file NOT_REQUIRED);
|
||||
|
||||
our $vs_config_dir;
|
||||
|
||||
@ -53,7 +53,7 @@ sub NOT_REQUIRED { return 0; }
|
||||
# binary is not found
|
||||
# my $mysql_exe= my_find_bin($basedir,
|
||||
# ["client", "bin"],
|
||||
# "mysql", 0);
|
||||
# "mysql", NOT_REQUIRED);
|
||||
#
|
||||
# NOTE: The function honours MTR_VS_CONFIG environment variable
|
||||
#
|
||||
@ -77,6 +77,40 @@ sub my_find_bin {
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# my_find_file - find a file with "name_1...name_n" in
|
||||
# paths "path_1...path_n" and return the full path
|
||||
#
|
||||
# Example:
|
||||
# my $mysqld_exe= my_find_file($basedir.
|
||||
# ["sql", "bin"],
|
||||
# "filename");
|
||||
#
|
||||
#
|
||||
# Also supports NOT_REQUIRED flag
|
||||
#
|
||||
# NOTE: The function honours MTR_VS_CONFIG environment variable
|
||||
#
|
||||
#
|
||||
sub my_find_file {
|
||||
my ($base, $paths, $names, $required)= @_;
|
||||
croak "usage: my_find_file(<base>, <paths>, <names>, [<required>])"
|
||||
unless @_ == 4 or @_ == 3;
|
||||
|
||||
# -------------------------------------------------------
|
||||
# Find and return the first executable
|
||||
# -------------------------------------------------------
|
||||
foreach my $path (my_find_paths($base, $paths, $names, $bin_extension)) {
|
||||
return $path if ( -f $path );
|
||||
}
|
||||
if (defined $required and $required == NOT_REQUIRED){
|
||||
# Return empty string to indicate not found
|
||||
return "";
|
||||
}
|
||||
find_error($base, $paths, $names);
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# my_find_dir - find the first existing directory in one of
|
||||
# the given paths
|
||||
|
@ -17,6 +17,8 @@
|
||||
package My::Platform;
|
||||
|
||||
use strict;
|
||||
use File::Basename;
|
||||
use My::File::Path; # Patched version of File::Path
|
||||
|
||||
use base qw(Exporter);
|
||||
our @EXPORT= qw(IS_CYGWIN IS_WINDOWS IS_WIN32PERL
|
||||
@ -62,19 +64,23 @@ BEGIN {
|
||||
# in cygwin perl (that uses unix paths)
|
||||
#
|
||||
|
||||
use Memoize;
|
||||
memoize('mixed_path');
|
||||
memoize('native_path');
|
||||
memoize('posix_path');
|
||||
|
||||
sub mixed_path {
|
||||
my ($path)= @_;
|
||||
if (IS_CYGWIN){
|
||||
return unless defined $path;
|
||||
my $cmd= "cygpath -m $path";
|
||||
print "$cmd\n";
|
||||
$path= `$cmd`;
|
||||
$path= `$cmd` or
|
||||
print "Failed to run: '$cmd', $!\n";
|
||||
chomp $path;
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
||||
|
||||
sub native_path {
|
||||
my ($path)= @_;
|
||||
$path=~ s/\//\\/g
|
||||
@ -82,7 +88,6 @@ sub native_path {
|
||||
return $path;
|
||||
}
|
||||
|
||||
|
||||
sub posix_path {
|
||||
my ($path)= @_;
|
||||
if (IS_CYGWIN){
|
||||
@ -102,14 +107,27 @@ sub check_socket_path_length {
|
||||
|
||||
require IO::Socket::UNIX;
|
||||
|
||||
my $sock = new IO::Socket::UNIX
|
||||
(
|
||||
Local => $path,
|
||||
Listen => 1,
|
||||
);
|
||||
my $sock;
|
||||
eval {
|
||||
# Create the directories where the
|
||||
# socket till be created
|
||||
mkpath(dirname($path));
|
||||
|
||||
$sock= new IO::Socket::UNIX
|
||||
(
|
||||
Local => $path,
|
||||
Listen => 1,
|
||||
);
|
||||
|
||||
};
|
||||
if ($@)
|
||||
{
|
||||
print $@, '\n';
|
||||
return 2;
|
||||
}
|
||||
if (!defined $sock){
|
||||
# Could not create a UNIX domain socket
|
||||
return 0; # Ok, will not be used by mysqld either
|
||||
#print "Could not create UNIX domain socket: $!\n";
|
||||
return 3;
|
||||
}
|
||||
if ($path ne $sock->hostpath()){
|
||||
# Path was truncated
|
||||
|
@ -397,7 +397,7 @@ sub collect_one_suite($)
|
||||
my $comb= {};
|
||||
$comb->{name}= $group->name();
|
||||
foreach my $option ( $group->options() ) {
|
||||
push(@{$comb->{comb_opt}}, $option->name()."=".$option->value());
|
||||
push(@{$comb->{comb_opt}}, $option->option());
|
||||
}
|
||||
push(@combinations, $comb);
|
||||
}
|
||||
@ -699,6 +699,12 @@ sub collect_one_test_case {
|
||||
# should fail by default
|
||||
$tinfo->{result_file}= $result_file;
|
||||
}
|
||||
else {
|
||||
# No .result file exist
|
||||
# Remember the path where it should be
|
||||
# saved in case of --record
|
||||
$tinfo->{record_file}= $result_file;
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Skip some tests but include in list, just mark them as skipped
|
||||
|
@ -20,25 +20,14 @@
|
||||
|
||||
use strict;
|
||||
|
||||
# These are not to be prefixed with "mtr_"
|
||||
sub gcov_prepare ($) {
|
||||
my ($dir)= @_;
|
||||
|
||||
sub gcov_prepare ();
|
||||
sub gcov_collect ();
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub gcov_prepare () {
|
||||
|
||||
`find $::glob_basedir -name \*.gcov \
|
||||
`find $dir -name \*.gcov \
|
||||
-or -name \*.da | xargs rm`;
|
||||
}
|
||||
|
||||
# Used by gcov
|
||||
our @mysqld_src_dirs=
|
||||
my @mysqld_src_dirs=
|
||||
(
|
||||
"strings",
|
||||
"mysys",
|
||||
@ -53,21 +42,24 @@ our @mysqld_src_dirs=
|
||||
"sql",
|
||||
);
|
||||
|
||||
sub gcov_collect () {
|
||||
sub gcov_collect ($$$) {
|
||||
my ($dir, $gcov, $gcov_msg, $gcov_err)= @_;
|
||||
|
||||
my $start_dir= cwd();
|
||||
|
||||
print "Collecting source coverage info...\n";
|
||||
-f $::opt_gcov_msg and unlink($::opt_gcov_msg);
|
||||
-f $::opt_gcov_err and unlink($::opt_gcov_err);
|
||||
-f $gcov_msg and unlink($gcov_msg);
|
||||
-f $gcov_err and unlink($gcov_err);
|
||||
foreach my $d ( @mysqld_src_dirs )
|
||||
{
|
||||
chdir("$::glob_basedir/$d");
|
||||
chdir("$dir/$d");
|
||||
foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) )
|
||||
{
|
||||
`$::opt_gcov $f 2>>$::opt_gcov_err >>$::opt_gcov_msg`;
|
||||
`$gcov $f 2>>$gcov_err >>$gcov_msg`;
|
||||
}
|
||||
chdir($::glob_mysql_test_dir);
|
||||
chdir($start_dir);
|
||||
}
|
||||
print "gcov info in $::opt_gcov_msg, errors in $::opt_gcov_err\n";
|
||||
print "gcov info in $gcov_msg, errors in $gcov_err\n";
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,6 +50,7 @@ use My::ConfigFactory;
|
||||
use My::Options;
|
||||
use My::Find;
|
||||
use My::SysInfo;
|
||||
use My::CoreDump;
|
||||
use mtr_cases;
|
||||
use mtr_report;
|
||||
use mtr_match;
|
||||
@ -165,11 +166,9 @@ my $opt_repeat= 1;
|
||||
my $opt_retry= 3;
|
||||
my $opt_retry_failure= 2;
|
||||
|
||||
my $opt_parallel= $ENV{MTR_PARALLEL};
|
||||
|
||||
my $opt_strace_client;
|
||||
|
||||
our $opt_user;
|
||||
our $opt_user = "root";
|
||||
|
||||
my $opt_valgrind= 0;
|
||||
my $opt_valgrind_mysqld= 0;
|
||||
@ -189,8 +188,6 @@ my $exe_ndbd;
|
||||
my $exe_ndb_mgmd;
|
||||
my $exe_ndb_waiter;
|
||||
|
||||
our $path_sql_dir;
|
||||
|
||||
our $debug_compiled_binaries;
|
||||
|
||||
our %mysqld_variables;
|
||||
@ -208,6 +205,7 @@ main();
|
||||
|
||||
|
||||
sub main {
|
||||
# Default, verbosity on
|
||||
report_option('verbose', 0);
|
||||
|
||||
# This is needed for test log evaluation in "gen-build-status-page"
|
||||
@ -215,49 +213,14 @@ sub main {
|
||||
# directly before it executes them, like "make test-force-pl" in RPM builds.
|
||||
mtr_report("Logging: $0 ", join(" ", @ARGV));
|
||||
|
||||
my $opt_parallel= $ENV{MTR_PARALLEL};
|
||||
Getopt::Long::Configure("pass_through");
|
||||
GetOptions('parallel=i' => \$opt_parallel) or usage(0, "Can't read options");
|
||||
|
||||
if ( not defined $opt_parallel ) {
|
||||
# Try to find a suitable value for number of workers
|
||||
my $sys_info= My::SysInfo->new();
|
||||
|
||||
$opt_parallel= $sys_info->num_cpus();
|
||||
for my $limit (2000, 1500, 1000, 500){
|
||||
$opt_parallel-- if ($sys_info->min_bogomips() < $limit);
|
||||
}
|
||||
$opt_parallel= 1 if ($opt_parallel < 1);
|
||||
mtr_report("Using parallel: $opt_parallel");
|
||||
}
|
||||
|
||||
# Create server socket on any free port
|
||||
my $server = new IO::Socket::INET
|
||||
(
|
||||
LocalAddr => 'localhost',
|
||||
Proto => 'tcp',
|
||||
Listen => $opt_parallel,
|
||||
);
|
||||
mtr_error("Could not create testcase server port: $!") unless $server;
|
||||
my $server_port = $server->sockport();
|
||||
mtr_report("Using server port $server_port");
|
||||
|
||||
# Create child processes
|
||||
my %children;
|
||||
for my $child_num (1..$opt_parallel){
|
||||
my $child_pid= My::SafeProcess::Base::_safe_fork();
|
||||
if ($child_pid == 0){
|
||||
$server= undef; # Close the server port in child
|
||||
run_worker($server_port, $child_num);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$children{$child_pid}= 1;
|
||||
}
|
||||
|
||||
command_line_setup(0);
|
||||
command_line_setup();
|
||||
|
||||
if ( $opt_gcov ) {
|
||||
gcov_prepare();
|
||||
gcov_prepare($basedir);
|
||||
}
|
||||
|
||||
if (!$opt_suites) {
|
||||
@ -293,7 +256,7 @@ sub main {
|
||||
(
|
||||
name => 'report_features',
|
||||
# No result_file => Prints result
|
||||
path => 'include/report-features.test'.
|
||||
path => 'include/report-features.test',
|
||||
template_path => "include/default_my.cnf",
|
||||
master_opt => [],
|
||||
slave_opt => [],
|
||||
@ -301,13 +264,62 @@ sub main {
|
||||
unshift(@$tests, $tinfo);
|
||||
}
|
||||
|
||||
print "vardir: $opt_vardir\n";
|
||||
initialize_servers();
|
||||
|
||||
#######################################################################
|
||||
my $num_tests= @$tests;
|
||||
if ( not defined $opt_parallel ) {
|
||||
# Try to find a suitable value for number of workers
|
||||
my $sys_info= My::SysInfo->new();
|
||||
|
||||
$opt_parallel= $sys_info->num_cpus();
|
||||
for my $limit (2000, 1500, 1000, 500){
|
||||
$opt_parallel-- if ($sys_info->min_bogomips() < $limit);
|
||||
}
|
||||
$opt_parallel= 8 if ($opt_parallel > 8);
|
||||
$opt_parallel= $num_tests if ($opt_parallel > $num_tests);
|
||||
$opt_parallel= 1 if ($opt_parallel < 1);
|
||||
mtr_report("Using parallel: $opt_parallel");
|
||||
}
|
||||
|
||||
# Create server socket on any free port
|
||||
my $server = new IO::Socket::INET
|
||||
(
|
||||
LocalAddr => 'localhost',
|
||||
Proto => 'tcp',
|
||||
Listen => $opt_parallel,
|
||||
);
|
||||
mtr_error("Could not create testcase server port: $!") unless $server;
|
||||
my $server_port = $server->sockport();
|
||||
mtr_report("Using server port $server_port");
|
||||
|
||||
# Create child processes
|
||||
my %children;
|
||||
for my $child_num (1..$opt_parallel){
|
||||
my $child_pid= My::SafeProcess::Base::_safe_fork();
|
||||
if ($child_pid == 0){
|
||||
$server= undef; # Close the server port in child
|
||||
$tests= {}; # Don't need the tests list in child
|
||||
|
||||
# Use subdir of var and tmp unless only one worker
|
||||
if ($opt_parallel > 1) {
|
||||
set_vardir("$opt_vardir/$child_num");
|
||||
$opt_tmpdir= "$opt_tmpdir/$child_num";
|
||||
}
|
||||
|
||||
run_worker($server_port, $child_num);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$children{$child_pid}= 1;
|
||||
}
|
||||
#######################################################################
|
||||
|
||||
mtr_report();
|
||||
mtr_print_thick_line();
|
||||
mtr_print_header();
|
||||
|
||||
my $num_tests= @$tests;
|
||||
my $completed= run_test_server($server, $tests, $opt_parallel);
|
||||
|
||||
# Send Ctrl-C to any children still running
|
||||
@ -334,7 +346,7 @@ sub main {
|
||||
if ($opt_force){
|
||||
# All test should have been run, print any that are still in $tests
|
||||
foreach my $test ( @$tests ){
|
||||
$test->print_test();
|
||||
$test->print_test();
|
||||
}
|
||||
}
|
||||
|
||||
@ -346,13 +358,18 @@ sub main {
|
||||
|
||||
mtr_print_line();
|
||||
|
||||
if ( $opt_gcov ) {
|
||||
gcov_collect($basedir, $opt_gcov,
|
||||
$opt_gcov_msg, $opt_gcov_err);
|
||||
}
|
||||
|
||||
mtr_report_stats($completed);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
sub run_test_server {
|
||||
sub run_test_server ($$$) {
|
||||
my ($server, $tests, $childs) = @_;
|
||||
|
||||
my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far.
|
||||
@ -360,7 +377,7 @@ sub run_test_server {
|
||||
my $num_failed_test= 0; # Number of tests failed so far
|
||||
|
||||
# Scheduler variables
|
||||
my $max_ndb= $opt_parallel / 2;
|
||||
my $max_ndb= $childs / 2;
|
||||
$max_ndb = 4 if $max_ndb > 4;
|
||||
$max_ndb = 1 if $max_ndb < 1;
|
||||
my $num_ndb_tests= 0;
|
||||
@ -429,15 +446,16 @@ sub run_test_server {
|
||||
my $core_name= basename($core_file);
|
||||
|
||||
if ($core_name =~ "core*"){
|
||||
mtr_report(" - found '$core_name'",
|
||||
"($num_saved_cores/$opt_max_save_core)");
|
||||
|
||||
My::CoreDump->show($core_file);
|
||||
|
||||
if ($num_saved_cores >= $opt_max_save_core) {
|
||||
mtr_report(" - deleting '$core_name'",
|
||||
"($num_saved_cores/$opt_max_save_core)");
|
||||
mtr_report(" - deleting it, already saved",
|
||||
"$opt_max_save_core");
|
||||
unlink("$core_file");
|
||||
}
|
||||
else {
|
||||
mtr_report(" - found '$core_name'",
|
||||
"($num_saved_cores/$opt_max_save_core)");
|
||||
}
|
||||
++$num_saved_cores;
|
||||
}
|
||||
}
|
||||
@ -519,15 +537,20 @@ sub run_test_server {
|
||||
|
||||
my $next;
|
||||
my $second_best;
|
||||
for(my $i= 0; $i <= $#$tests; $i++)
|
||||
for(my $i= 0; $i <= @$tests; $i++)
|
||||
{
|
||||
my $t= $tests->[$i];
|
||||
|
||||
last unless defined $t;
|
||||
|
||||
if (run_testcase_check_skip_test($t)){
|
||||
# Move the test to completed list
|
||||
#mtr_report("skip - Moving test $i to completed");
|
||||
push(@$completed, splice(@$tests, $i, 1));
|
||||
redo; # Start over again
|
||||
|
||||
# Since the test at pos $i was taken away, next
|
||||
# test will also be at $i -> redo
|
||||
redo;
|
||||
}
|
||||
|
||||
# Limit number of parallell NDB tests
|
||||
@ -557,7 +580,7 @@ sub run_test_server {
|
||||
# Use second best choice if no other test has been found
|
||||
if (!$next and defined $second_best){
|
||||
#mtr_report("Take second best choice $second_best");
|
||||
mtr_error("Internal error, second best too large")
|
||||
mtr_error("Internal error, second best too large($second_best)")
|
||||
if $second_best > $#$tests;
|
||||
$next= splice(@$tests, $second_best, 1);
|
||||
}
|
||||
@ -593,8 +616,6 @@ sub run_worker ($) {
|
||||
|
||||
$SIG{INT}= sub { exit(1); };
|
||||
|
||||
report_option('name',"worker[$thread_num]");
|
||||
|
||||
# Connect to server
|
||||
my $server = new IO::Socket::INET
|
||||
(
|
||||
@ -605,20 +626,34 @@ sub run_worker ($) {
|
||||
mtr_error("Could not connect to server at port $server_port: $!")
|
||||
unless $server;
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Set worker name
|
||||
# --------------------------------------------------------------------------
|
||||
report_option('name',"worker[$thread_num]");
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Use auto build thread in all but first worker
|
||||
# --------------------------------------------------------------------------
|
||||
set_build_thread_ports($thread_num > 1 ? 'auto' : $opt_build_thread);
|
||||
|
||||
if (check_ports_free()){
|
||||
# Some port was not free(which one has already been printed)
|
||||
mtr_error("Some port(s) was not free")
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Turn off verbosity in workers, unless explicitly specified
|
||||
# --------------------------------------------------------------------------
|
||||
report_option('verbose', undef) if ($opt_verbose == 0);
|
||||
|
||||
environment_setup();
|
||||
|
||||
# Read hello from server which it will send when shared
|
||||
# resources have been setup
|
||||
my $hello= <$server>;
|
||||
|
||||
command_line_setup($thread_num);
|
||||
|
||||
if ( $opt_gcov )
|
||||
{
|
||||
gcov_prepare();
|
||||
}
|
||||
|
||||
setup_vardir();
|
||||
check_running_as_root();
|
||||
mysql_install_db($thread_num);
|
||||
|
||||
if ( using_extern() ) {
|
||||
create_config_file_for_extern(%opts_extern);
|
||||
@ -649,16 +684,6 @@ sub run_worker ($) {
|
||||
|
||||
stop_all_servers();
|
||||
|
||||
if ( $opt_gcov )
|
||||
{
|
||||
gcov_collect(); # collect coverage information
|
||||
}
|
||||
|
||||
if ( $opt_gcov )
|
||||
{
|
||||
gcov_collect(); # collect coverage information
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -668,15 +693,30 @@ sub ignore_option {
|
||||
mtr_report("Ignoring option '$opt'");
|
||||
}
|
||||
|
||||
sub command_line_setup {
|
||||
my ($thread_num)= @_;
|
||||
|
||||
|
||||
# Setup any paths that are $opt_vardir related
|
||||
sub set_vardir {
|
||||
my ($vardir)= @_;
|
||||
|
||||
$opt_vardir= $vardir;
|
||||
|
||||
$path_vardir_trace= $opt_vardir;
|
||||
# Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
|
||||
$path_vardir_trace=~ s/^\w://;
|
||||
|
||||
# Location of my.cnf that all clients use
|
||||
$path_config_file= "$opt_vardir/my.cnf";
|
||||
|
||||
$path_testlog= "$opt_vardir/log/mysqltest.log";
|
||||
$path_current_testlog= "$opt_vardir/log/current_test";
|
||||
|
||||
}
|
||||
|
||||
sub command_line_setup {
|
||||
my $opt_comment;
|
||||
my $opt_usage;
|
||||
|
||||
# Default verbosity, server ON and workers OFF
|
||||
report_option('verbose', $thread_num ? undef : 0);
|
||||
|
||||
# Read the command line options
|
||||
# Note: Keep list, and the order, in sync with usage at end of this file
|
||||
Getopt::Long::Configure("pass_through");
|
||||
@ -797,9 +837,9 @@ sub command_line_setup {
|
||||
'timediff' => \&report_option,
|
||||
|
||||
'help|h' => \$opt_usage,
|
||||
) or usage($thread_num, "Can't read options");
|
||||
) or usage("Can't read options");
|
||||
|
||||
usage($thread_num, "") if $opt_usage;
|
||||
usage("") if $opt_usage;
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Setup verbosity
|
||||
@ -808,12 +848,6 @@ sub command_line_setup {
|
||||
report_option('verbose', $opt_verbose);
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Check build_thread and calculate baseport
|
||||
# Use auto build thread in all but first worker
|
||||
# --------------------------------------------------------------------------
|
||||
set_build_thread_ports($thread_num > 1 ? 'auto' : $opt_build_thread);
|
||||
|
||||
if ( -d "../sql" )
|
||||
{
|
||||
$source_dist= 1;
|
||||
@ -862,24 +896,21 @@ sub command_line_setup {
|
||||
"$basedir/sql/share",
|
||||
"$basedir/share");
|
||||
|
||||
|
||||
$path_language= mtr_path_exists("$path_share/english");
|
||||
$path_charsetsdir= mtr_path_exists("$path_share/charsets");
|
||||
|
||||
# Look for SQL scripts directory
|
||||
if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "")
|
||||
if (using_extern())
|
||||
{
|
||||
# The SQL scripts are in path_share
|
||||
$path_sql_dir= $path_share;
|
||||
# Connect to the running mysqld and find out what it supports
|
||||
collect_mysqld_features_from_running_server();
|
||||
}
|
||||
else
|
||||
{
|
||||
$path_sql_dir= mtr_path_exists("$basedir/share",
|
||||
"$basedir/scripts");
|
||||
# Run the mysqld to find out what features are available
|
||||
collect_mysqld_features();
|
||||
}
|
||||
|
||||
# Run the mysqld to find out what features are available
|
||||
collect_mysqld_features();
|
||||
|
||||
if ( $opt_comment )
|
||||
{
|
||||
mtr_report();
|
||||
@ -902,7 +933,7 @@ sub command_line_setup {
|
||||
}
|
||||
elsif ( $arg =~ /^-/ )
|
||||
{
|
||||
usage($thread_num, "Invalid option \"$arg\"");
|
||||
usage("Invalid option \"$arg\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -939,9 +970,8 @@ sub command_line_setup {
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Check if we should speed up tests by trying to run on tmpfs
|
||||
# - Dont check in workers
|
||||
# --------------------------------------------------------------------------
|
||||
if ( defined $opt_mem and $thread_num == 0)
|
||||
if ( defined $opt_mem)
|
||||
{
|
||||
mtr_error("Can't use --mem and --vardir at the same time ")
|
||||
if $opt_vardir;
|
||||
@ -965,7 +995,7 @@ sub command_line_setup {
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Set the "var/" directory, as it is the base for everything else
|
||||
# Set the "var/" directory, the base for everything else
|
||||
# --------------------------------------------------------------------------
|
||||
$default_vardir= "$glob_mysql_test_dir/var";
|
||||
if ( ! $opt_vardir )
|
||||
@ -973,15 +1003,6 @@ sub command_line_setup {
|
||||
$opt_vardir= $default_vardir;
|
||||
}
|
||||
|
||||
# If more than one parallel run, use a subdir of the selected var
|
||||
if ($thread_num && $opt_parallel > 1) {
|
||||
$opt_vardir.= "/".$thread_num;
|
||||
}
|
||||
|
||||
$path_vardir_trace= $opt_vardir;
|
||||
# Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
|
||||
$path_vardir_trace=~ s/^\w://;
|
||||
|
||||
# We make the path absolute, as the server will do a chdir() before usage
|
||||
unless ( $opt_vardir =~ m,^/, or
|
||||
(IS_WINDOWS and $opt_vardir =~ m,^[a-z]:/,i) )
|
||||
@ -990,20 +1011,27 @@ sub command_line_setup {
|
||||
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
|
||||
}
|
||||
|
||||
# Location of my.cnf that all clients use
|
||||
$path_config_file= "$opt_vardir/my.cnf";
|
||||
set_vardir($opt_vardir);
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Set tmpdir
|
||||
# Set the "tmp" directory
|
||||
# --------------------------------------------------------------------------
|
||||
$opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir;
|
||||
if ( ! $opt_tmpdir )
|
||||
{
|
||||
$opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir;
|
||||
|
||||
if (check_socket_path_length("$opt_tmpdir/testsocket.sock"))
|
||||
{
|
||||
mtr_report("Too long tmpdir path '$opt_tmpdir'",
|
||||
" creating a shorter one...");
|
||||
|
||||
# Create temporary directory in standard location for temporary files
|
||||
$opt_tmpdir= tempdir( TMPDIR => 1, CLEANUP => 1 );
|
||||
mtr_report(" - using tmpdir: '$opt_tmpdir'\n");
|
||||
}
|
||||
}
|
||||
$opt_tmpdir =~ s,/+$,,; # Remove ending slash if any
|
||||
|
||||
# If more than one parallel run, use a subdir of the selected tmpdir
|
||||
if ($thread_num && $opt_parallel > 1 and $opt_tmpdir ne "$opt_vardir/tmp") {
|
||||
$opt_tmpdir.= "/".$thread_num;
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# fast option
|
||||
# --------------------------------------------------------------------------
|
||||
@ -1109,11 +1137,6 @@ sub command_line_setup {
|
||||
}
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Set timeout values
|
||||
# --------------------------------------------------------------------------
|
||||
$opt_start_timeout*= $opt_parallel;
|
||||
|
||||
#
|
||||
# Check valgrind arguments
|
||||
# --------------------------------------------------------------------------
|
||||
@ -1162,14 +1185,6 @@ sub command_line_setup {
|
||||
join(" ", @valgrind_args), "\"");
|
||||
}
|
||||
|
||||
if ( ! $opt_user )
|
||||
{
|
||||
$opt_user= "root"; # We want to do FLUSH xxx commands
|
||||
}
|
||||
|
||||
$path_testlog= "$opt_vardir/log/mysqltest.log";
|
||||
$path_current_testlog= "$opt_vardir/log/current_test";
|
||||
|
||||
mtr_report("Checking supported features...");
|
||||
|
||||
check_ndbcluster_support(\%mysqld_variables);
|
||||
@ -1178,8 +1193,6 @@ sub command_line_setup {
|
||||
|
||||
executable_setup();
|
||||
|
||||
environment_setup();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1202,12 +1215,12 @@ sub set_build_thread_ports($) {
|
||||
my $build_thread= shift || 0;
|
||||
|
||||
if ( lc($build_thread) eq 'auto' ) {
|
||||
mtr_report("Requesting build thread... ");
|
||||
#mtr_report("Requesting build thread... ");
|
||||
$build_thread= mtr_get_unique_id(250, 299);
|
||||
if ( !defined $build_thread ) {
|
||||
mtr_error("Could not get a unique build thread id");
|
||||
}
|
||||
mtr_report(" - got $build_thread");
|
||||
#mtr_report(" - got $build_thread");
|
||||
}
|
||||
$ENV{MTR_BUILD_THREAD}= $build_thread;
|
||||
$opt_build_thread= $build_thread;
|
||||
@ -1319,6 +1332,50 @@ sub collect_mysqld_features {
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub collect_mysqld_features_from_running_server ()
|
||||
{
|
||||
my $mysql= mtr_exe_exists("$path_client_bindir/mysql");
|
||||
|
||||
my $args;
|
||||
mtr_init_args(\$args);
|
||||
|
||||
mtr_add_arg($args, "--no-defaults");
|
||||
mtr_add_arg($args, "--user=%s", $opt_user);
|
||||
|
||||
while (my ($option, $value)= each( %opts_extern )) {
|
||||
mtr_add_arg($args, "--$option=$value");
|
||||
}
|
||||
|
||||
mtr_add_arg($args, "--silent"); # Tab separated output
|
||||
mtr_add_arg($args, "-e '%s'", "use mysql; SHOW VARIABLES");
|
||||
my $cmd= "$mysql " . join(' ', @$args);
|
||||
mtr_verbose("cmd: $cmd");
|
||||
|
||||
my $list = `$cmd` or
|
||||
mtr_error("Could not connect to extern server using command: '$cmd'");
|
||||
foreach my $line (split('\n', $list ))
|
||||
{
|
||||
# Put variables into hash
|
||||
if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
|
||||
{
|
||||
# print "$1=\"$2\"\n";
|
||||
$mysqld_variables{$1}= $2;
|
||||
}
|
||||
}
|
||||
|
||||
# Parse version
|
||||
my $version_str= $mysqld_variables{'version'};
|
||||
if ( $version_str =~ /^([0-9]*)\.([0-9]*)\.([0-9]*)/ )
|
||||
{
|
||||
#print "Major: $1 Minor: $2 Build: $3\n";
|
||||
$mysql_version_id= $1*10000 + $2*100 + $3;
|
||||
#print "mysql_version_id: $mysql_version_id\n";
|
||||
mtr_report("MySQL Version $1.$2.$3");
|
||||
}
|
||||
mtr_error("Could not find version of MySQL") unless $mysql_version_id;
|
||||
}
|
||||
|
||||
sub find_mysqld {
|
||||
my ($mysqld_basedir)= @_;
|
||||
|
||||
@ -1471,8 +1528,9 @@ sub mysql_client_test_arguments(){
|
||||
# mysql_client_test executable may _not_ exist
|
||||
if ( $opt_embedded_server ) {
|
||||
$exe= mtr_exe_maybe_exists(
|
||||
vs_config_dirs('libmysqld/examples','mysql_client_test_embedded'),
|
||||
"$basedir/libmysqld/examples/mysql_client_test_embedded");
|
||||
vs_config_dirs('libmysqld/examples','mysql_client_test_embedded'),
|
||||
"$basedir/libmysqld/examples/mysql_client_test_embedded",
|
||||
"$basedir/bin/mysql_client_test_embedded");
|
||||
} else {
|
||||
$exe= mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'),
|
||||
"$basedir/tests/mysql_client_test",
|
||||
@ -1624,9 +1682,9 @@ sub environment_setup {
|
||||
$ENV{'LC_COLLATE'}= "C";
|
||||
$ENV{'USE_RUNNING_SERVER'}= using_extern();
|
||||
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
|
||||
$ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
|
||||
$ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'} || 3306;
|
||||
$ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir;
|
||||
$ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Setup env for NDB
|
||||
@ -2215,7 +2273,7 @@ sub create_config_file_for_extern {
|
||||
(
|
||||
socket => '/tmp/mysqld.sock',
|
||||
port => 3306,
|
||||
user => 'test',
|
||||
user => $opt_user,
|
||||
password => '',
|
||||
@_
|
||||
);
|
||||
@ -2313,7 +2371,7 @@ sub check_ports_free
|
||||
for ($baseport..$baseport+9){
|
||||
push(@ports_to_check, $_);
|
||||
}
|
||||
mtr_report("Checking ports...");
|
||||
#mtr_report("Checking ports...");
|
||||
# print "@ports_to_check\n";
|
||||
foreach my $port (@ports_to_check){
|
||||
if (mtr_ping_port($port)){
|
||||
@ -2347,17 +2405,12 @@ sub initialize_servers {
|
||||
# using any pidfiles found in var/run
|
||||
kill_leftovers("$opt_vardir/run");
|
||||
|
||||
if (check_ports_free()){
|
||||
# Some port was not free(which one has already been printed)
|
||||
mtr_error("Some port(s) was not free")
|
||||
}
|
||||
|
||||
if ( ! $opt_start_dirty )
|
||||
{
|
||||
remove_stale_vardir();
|
||||
setup_vardir();
|
||||
|
||||
mysql_install_db(0);
|
||||
mysql_install_db(default_mysqld(), "$opt_vardir/install.db");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2412,9 +2465,33 @@ sub sql_to_bootstrap {
|
||||
}
|
||||
|
||||
|
||||
sub default_mysqld {
|
||||
# Generate new config file from template
|
||||
my $config= My::ConfigFactory->new_config
|
||||
( {
|
||||
basedir => $basedir,
|
||||
template_path => "include/default_my.cnf",
|
||||
vardir => $opt_vardir,
|
||||
tmpdir => $opt_tmpdir,
|
||||
baseport => 0,
|
||||
user => $opt_user,
|
||||
password => '',
|
||||
}
|
||||
);
|
||||
|
||||
my $mysqld= $config->group('mysqld.1')
|
||||
or mtr_error("Couldn't find mysqld.1 in default config");
|
||||
return $mysqld;
|
||||
}
|
||||
|
||||
|
||||
sub mysql_install_db {
|
||||
my ($thread_num)= @_;
|
||||
my $data_dir= "$opt_vardir/install.db";
|
||||
my ($mysqld, $datadir)= @_;
|
||||
|
||||
my $install_datadir= $datadir || $mysqld->value('datadir');
|
||||
my $install_basedir= $mysqld->value('basedir');
|
||||
my $install_lang= $mysqld->value('language');
|
||||
my $install_chsdir= $mysqld->value('character-sets-dir');
|
||||
|
||||
mtr_report("Installing system database...");
|
||||
|
||||
@ -2422,8 +2499,8 @@ sub mysql_install_db {
|
||||
mtr_init_args(\$args);
|
||||
mtr_add_arg($args, "--no-defaults");
|
||||
mtr_add_arg($args, "--bootstrap");
|
||||
mtr_add_arg($args, "--basedir=%s", $basedir);
|
||||
mtr_add_arg($args, "--datadir=%s", $data_dir);
|
||||
mtr_add_arg($args, "--basedir=%s", $install_basedir);
|
||||
mtr_add_arg($args, "--datadir=%s", $install_datadir);
|
||||
mtr_add_arg($args, "--loose-skip-innodb");
|
||||
mtr_add_arg($args, "--loose-skip-ndbcluster");
|
||||
mtr_add_arg($args, "--tmpdir=%s", "$opt_vardir/tmp/");
|
||||
@ -2435,47 +2512,60 @@ sub mysql_install_db {
|
||||
$path_vardir_trace);
|
||||
}
|
||||
|
||||
mtr_add_arg($args, "--language=%s", $path_language);
|
||||
mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
|
||||
mtr_add_arg($args, "--language=%s", $install_lang);
|
||||
mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir);
|
||||
|
||||
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
|
||||
# configure --disable-grant-options), mysqld will not recognize the
|
||||
# --bootstrap or --skip-grant-tables options. The user can set
|
||||
# MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept
|
||||
# --bootstrap, to accommodate this.
|
||||
my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || find_mysqld($basedir);
|
||||
my $exe_mysqld_bootstrap =
|
||||
$ENV{'MYSQLD_BOOTSTRAP'} || find_mysqld($install_basedir);
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
|
||||
# ----------------------------------------------------------------------
|
||||
$ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args);
|
||||
|
||||
return if $thread_num > 0; # Only generate MYSQLD_BOOTSTRAP_CMD in workers
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Create the bootstrap.sql file
|
||||
# ----------------------------------------------------------------------
|
||||
my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
|
||||
|
||||
if (-f "$path_sql_dir/mysql_system_tables.sql")
|
||||
my $path_sql= my_find_file($install_basedir,
|
||||
["mysql", "sql/share", "share", "scripts"],
|
||||
"mysql_system_tables.sql",
|
||||
NOT_REQUIRED);
|
||||
|
||||
if (-f $path_sql )
|
||||
{
|
||||
my $sql_dir= dirname($path_sql);
|
||||
# Use the mysql database for system tables
|
||||
mtr_tofile($bootstrap_sql_file, "use mysql\n");
|
||||
|
||||
# Add the offical mysql system tables
|
||||
# for a production system
|
||||
mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql",
|
||||
mtr_appendfile_to_file("$sql_dir/mysql_system_tables.sql",
|
||||
$bootstrap_sql_file);
|
||||
|
||||
# Add the mysql system tables initial data
|
||||
# for a production system
|
||||
mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables_data.sql",
|
||||
mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql",
|
||||
$bootstrap_sql_file);
|
||||
|
||||
# Add test data for timezone - this is just a subset, on a real
|
||||
# system these tables will be populated either by mysql_tzinfo_to_sql
|
||||
# or by downloading the timezone table package from our website
|
||||
mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql",
|
||||
mtr_appendfile_to_file("$sql_dir/mysql_test_data_timezone.sql",
|
||||
$bootstrap_sql_file);
|
||||
|
||||
# Fill help tables, just an empty file when running from bk repo
|
||||
# but will be replaced by a real fill_help_tables.sql when
|
||||
# building the source dist
|
||||
mtr_appendfile_to_file("$sql_dir/fill_help_tables.sql",
|
||||
$bootstrap_sql_file);
|
||||
|
||||
}
|
||||
@ -2483,7 +2573,7 @@ sub mysql_install_db {
|
||||
{
|
||||
# Install db from init_db.sql that exist in early 5.1 and 5.0
|
||||
# versions of MySQL
|
||||
my $init_file= "$basedir/mysql-test/lib/init_db.sql";
|
||||
my $init_file= "$install_basedir/mysql-test/lib/init_db.sql";
|
||||
mtr_report(" - from '$init_file'");
|
||||
my $text= mtr_grab_file($init_file) or
|
||||
mtr_error("Can't open '$init_file': $!");
|
||||
@ -2492,12 +2582,6 @@ sub mysql_install_db {
|
||||
sql_to_bootstrap($text));
|
||||
}
|
||||
|
||||
# Fill help tables, just an empty file when running from bk repo
|
||||
# but will be replaced by a real fill_help_tables.sql when
|
||||
# building the source dist
|
||||
mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql",
|
||||
$bootstrap_sql_file);
|
||||
|
||||
# Remove anonymous users
|
||||
mtr_tofile($bootstrap_sql_file,
|
||||
"DELETE FROM mysql.user where user= '';\n");
|
||||
@ -2520,8 +2604,8 @@ sub mysql_install_db {
|
||||
"$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
|
||||
|
||||
# Create directories mysql and test
|
||||
mkpath("$data_dir/mysql");
|
||||
mkpath("$data_dir/test");
|
||||
mkpath("$install_datadir/mysql");
|
||||
mkpath("$install_datadir/test");
|
||||
|
||||
if ( My::SafeProcess->run
|
||||
(
|
||||
@ -2591,12 +2675,14 @@ sub do_before_run_mysqltest($)
|
||||
my $tinfo= shift;
|
||||
|
||||
# Remove old files produced by mysqltest
|
||||
my $base_file= mtr_match_extension($tinfo->{'result_file'},
|
||||
"result"); # Trim extension
|
||||
unlink("$base_file.reject");
|
||||
unlink("$base_file.progress");
|
||||
unlink("$base_file.log");
|
||||
unlink("$base_file.warnings");
|
||||
my $base_file= mtr_match_extension($tinfo->{result_file},
|
||||
"result"); # Trim extension
|
||||
if (defined $base_file ){
|
||||
unlink("$base_file.reject");
|
||||
unlink("$base_file.progress");
|
||||
unlink("$base_file.log");
|
||||
unlink("$base_file.warnings");
|
||||
}
|
||||
|
||||
if ( $mysql_version_id < 50000 ) {
|
||||
# Set environment variable NDB_STATUS_OK to 1
|
||||
@ -2705,8 +2791,8 @@ sub check_testcase($$)
|
||||
else {
|
||||
# Unknown process returned, most likley a crash, abort everything
|
||||
$tinfo->{comment}=
|
||||
"Unexpected process $proc returned during ".
|
||||
"check testcase $mode test";
|
||||
"The server $proc crashed while running ".
|
||||
"'check testcase $mode test'";
|
||||
$result= 3;
|
||||
}
|
||||
|
||||
@ -2764,7 +2850,6 @@ sub start_run_one ($$) {
|
||||
sub run_on_all($$)
|
||||
{
|
||||
my ($tinfo, $run)= @_;
|
||||
my $tname= $tinfo->{name};
|
||||
|
||||
# Start the mysqltest processes in parallel to save time
|
||||
# also makes it possible to wait for any process to exit during the check
|
||||
@ -2818,8 +2903,7 @@ sub run_on_all($$)
|
||||
else {
|
||||
# Unknown process returned, most likley a crash, abort everything
|
||||
$tinfo->{comment}.=
|
||||
"Unexpected process $proc returned during ".
|
||||
"execution of '$run'";
|
||||
"The server $proc crashed while running '$run'";
|
||||
}
|
||||
|
||||
# Kill any check processes still running
|
||||
@ -3183,7 +3267,6 @@ sub start_check_warnings ($$) {
|
||||
my $mysqld= shift;
|
||||
|
||||
my $name= "warnings-".$mysqld->name();
|
||||
my $tname= $tinfo->{name};
|
||||
|
||||
my $args;
|
||||
mtr_init_args(\$args);
|
||||
@ -3307,8 +3390,7 @@ sub check_warnings ($) {
|
||||
else {
|
||||
# Unknown process returned, most likley a crash, abort everything
|
||||
$tinfo->{comment}=
|
||||
"Unexpected process $proc returned during ".
|
||||
"check warnings";
|
||||
"The server $proc crashed while running 'check warnings'";
|
||||
$result= 3;
|
||||
}
|
||||
|
||||
@ -3686,7 +3768,7 @@ sub mysqld_start ($$) {
|
||||
}
|
||||
elsif ( $opt_manual_debug )
|
||||
{
|
||||
print "\nStart $mysqld->name() in your debugger\n" .
|
||||
print "\nStart " .$mysqld->name()." in your debugger\n" .
|
||||
"dir: $glob_mysql_test_dir\n" .
|
||||
"exe: $exe\n" .
|
||||
"args: " . join(" ", @$args) . "\n\n" .
|
||||
@ -4017,39 +4099,36 @@ sub start_servers($) {
|
||||
}
|
||||
|
||||
my $datadir= $mysqld->value('datadir');
|
||||
|
||||
# Don't delete anything if starting dirty
|
||||
if (!$opt_start_dirty)
|
||||
{
|
||||
my @options= ('log-bin', 'relay-log');
|
||||
# Don't delete anything if starting dirty
|
||||
|
||||
foreach my $option_name ( @options ) {
|
||||
next unless $mysqld->option($option_name);
|
||||
|
||||
my $value= $mysqld->value($option_name);
|
||||
|
||||
foreach my $file ( glob("$datadir/$value*") )
|
||||
{
|
||||
#print "removing: $file\n";
|
||||
mtr_debug("Removing '$file'");
|
||||
unlink($file);
|
||||
}
|
||||
if (-d $datadir ) {
|
||||
mtr_verbose(" - removing '$datadir'");
|
||||
rmtree($datadir);
|
||||
}
|
||||
|
||||
# Remove old master.info and relay-log.info files
|
||||
# from the servers datadir
|
||||
unlink("$datadir/master.info");
|
||||
unlink("$datadir/relay-log.info");
|
||||
}
|
||||
|
||||
# Copy datadir from installed system db
|
||||
for my $path ( "$opt_vardir", "$opt_vardir/..") {
|
||||
my $install_db= "$path/install.db";
|
||||
copytree($install_db, $datadir)
|
||||
if -d $install_db;
|
||||
my $mysqld_basedir= $mysqld->value('basedir');
|
||||
if ( $basedir eq $mysqld_basedir )
|
||||
{
|
||||
# Copy datadir from installed system db
|
||||
for my $path ( "$opt_vardir", "$opt_vardir/..") {
|
||||
my $install_db= "$path/install.db";
|
||||
copytree($install_db, $datadir)
|
||||
if -d $install_db;
|
||||
}
|
||||
mtr_error("Failed to copy system db to '$datadir'")
|
||||
unless -d $datadir;
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_install_db($mysqld);
|
||||
|
||||
mtr_error("Failed to install system db to '$datadir'")
|
||||
unless -d $datadir;
|
||||
|
||||
}
|
||||
mtr_error("Failed to copy system db to '$datadir'")
|
||||
unless -d $datadir;
|
||||
|
||||
# Create the servers tmpdir
|
||||
my $tmpdir= $mysqld->value('tmpdir');
|
||||
@ -4137,7 +4216,9 @@ sub start_check_testcase ($$$) {
|
||||
my $mysqld= shift;
|
||||
|
||||
my $name= "check-".$mysqld->name();
|
||||
my $tname= $tinfo->{name};
|
||||
# Replace dots in name with underscore to avoid that mysqltest
|
||||
# misinterpret's what the filename extension is :(
|
||||
$name=~ s/\./_/g;
|
||||
|
||||
my $args;
|
||||
mtr_init_args(\$args);
|
||||
@ -4261,6 +4342,12 @@ sub start_mysqltest ($) {
|
||||
my $extra_opts= get_extra_opts($mysqld, $tinfo);
|
||||
mysqld_arguments($mysqld_args, $mysqld, $extra_opts);
|
||||
mtr_add_arg($args, "--server-arg=%s", $_) for @$mysqld_args;
|
||||
|
||||
if (IS_WINDOWS)
|
||||
{
|
||||
# Trick the server to send output to stderr, with --console
|
||||
mtr_add_arg($args, "--server-arg=--console");
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
@ -4296,6 +4383,7 @@ sub start_mysqltest ($) {
|
||||
if ( $opt_record )
|
||||
{
|
||||
mtr_add_arg($args, "--record");
|
||||
mtr_add_arg($args, "--result-file=%s", $tinfo->{record_file});
|
||||
}
|
||||
|
||||
if ( $opt_client_gdb )
|
||||
@ -4544,10 +4632,7 @@ sub valgrind_arguments {
|
||||
# Usage
|
||||
#
|
||||
sub usage ($) {
|
||||
my ($thread_num, $message)= @_;
|
||||
|
||||
# Only main thread should print usage
|
||||
return if $thread_num != 0;
|
||||
my ($message)= @_;
|
||||
|
||||
if ( $message )
|
||||
{
|
||||
@ -4613,8 +4698,7 @@ Options to control what test suites or cases to run
|
||||
list of suite names.
|
||||
The default is: "$DEFAULT_SUITES"
|
||||
skip-rpl Skip the replication test cases.
|
||||
big-test Set the environment variable BIG_TEST, which can be
|
||||
checked from test cases.
|
||||
big-test Also run tests marked as "big"
|
||||
|
||||
Options that specify ports
|
||||
|
||||
@ -4641,9 +4725,6 @@ Options to run test on running server
|
||||
For example:
|
||||
./$0 --extern socket=/tmp/mysqld.sock
|
||||
|
||||
user=USER User for connection to extern server
|
||||
socket=PATH Socket for connection to extern server
|
||||
|
||||
Options for debugging the product
|
||||
|
||||
client-ddd Start mysqltest client in ddd
|
||||
@ -4690,7 +4771,7 @@ Options for valgrind
|
||||
callgrind Instruct valgrind to use callgrind
|
||||
|
||||
Misc options
|
||||
|
||||
user=USER User for connecting to mysqld(default: $opt_user)
|
||||
comment=STR Write STR to the output
|
||||
notimer Don't show test case execution time
|
||||
verbose More verbose output(use multiple times for even more)
|
||||
|
@ -1,4 +1,5 @@
|
||||
'#---------------------BS_STVARS_002_01----------------------#'
|
||||
SET @start_value= @@global.binlog_format;
|
||||
SELECT COUNT(@@GLOBAL.binlog_format);
|
||||
COUNT(@@GLOBAL.binlog_format)
|
||||
1
|
||||
@ -9,19 +10,13 @@ COUNT(@@SESSION.binlog_format)
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_002_02----------------------#'
|
||||
SET @@GLOBAL.binlog_format=1;
|
||||
Expected error 'Read only variable'
|
||||
Bug: Writeable static variable
|
||||
SELECT COUNT(@@GLOBAL.binlog_format);
|
||||
COUNT(@@GLOBAL.binlog_format)
|
||||
1
|
||||
1 Expected
|
||||
SELECT @@GLOBAL.binlog_format;
|
||||
@@GLOBAL.binlog_format
|
||||
STATEMENT
|
||||
SET @@SESSION.binlog_format=1;
|
||||
Expected error 'Read only variable'
|
||||
Bug: Writeable static variable
|
||||
SELECT COUNT(@@SESSION.binlog_format);
|
||||
COUNT(@@SESSION.binlog_format)
|
||||
1
|
||||
1 Expected
|
||||
SELECT @@SESSION.binlog_format;
|
||||
@@SESSION.binlog_format
|
||||
STATEMENT
|
||||
'#---------------------BS_STVARS_002_03----------------------#'
|
||||
SELECT @@GLOBAL.binlog_format = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
@ -34,14 +29,14 @@ COUNT(@@GLOBAL.binlog_format)
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(VARIABLE_VALUE)
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='binlog_format';
|
||||
COUNT(VARIABLE_VALUE)
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_002_04----------------------#'
|
||||
SELECT @@SESSION.binlog_format = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
SELECT @@SESSION.binlog_format = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
WHERE VARIABLE_NAME='binlog_format';
|
||||
@@SESSION.binlog_format = VARIABLE_VALUE
|
||||
1
|
||||
@ -51,7 +46,7 @@ COUNT(@@SESSION.binlog_format)
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(VARIABLE_VALUE)
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
WHERE VARIABLE_NAME='binlog_format';
|
||||
COUNT(VARIABLE_VALUE)
|
||||
1
|
||||
@ -73,3 +68,4 @@ SELECT COUNT(@@GLOBAL.binlog_format);
|
||||
COUNT(@@GLOBAL.binlog_format)
|
||||
1
|
||||
1 Expected
|
||||
SET @@global.binlog_format= @start_value;
|
||||
|
2
mysql-test/r/case_insensitive_file_system.require
Normal file
2
mysql-test/r/case_insensitive_file_system.require
Normal file
@ -0,0 +1,2 @@
|
||||
Variable_name Value
|
||||
lower_case_file_system ON
|
@ -15,7 +15,7 @@ utf8
|
||||
'#--------------------FN_DYNVARS_011_02-------------------------#'
|
||||
'connection default'
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(b CHAR(40) character set utf8);
|
||||
CREATE TABLE t1(b CHAR(40) CHARACTER SET utf8);
|
||||
'--verify that character_set_connection converts character_set_client--'
|
||||
SET @@session.character_set_client = utf8;
|
||||
SET @@session.character_set_results = utf8;
|
||||
@ -53,3 +53,4 @@ SET @@global.character_set_connection = @global_character_set_connection;
|
||||
SET @@session.character_set_connection = @session_character_set_connection;
|
||||
SET @@session.character_set_client = @session_character_set_client;
|
||||
SET @@session.character_set_results = @session_character_set_results;
|
||||
DROP TABLE t1;
|
||||
|
@ -1,67 +1,67 @@
|
||||
drop table if exists t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
## Creating new table ##
|
||||
CREATE TABLE t1
|
||||
(
|
||||
id INT NOT NULL auto_increment,
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (id),
|
||||
name varchar(30)
|
||||
name VARCHAR(30)
|
||||
) ENGINE = INNODB;
|
||||
'#--------------------FN_DYNVARS_017_01-------------------------#'
|
||||
## Creating new connection ##
|
||||
INSERT into t1(name) values('Record_1');
|
||||
INSERT INTO t1(name) VALUES('Record_1');
|
||||
SET @@autocommit = 0;
|
||||
SELECT * from t1;
|
||||
SELECT * FROM t1;
|
||||
id name
|
||||
1 Record_1
|
||||
## Setting value of variable to 0 ##
|
||||
SET @@session.completion_type = 0;
|
||||
## Here commit & rollback should work normally ##
|
||||
START TRANSACTION;
|
||||
SELECT * from t1;
|
||||
SELECT * FROM t1;
|
||||
id name
|
||||
1 Record_1
|
||||
INSERT into t1(name) values('Record_2');
|
||||
INSERT into t1(name) values('Record_3');
|
||||
SELECT * from t1;
|
||||
INSERT INTO t1(name) VALUES('Record_2');
|
||||
INSERT INTO t1(name) VALUES('Record_3');
|
||||
SELECT * FROM t1;
|
||||
id name
|
||||
1 Record_1
|
||||
2 Record_2
|
||||
3 Record_3
|
||||
DELETE FROM t1 where id = 2;
|
||||
SELECT * from t1;
|
||||
DELETE FROM t1 WHERE id = 2;
|
||||
SELECT * FROM t1;
|
||||
id name
|
||||
1 Record_1
|
||||
3 Record_3
|
||||
START TRANSACTION;
|
||||
SELECT * from t1;
|
||||
SELECT * FROM t1;
|
||||
id name
|
||||
1 Record_1
|
||||
3 Record_3
|
||||
INSERT into t1(name) values('Record_4');
|
||||
INSERT into t1(name) values('Record_5');
|
||||
INSERT INTO t1(name) VALUES('Record_4');
|
||||
INSERT INTO t1(name) VALUES('Record_5');
|
||||
COMMIT;
|
||||
'#--------------------FN_DYNVARS_017_02-------------------------#'
|
||||
SET @@session.completion_type = 2;
|
||||
## Here commit should work as COMMIT RELEASE ##
|
||||
START TRANSACTION;
|
||||
SELECT * from t1;
|
||||
SELECT * FROM t1;
|
||||
id name
|
||||
1 Record_1
|
||||
3 Record_3
|
||||
4 Record_4
|
||||
5 Record_5
|
||||
INSERT into t1(name) values('Record_6');
|
||||
INSERT into t1(name) values('Record_7');
|
||||
INSERT INTO t1(name) VALUES('Record_6');
|
||||
INSERT INTO t1(name) VALUES('Record_7');
|
||||
COMMIT;
|
||||
## Inserting rows should give error here because connection should ##
|
||||
## disconnect after using COMMIT ##
|
||||
INSERT into t1(name) values('Record_4');
|
||||
INSERT INTO t1(name) VALUES('Record_4');
|
||||
Got one of the listed errors
|
||||
## Creating new connection test_con2 ##
|
||||
SET @@session.completion_type = 2;
|
||||
## Inserting rows and using Rollback which should Rollback & release ##
|
||||
START TRANSACTION;
|
||||
SELECT * from t1;
|
||||
SELECT * FROM t1;
|
||||
id name
|
||||
1 Record_1
|
||||
3 Record_3
|
||||
@ -69,8 +69,9 @@ id name
|
||||
5 Record_5
|
||||
6 Record_6
|
||||
7 Record_7
|
||||
INSERT into t1(name) values('Record_8');
|
||||
INSERT into t1(name) values('Record_9');
|
||||
INSERT INTO t1(name) VALUES('Record_8');
|
||||
INSERT INTO t1(name) VALUES('Record_9');
|
||||
ROLLBACK;
|
||||
INSERT into t1(name) values('Record_4');
|
||||
INSERT INTO t1(name) VALUES('Record_4');
|
||||
Got one of the listed errors
|
||||
DROP TABLE t1;
|
||||
|
803
mysql-test/r/concurrent_innodb_safelog.result
Normal file
803
mysql-test/r/concurrent_innodb_safelog.result
Normal file
@ -0,0 +1,803 @@
|
||||
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
SELECT @@global.innodb_locks_unsafe_for_binlog;
|
||||
@@global.innodb_locks_unsafe_for_binlog
|
||||
0
|
||||
# keep_locks == 1
|
||||
GRANT USAGE ON test.* TO mysqltest@localhost;
|
||||
DO release_lock("hello");
|
||||
DO release_lock("hello2");
|
||||
drop table if exists t1;
|
||||
|
||||
**
|
||||
** two UPDATE's running and both changing distinct result sets
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get user level lock (ULL) for thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction for thread 2
|
||||
begin;
|
||||
** Update will cause a table scan and a new ULL will
|
||||
** be created and blocked on the first row where tipo=11.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
|
||||
** connection thread1
|
||||
** Start new transaction for thread 1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set eta=2 where tipo=22;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** Release user level name lock from thread 1. This will cause the ULL
|
||||
** on thread 2 to end its wait.
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Table is now updated with a new eta on tipo=22 for thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from update on thread 2
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Table should have eta updates where tipo=11 but updates made by
|
||||
** thread 1 shouldn't be visible yet.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Sending commit on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Make sure table reads didn't change yet on thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** And send final commit on thread 1.
|
||||
commit;
|
||||
** Table should now be updated by both updates in the order of
|
||||
** thread 1,2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Make sure the output is similar for t1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two UPDATE's running and one changing result set
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get ULL "hello" on thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction on thread 2
|
||||
begin;
|
||||
** Update will cause a table scan.
|
||||
** This will cause a hang on the first row where tipo=1 until the
|
||||
** blocking ULL is released.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
** connection thread1
|
||||
** Start transaction on thread 1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** Release ULL. This will release the next waiting ULL on thread 2.
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** The table should still be updated with updates for thread 1 only:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from thread 2:
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Seen from thread 2 the table should have been updated on four
|
||||
** places.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
** Thread 2 has committed but the result should remain the same for
|
||||
** thread 1 (updated on three places):
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** After a commit the table should be merged with the previous
|
||||
** commit.
|
||||
** This select should show both updates:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** One UPDATE and one INSERT .... Monty's test
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
** Create ULL 'hello2'
|
||||
select get_lock("hello2",10);
|
||||
get_lock("hello2",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
** Update will create a table scan which creates a ULL where a=2;
|
||||
** this will hang waiting on thread 1.
|
||||
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
|
||||
** connection thread1
|
||||
** Insert new values to t1 from thread 1; this created an implicit
|
||||
** commit since there are no on-going transactions.
|
||||
insert into t1 values (1,1);
|
||||
** Release the ULL (thread 2 updates will finish).
|
||||
select release_lock("hello2");
|
||||
release_lock("hello2")
|
||||
1
|
||||
** ..but thread 1 will still see t1 as if nothing has happend:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
** connection thread2
|
||||
** Collect results from thread 2 and release the lock.
|
||||
select release_lock("hello2");
|
||||
release_lock("hello2")
|
||||
1
|
||||
** The table should look like the original+updates for thread 2,
|
||||
** and consist of new rows:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
2 10
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
** Commit changes from thread 2
|
||||
commit;
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
** Select a range for update.
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
** Update the same range which is marked for update on thread 2; this
|
||||
** will hang because of row locks.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** After the update the table will be unmodified because the previous
|
||||
** transaction failed and was rolled back.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** The table should look unmodified from thread 2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Sending a commit should release the row locks and enable
|
||||
** thread 1 to complete the transaction.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** The table should not have been changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Even on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Starting new transaction on thread 2.
|
||||
begin;
|
||||
** Starting SELECT .. FOR UPDATE
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
|
||||
** Starting new transaction on thread 1
|
||||
begin;
|
||||
** Updating single row using a table scan. This will time out
|
||||
** because of ongoing transaction on thread 1 holding lock on
|
||||
** all primary keys in the scan.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** After the time out the transaction is aborted; no rows should
|
||||
** have changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** The same thing should hold true for the transaction on
|
||||
** thread 2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
** Even after committing:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
** Selecting a range for update by table scan will be blocked
|
||||
** because of on-going transaction on thread 2.
|
||||
select * from t1 where tipo=1 FOR UPDATE;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** connection thread2
|
||||
** Table will be unchanged and the select command will not be
|
||||
** blocked:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Commit transacton on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit transaction on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** Make sure table isn't blocked on thread 2:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Make sure table isn't blocked on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
@ -1,109 +1,22 @@
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
SELECT @@global.tx_isolation;
|
||||
@@global.tx_isolation
|
||||
REPEATABLE-READ
|
||||
SELECT @@global.innodb_locks_unsafe_for_binlog;
|
||||
@@global.innodb_locks_unsafe_for_binlog
|
||||
1
|
||||
# keep_locks == 0
|
||||
GRANT USAGE ON test.* TO mysqltest@localhost;
|
||||
DO release_lock("hello");
|
||||
DO release_lock("hello2");
|
||||
drop table if exists t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
|
||||
**
|
||||
** two UPDATE's running and both changing distinct result sets
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",1);
|
||||
get_lock("hello",1)
|
||||
1
|
||||
begin;
|
||||
update t1 set eta=1+get_lock("hello",1)*0 where tipo=11;
|
||||
begin;
|
||||
update t1 set eta=2 where tipo=22;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
drop table t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
@ -116,16 +29,173 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get user level lock (ULL) for thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
0
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction for thread 2
|
||||
begin;
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
** Update will cause a table scan and a new ULL will
|
||||
** be created and blocked on the first row where tipo=11.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
|
||||
** connection thread1
|
||||
** Start new transaction for thread 1
|
||||
begin;
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set eta=2 where tipo=22;
|
||||
** Release user level name lock from thread 1. This will cause the ULL
|
||||
** on thread 2 to end its wait.
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
0
|
||||
1
|
||||
** Table is now updated with a new eta on tipo=22 for thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from update on thread 2
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Table should have eta updates where tipo=11 but updates made by
|
||||
** thread 1 shouldn't be visible yet.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** Sending commit on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Make sure table reads didn't change yet on thread 1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** And send final commit on thread 1.
|
||||
commit;
|
||||
** Table should now be updated by both updates in the order of
|
||||
** thread 1,2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Make sure the output is similar for t1.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two UPDATE's running and one changing result set
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** Get ULL "hello" on thread 1
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Start transaction on thread 2
|
||||
begin;
|
||||
** Update will cause a table scan.
|
||||
** This will cause a hang on the first row where tipo=1 until the
|
||||
** blocking ULL is released.
|
||||
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
|
||||
** connection thread1
|
||||
** Start transaction on thread 1
|
||||
begin;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
** Release ULL. This will release the next waiting ULL on thread 2.
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** The table should still be updated with updates for thread 1 only:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -139,6 +209,13 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** Release the lock and collect result from thread 2:
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Seen from thread 2 the table should have been updated on four
|
||||
** places.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -152,7 +229,10 @@ eta tipo c
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
commit;
|
||||
** connection thread1
|
||||
** Thread 2 has committed but the result should remain the same for
|
||||
** thread 1 (updated on three places):
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -167,19 +247,9 @@ eta tipo c
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 1 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 1 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** After a commit the table should be merged with the previous
|
||||
** commit.
|
||||
** This select should show both updates:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -193,6 +263,7 @@ eta tipo c
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -206,19 +277,50 @@ eta tipo c
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
1 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 1 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
1 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 1 fffffffffffffffffffffffffffffffffffffffffff
|
||||
1 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 1 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** One UPDATE and one INSERT .... Monty's test
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1 (a int not null, b int not null);
|
||||
insert into t1 values (1,1),(2,1),(3,1),(4,1);
|
||||
select get_lock("hello2",1000);
|
||||
get_lock("hello2",1000)
|
||||
** Create ULL 'hello2'
|
||||
select get_lock("hello2",10);
|
||||
get_lock("hello2",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
update t1 set b=10+get_lock(concat("hello",a),1000)*0 where
|
||||
a=2;
|
||||
** Update will create a table scan which creates a ULL where a=2;
|
||||
** this will hang waiting on thread 1.
|
||||
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
|
||||
** connection thread1
|
||||
** Insert new values to t1 from thread 1; this created an implicit
|
||||
** commit since there are no on-going transactions.
|
||||
insert into t1 values (1,1);
|
||||
** Release the ULL (thread 2 updates will finish).
|
||||
select release_lock("hello2");
|
||||
release_lock("hello2")
|
||||
1
|
||||
** ..but thread 1 will still see t1 as if nothing has happend:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
@ -226,6 +328,13 @@ a b
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
** connection thread2
|
||||
** Collect results from thread 2 and release the lock.
|
||||
select release_lock("hello2");
|
||||
release_lock("hello2")
|
||||
1
|
||||
** The table should look like the original+updates for thread 2,
|
||||
** and consist of new rows:
|
||||
select * from t1;
|
||||
a b
|
||||
1 1
|
||||
@ -233,90 +342,17 @@ a b
|
||||
3 1
|
||||
4 1
|
||||
1 1
|
||||
commit;
|
||||
drop table t1;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** Commit changes from thread 2
|
||||
commit;
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
@ -329,17 +365,24 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
** Select a range for update.
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
update t1 set tipo=11+get_lock("hello",10)*0 where tipo=22;
|
||||
** Update the same range which is marked for update on thread 2; this
|
||||
** will hang because of row locks.
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
** After the update the table will be unmodified because the previous
|
||||
** transaction failed and was rolled back.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -353,10 +396,8 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread2
|
||||
** The table should look unmodified from thread 2.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -370,8 +411,14 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** Sending a commit should release the row locks and enable
|
||||
** thread 1 to complete the transaction.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** The table should not have been changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -385,6 +432,8 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Even on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -398,7 +447,15 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
@ -411,21 +468,127 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
** Starting new transaction on thread 2.
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
** Starting SELECT .. FOR UPDATE
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
|
||||
** Starting new transaction on thread 1
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
** Updating single row using a table scan. This will time out
|
||||
** because of ongoing transaction on thread 1 holding lock on
|
||||
** all primary keys in the scan.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=11 where tipo=22;
|
||||
** After the time out the transaction is aborted; no rows should
|
||||
** have changed.
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
** The same thing should hold true for the transaction on
|
||||
** thread 2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
** Even after committing:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
8 8 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
10 1 ccccccccccccccccccccccccccccccccccccccccccc
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
30 1 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
50 1 ggggggggggggggggggggggggggggggggggggggggggg
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** two SELECT ... FOR UPDATE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
insert into t1 values (10,1,"ccccccccccccccccccccccccccccccccccccccccccc");
|
||||
insert into t1 values (20,2,"ddddddddddddddddddddddddddddddddddddddddddd");
|
||||
insert into t1 values (30,1,"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
insert into t1 values (40,2,"fffffffffffffffffffffffffffffffffffffffffff");
|
||||
insert into t1 values (50,1,"ggggggggggggggggggggggggggggggggggggggggggg");
|
||||
insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
** connection thread2
|
||||
** Begin a new transaction on thread 2
|
||||
begin;
|
||||
select * from t1 where tipo=2 FOR UPDATE;
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread1
|
||||
** Begin a new transaction on thread 1
|
||||
begin;
|
||||
** Selecting a range for update by table scan will be blocked
|
||||
** because of on-going transaction on thread 2.
|
||||
select * from t1 where tipo=1 FOR UPDATE;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
eta tipo c
|
||||
20 2 ddddddddddddddddddddddddddddddddddddddddddd
|
||||
40 2 fffffffffffffffffffffffffffffffffffffffffff
|
||||
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
|
||||
** connection thread2
|
||||
** Table will be unchanged and the select command will not be
|
||||
** blocked:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -439,8 +602,13 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
** Commit transacton on thread 2.
|
||||
commit;
|
||||
** connection thread1
|
||||
** Commit transaction on thread 1.
|
||||
commit;
|
||||
** connection thread2
|
||||
** Make sure table isn't blocked on thread 2:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -454,6 +622,8 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
** Make sure table isn't blocked on thread 1:
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -467,7 +637,15 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
@ -480,16 +658,12 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=2;
|
||||
update t1 set tipo=1 where tipo=2;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
@ -504,6 +678,7 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -514,8 +689,10 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -526,6 +703,7 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -536,7 +714,15 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
||||
|
||||
**
|
||||
** one UPDATE not changing result set and DELETE
|
||||
**
|
||||
** connection thread1
|
||||
** Set up table
|
||||
SET SESSION STORAGE_ENGINE = InnoDB;
|
||||
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
|
||||
insert into t1 values (7,7, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
insert into t1 values (8,8, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb");
|
||||
@ -549,16 +735,17 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
|
||||
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
|
||||
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
select get_lock("hello",10);
|
||||
get_lock("hello",10)
|
||||
1
|
||||
** connection thread2
|
||||
begin;
|
||||
delete from t1 where tipo=2;
|
||||
delete from t1 where tipo=2;
|
||||
** connection thread1
|
||||
begin;
|
||||
select release_lock("hello");
|
||||
release_lock("hello")
|
||||
1
|
||||
update t1 set tipo=1+get_lock("hello",10)*0 where tipo=22;
|
||||
** Update on t1 will cause a table scan which will be blocked because
|
||||
** the previously initiated table scan applied exclusive key locks on
|
||||
** all primary keys.
|
||||
** Not so if innodb_locks_unsafe_for_binlog is set. The locks that
|
||||
** do not match the WHERE condition are released.
|
||||
update t1 set tipo=1 where tipo=22;
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -572,6 +759,7 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -582,8 +770,10 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
commit;
|
||||
commit;
|
||||
** connection thread1
|
||||
commit;
|
||||
** connection thread2
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -594,6 +784,7 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection thread1
|
||||
select * from t1;
|
||||
eta tipo c
|
||||
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
@ -604,4 +795,5 @@ eta tipo c
|
||||
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
|
||||
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
|
||||
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
|
||||
** connection default
|
||||
drop table t1;
|
@ -1,73 +1,121 @@
|
||||
drop table if exists t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
## Creating new table ##
|
||||
CREATE TABLE t1
|
||||
(
|
||||
name varchar(30)
|
||||
name VARCHAR(30)
|
||||
);
|
||||
'#--------------------FN_DYNVARS_018_01-------------------------#'
|
||||
SET @start_value= @@global.concurrent_insert;
|
||||
## Setting initial value of variable to 1 ##
|
||||
SET @@global.concurrent_insert = 1;
|
||||
INSERT into t1(name) values('Record_1');
|
||||
INSERT into t1(name) values('Record_2');
|
||||
INSERT into t1(name) values('Record_3');
|
||||
INSERT INTO t1(name) VALUES('Record_1');
|
||||
INSERT INTO t1(name) VALUES('Record_2');
|
||||
INSERT INTO t1(name) VALUES('Record_3');
|
||||
## locking table ##
|
||||
lock table t1 read local;
|
||||
## Creating new connection to insert some rows in table ##
|
||||
LOCK TABLE t1 READ LOCAL;
|
||||
## Creating new connection to insert some rows in table ##
|
||||
connection test_con1;
|
||||
## New records should come at the end of all rows ##
|
||||
INSERT into t1(name) values('Record_4');
|
||||
SELECT * from t1;
|
||||
INSERT INTO t1(name) VALUES('Record_4');
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_2
|
||||
Record_3
|
||||
Record_4
|
||||
## unlocking tables ##
|
||||
unlock tables;
|
||||
## deleting record to create hole in table ##
|
||||
DELETE from t1 where name ='Record_2';
|
||||
connection default;
|
||||
UNLOCK TABLES;
|
||||
## deleting record to create hole in table ##
|
||||
DELETE FROM t1 WHERE name ='Record_2';
|
||||
'#--------------------FN_DYNVARS_018_02-------------------------#'
|
||||
'#--------------------FN_DYNVARS_018_03-------------------------#'
|
||||
## lock table and connect with connection1 ##
|
||||
lock table t1 read local;
|
||||
## setting value of concurrent_insert to 2 ##
|
||||
SET @@global.concurrent_insert=2;
|
||||
## Inserting record in table, record should go at the end of the table ##
|
||||
INSERT into t1(name) values('Record_5');
|
||||
SELECT * from t1;
|
||||
LOCK TABLE t1 READ LOCAL;
|
||||
connection test_con1;
|
||||
SET @@global.concurrent_insert=1;
|
||||
## send INSERT which should be blocked until unlock of the table ##
|
||||
INSERT INTO t1(name) VALUES('Record_7');
|
||||
connection default;
|
||||
## show processlist info and state ##
|
||||
SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE state= "Locked" AND info LIKE "INSERT INTO t1%";
|
||||
state info
|
||||
Locked INSERT INTO t1(name) VALUES('Record_7')
|
||||
## table contents befor UNLOCK ##
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_3
|
||||
Record_4
|
||||
UNLOCK TABLES;
|
||||
## table contens after UNLOCK ##
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_7
|
||||
Record_3
|
||||
Record_4
|
||||
INSERT INTO t1(name) VALUES('Record_6');
|
||||
connection test_con1;
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_7
|
||||
Record_3
|
||||
Record_4
|
||||
Record_6
|
||||
connection default;
|
||||
'#--------------------FN_DYNVARS_018_03-------------------------#'
|
||||
## lock table and connect with connection1 ##
|
||||
LOCK TABLE t1 READ LOCAL;
|
||||
connection test_con1;
|
||||
## setting value of concurrent_insert to 2 ##
|
||||
SET @@global.concurrent_insert=2;
|
||||
## Inserting record in table, record should go at the end of the table ##
|
||||
INSERT INTO t1(name) VALUES('Record_5');
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_7
|
||||
Record_3
|
||||
Record_4
|
||||
Record_6
|
||||
Record_5
|
||||
SELECT @@concurrent_insert;
|
||||
@@concurrent_insert
|
||||
2
|
||||
## Switching to default connection ##
|
||||
connection default;
|
||||
## Unlocking table ##
|
||||
unlock tables;
|
||||
SELECT * from t1;
|
||||
UNLOCK TABLES;
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_7
|
||||
Record_3
|
||||
Record_4
|
||||
Record_6
|
||||
Record_5
|
||||
## Inserting new row, this should go in the hole ##
|
||||
INSERT into t1(name) values('Record_6');
|
||||
SELECT * from t1;
|
||||
INSERT INTO t1(name) VALUES('Record_6');
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_6
|
||||
Record_7
|
||||
Record_3
|
||||
Record_4
|
||||
Record_6
|
||||
Record_5
|
||||
Record_6
|
||||
## connection test_con1 ##
|
||||
DELETE from t1 where name ='Record_3';
|
||||
SELECT * from t1;
|
||||
DELETE FROM t1 WHERE name ='Record_3';
|
||||
SELECT * FROM t1;
|
||||
name
|
||||
Record_1
|
||||
Record_6
|
||||
Record_7
|
||||
Record_4
|
||||
Record_6
|
||||
Record_5
|
||||
Record_6
|
||||
## Dropping table ##
|
||||
DROP table t1;
|
||||
DROP TABLE t1;
|
||||
## Disconnecting connection ##
|
||||
SET @@global.concurrent_insert= @start_value;
|
||||
|
@ -5388,4 +5388,10 @@ select * from t1;
|
||||
c1
|
||||
That
|
||||
drop table t1;
|
||||
create table t1 (a int not null) engine=csv;
|
||||
lock tables t1 read;
|
||||
select * from t1;
|
||||
ERROR HY000: File 'MYSQLD_DATADIR/test/t1.CSV' not found (Errcode: 2)
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
@ -1,4 +1,5 @@
|
||||
'#--------------------FN_DYNVARS_023_01-------------------------#'
|
||||
SET @start_value= @@global.delay_key_write;
|
||||
SET @@global.delay_key_write = ON;
|
||||
SELECT @@global.delay_key_write;
|
||||
@@global.delay_key_write
|
||||
@ -28,8 +29,8 @@ Key_writes 9
|
||||
SHOW STATUS LIKE 'Key_write_requests';
|
||||
Variable_name Value
|
||||
Key_write_requests 9
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
9
|
||||
'----check when delay_key_write is ON---'
|
||||
SET @@global.delay_key_write = ON;
|
||||
@ -44,8 +45,8 @@ Key_writes 0
|
||||
SHOW STATUS LIKE 'Key_write_requests';
|
||||
Variable_name Value
|
||||
Key_write_requests 9
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
9
|
||||
'----check when delay_key_write is ALL---'
|
||||
SET @@global.delay_key_write = ALL;
|
||||
@ -60,8 +61,9 @@ Key_writes 0
|
||||
SHOW STATUS LIKE 'Key_write_requests';
|
||||
Variable_name Value
|
||||
Key_write_requests 9
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
9
|
||||
DROP PROCEDURE sp_addRecords;
|
||||
DROP TABLE t1;
|
||||
SET @@global.delay_key_write= @start_value;
|
||||
|
@ -115,3 +115,21 @@ SELECT 1 REGEXP NULL;
|
||||
1 REGEXP NULL
|
||||
NULL
|
||||
End of 5.0 tests
|
||||
CREATE TABLE t1(a INT, b CHAR(4));
|
||||
INSERT INTO t1 VALUES (1, '6.1'), (1, '7.0'), (1, '8.0');
|
||||
PREPARE stmt1 FROM "SELECT a FROM t1 WHERE a=1 AND '7.0' REGEXP b LIMIT 1";
|
||||
EXECUTE stmt1;
|
||||
a
|
||||
1
|
||||
EXECUTE stmt1;
|
||||
a
|
||||
1
|
||||
EXECUTE stmt1;
|
||||
a
|
||||
1
|
||||
EXECUTE stmt1;
|
||||
a
|
||||
1
|
||||
DEALLOCATE PREPARE stmt1;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -17,3 +17,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='general_log_file';
|
||||
@@global.general_log_file = VARIABLE_VALUE
|
||||
1
|
||||
SET @@global.general_log_file= @start_value;
|
||||
|
@ -1,8 +1,8 @@
|
||||
drop table if exists t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
## Creating new table ##
|
||||
CREATE TABLE t1
|
||||
(
|
||||
id INT NOT NULL auto_increment,
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (id),
|
||||
name VARCHAR(30)
|
||||
);
|
||||
@ -10,10 +10,10 @@ name VARCHAR(30)
|
||||
SELECT @@general_log_file;
|
||||
@@general_log_file
|
||||
mysql-test.log
|
||||
INSERT into t1(name) values('Record_1');
|
||||
INSERT into t1(name) values('Record_2');
|
||||
INSERT into t1(name) values('Record_3');
|
||||
INSERT into t1(name) values('Record_4');
|
||||
INSERT INTO t1(name) VALUES('Record_1');
|
||||
INSERT INTO t1(name) VALUES('Record_2');
|
||||
INSERT INTO t1(name) VALUES('Record_3');
|
||||
INSERT INTO t1(name) VALUES('Record_4');
|
||||
## Verifying general log file ##
|
||||
## Dropping table ##
|
||||
DROP TABLE t1;
|
||||
|
@ -2372,3 +2372,79 @@ a MIN(b) MAX(b) AVG(b)
|
||||
2 1 3 2.0000
|
||||
1 1 3 2.0000
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int, b int, primary key (a,b), key `index` (a,b)) engine=MyISAM;
|
||||
insert into t1 (a,b) values
|
||||
(0,0),(0,1),(0,2),(0,3),(0,4),(0,5),(0,6),
|
||||
(0,7),(0,8),(0,9),(0,10),(0,11),(0,12),(0,13),
|
||||
(1,0),(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),
|
||||
(1,7),(1,8),(1,9),(1,10),(1,11),(1,12),(1,13),
|
||||
(2,0),(2,1),(2,2),(2,3),(2,4),(2,5),(2,6),
|
||||
(2,7),(2,8),(2,9),(2,10),(2,11),(2,12),(2,13),
|
||||
(3,0),(3,1),(3,2),(3,3),(3,4),(3,5),(3,6),
|
||||
(3,7),(3,8),(3,9),(3,10),(3,11),(3,12),(3,13);
|
||||
insert into t1 (a,b) select a, max(b)+1 from t1 where a = 0 group by a;
|
||||
select * from t1;
|
||||
a b
|
||||
0 0
|
||||
0 1
|
||||
0 2
|
||||
0 3
|
||||
0 4
|
||||
0 5
|
||||
0 6
|
||||
0 7
|
||||
0 8
|
||||
0 9
|
||||
0 10
|
||||
0 11
|
||||
0 12
|
||||
0 13
|
||||
0 14
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
1 4
|
||||
1 5
|
||||
1 6
|
||||
1 7
|
||||
1 8
|
||||
1 9
|
||||
1 10
|
||||
1 11
|
||||
1 12
|
||||
1 13
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
2 3
|
||||
2 4
|
||||
2 5
|
||||
2 6
|
||||
2 7
|
||||
2 8
|
||||
2 9
|
||||
2 10
|
||||
2 11
|
||||
2 12
|
||||
2 13
|
||||
3 0
|
||||
3 1
|
||||
3 2
|
||||
3 3
|
||||
3 4
|
||||
3 5
|
||||
3 6
|
||||
3 7
|
||||
3 8
|
||||
3 9
|
||||
3 10
|
||||
3 11
|
||||
3 12
|
||||
3 13
|
||||
explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 range PRIMARY,index PRIMARY 4 NULL 3 100.00 Using where; Using index for group-by; Using temporary
|
||||
Warnings:
|
||||
Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,(max(`test`.`t1`.`b`) + 1) AS `max(b)+1` from `test`.`t1` where (`test`.`t1`.`a` = 0) group by `test`.`t1`.`a`
|
||||
drop table t1;
|
||||
|
@ -484,6 +484,7 @@ c1
|
||||
handler t1 close;
|
||||
read the result from the other connection
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
proceed with the normal connection
|
||||
drop table t1;
|
||||
@ -698,6 +699,7 @@ handler a2 read a first;
|
||||
a
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
handler a1 close;
|
||||
ERROR 42S02: Unknown table 'a1' in HANDLER
|
||||
|
@ -3,4 +3,5 @@ create table t1(a int not null auto_increment primary key) engine=innodb;
|
||||
insert into t1 set a = -1;
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
|
171
mysql-test/r/innodb-autoinc.result
Normal file
171
mysql-test/r/innodb-autoinc.result
Normal file
@ -0,0 +1,171 @@
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (9223372036854775807, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
9223372036854775807 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (127, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
127 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (255, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
255 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (32767, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
32767 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (65535, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
65535 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (8388607, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
8388607 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (16777215, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
16777215 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (2147483647, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
2147483647 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (4294967295, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
4294967295 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (9223372036854775807, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
9223372036854775807 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (18446744073709551615, null);
|
||||
INSERT INTO t1 (c2) VALUES ('innodb');
|
||||
Got one of the listed errors
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
18446744073709551615 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
c1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
TRUNCATE TABLE t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
c1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
c1
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
DELETE FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (1), (2), (3);
|
||||
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
||||
SELECT c1 FROM t1;
|
||||
c1
|
||||
1
|
||||
2
|
||||
3
|
||||
7
|
||||
8
|
||||
9
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
@ -166,6 +166,7 @@ level id parent_id
|
||||
1 1007 101
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
@ -190,6 +191,7 @@ create table t1 (a int) engine=innodb;
|
||||
insert into t1 values (1), (2);
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
delete from t1 where a = 1;
|
||||
select * from t1;
|
||||
@ -738,6 +740,7 @@ world 2
|
||||
hello 1
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
@ -3109,6 +3112,7 @@ BEGIN;
|
||||
INSERT INTO t1 VALUES (1);
|
||||
OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB;
|
||||
@ -3263,3 +3267,14 @@ AUTO_INCREMENT
|
||||
200
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (c1 int default NULL,
|
||||
c2 int default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
TRUNCATE TABLE t1;
|
||||
affected rows: 0
|
||||
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
|
||||
affected rows: 5
|
||||
info: Records: 5 Duplicates: 0 Warnings: 0
|
||||
TRUNCATE TABLE t1;
|
||||
affected rows: 0
|
||||
DROP TABLE t1;
|
||||
|
@ -1,7 +1,4 @@
|
||||
SET @global_start_value = @@global.innodb_autoextend_increment ;
|
||||
SELECT @global_start_value;
|
||||
@global_start_value
|
||||
8
|
||||
'#--------------------FN_DYNVARS_046_01------------------------#'
|
||||
SET @@global.innodb_autoextend_increment = 0;
|
||||
Warnings:
|
||||
@ -57,16 +54,16 @@ SELECT @@global.innodb_autoextend_increment;
|
||||
@@global.innodb_autoextend_increment
|
||||
1000
|
||||
'#----------------------FN_DYNVARS_046_05------------------------#'
|
||||
SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='innodb_autoextend_increment ';
|
||||
@@global.innodb_autoextend_increment = VARIABLE_VALUE
|
||||
1
|
||||
SELECT @@global.innodb_autoextend_increment ;
|
||||
@@global.innodb_autoextend_increment
|
||||
1000
|
||||
SELECT VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
SELECT VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='innodb_autoextend_increment ';
|
||||
VARIABLE_VALUE
|
||||
1000
|
||||
@ -92,3 +89,4 @@ Warning 1292 Truncated incorrect autoextend_increment value: '0'
|
||||
SELECT @@global.innodb_autoextend_increment ;
|
||||
@@global.innodb_autoextend_increment
|
||||
1
|
||||
SET @@global.innodb_autoextend_increment = @global_start_value;
|
||||
|
@ -9,14 +9,15 @@ DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(
|
||||
a INT AUTO_INCREMENT PRIMARY KEY,
|
||||
b CHAR
|
||||
)ENGINE=INNODB, AUTO_INCREMENT=100;
|
||||
) ENGINE=INNODB, AUTO_INCREMENT=100;
|
||||
INSERT INTO t1 (a,b) VALUES (5,'a'), (NULL,'b'), (1,'c'), (NULL,'d');
|
||||
INSERT INTO t1 (a,b) VALUES (NULL,'e');
|
||||
'the new auto incremented value should be 104'
|
||||
SELECT * from t1;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 c
|
||||
5 a
|
||||
100 b
|
||||
101 d
|
||||
104 e
|
||||
DROP TABLE t1;
|
||||
|
4
mysql-test/r/innodb_bug34300.result
Normal file
4
mysql-test/r/innodb_bug34300.result
Normal file
@ -0,0 +1,4 @@
|
||||
f4 f8
|
||||
xxx zzz
|
||||
f4 f8
|
||||
xxx zzz
|
@ -93,14 +93,14 @@ ERROR HY000: Variable 'innodb_fast_shutdown' is a GLOBAL variable and should be
|
||||
SET @@local.innodb_fast_shutdown = 0;
|
||||
ERROR HY000: Variable 'innodb_fast_shutdown' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
'#----------------------FN_DYNVARS_042_06------------------------#'
|
||||
SELECT count(VARIABLE_VALUE) AS res_is_0
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
SELECT count(VARIABLE_VALUE) AS res_is_0
|
||||
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||
WHERE VARIABLE_NAME='innodb_fast_shutdown';
|
||||
res_is_0
|
||||
1
|
||||
'#----------------------FN_DYNVARS_042_07------------------------#'
|
||||
SELECT @@global.innodb_fast_shutdown =
|
||||
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='innodb_fast_shutdown';
|
||||
@@global.innodb_fast_shutdown =
|
||||
VARIABLE_VALUE
|
||||
@ -125,3 +125,7 @@ SET @@global.innodb_fast_shutdown = FALSE;
|
||||
SELECT @@global.innodb_fast_shutdown;
|
||||
@@global.innodb_fast_shutdown
|
||||
0
|
||||
SET @@global.innodb_fast_shutdown = @global_start_value;
|
||||
SELECT @@global.innodb_fast_shutdown;
|
||||
@@global.innodb_fast_shutdown
|
||||
1
|
||||
|
@ -1,14 +1,12 @@
|
||||
SET @start_value= @@global.innodb_max_dirty_pages_pct;
|
||||
'#--------------------FN_DYNVARS_044_02-------------------------#'
|
||||
SET @old_innodb_max_dirty_pages_pct= @@global.innodb_max_dirty_pages_pct;
|
||||
SET @@global.innodb_max_dirty_pages_pct = 80;
|
||||
'connect (con1,localhost,root,,,,)'
|
||||
'connection con1'
|
||||
SELECT @@global.innodb_max_dirty_pages_pct;
|
||||
@@global.innodb_max_dirty_pages_pct
|
||||
80
|
||||
SET @@global.innodb_max_dirty_pages_pct = 70;
|
||||
'connect (con2,localhost,root,,,,)'
|
||||
'connection con2'
|
||||
SELECT @@global.innodb_max_dirty_pages_pct;
|
||||
@@global.innodb_max_dirty_pages_pct
|
||||
70
|
||||
@ -20,7 +18,6 @@ FLUSH STATUS;
|
||||
CALL add_until(10);
|
||||
FLUSH TABLES;
|
||||
CALL add_records(500);
|
||||
'--sleep 5'
|
||||
'We expect dirty pages pct to be BELOW_MAX'
|
||||
CALL check_pct(10);
|
||||
PCT_VALUE
|
||||
@ -30,4 +27,4 @@ DROP PROCEDURE add_until;
|
||||
DROP PROCEDURE check_pct;
|
||||
DROP FUNCTION dirty_pct;
|
||||
DROP TABLE t1;
|
||||
SET @@global.innodb_max_dirty_pages_pct = @old_innodb_max_dirty_pages_pct;
|
||||
SET @@global.innodb_max_dirty_pages_pct= @start_value;
|
||||
|
@ -577,6 +577,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
OPTIMIZE TABLE t2;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t2 optimize status OK
|
||||
EXPLAIN SELECT COUNT(*) FROM t2 WHERE stat_id IN (1,3) AND acct_id=785;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
|
@ -1,4 +1,8 @@
|
||||
'#--------------------FN_DYNVARS_048_01-------------------------#'
|
||||
SET @start_value= @@global.innodb_table_locks;
|
||||
SELECT @start_value;
|
||||
@start_value
|
||||
1
|
||||
SET @@global.innodb_table_locks = OFF;
|
||||
'connect (con1,localhost,root,,,,)'
|
||||
'connection con1'
|
||||
@ -30,3 +34,7 @@ COMMIT;
|
||||
'CONNECTION con2'
|
||||
UNLOCK tables;
|
||||
DROP TABLE t1;
|
||||
SET @@global.innodb_table_locks= @start_value;
|
||||
SELECT @@global.innodb_table_locks;
|
||||
@@global.innodb_table_locks
|
||||
1
|
||||
|
@ -393,6 +393,7 @@ id c1 cnt
|
||||
1 0 3
|
||||
2 2 1
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
create table t1(f1 int primary key,
|
||||
f2 timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP);
|
||||
insert into t1(f1) values(1);
|
||||
|
@ -750,8 +750,8 @@ ERROR 42S22: Unknown column 't1.b' in 'on clause'
|
||||
select * from information_schema.statistics join information_schema.columns
|
||||
using(table_name,column_name) where table_name='user';
|
||||
TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
|
||||
user Host NULL mysql 0 mysql PRIMARY 1 A NULL NULL NULL BTREE NULL mysql 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI #
|
||||
user User NULL mysql 0 mysql PRIMARY 2 A 3 NULL NULL BTREE NULL mysql 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI #
|
||||
user Host NULL mysql 0 mysql PRIMARY 1 A # NULL NULL BTREE NULL mysql 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI #
|
||||
user User NULL mysql 0 mysql PRIMARY 2 A # NULL NULL BTREE NULL mysql 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI #
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
|
@ -1,12 +1,13 @@
|
||||
drop table if exists t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
## Creating new table t1 ##
|
||||
CREATE TABLE t1
|
||||
(
|
||||
id INT NOT NULL auto_increment,
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (id),
|
||||
rollno int NOT NULL,
|
||||
rollno INT NOT NULL,
|
||||
name VARCHAR(30)
|
||||
);
|
||||
SET @start_value= @@global.key_buffer_size;
|
||||
FLUSH STATUS;
|
||||
'#--------------------FN_DYNVARS_055_01-------------------------#'
|
||||
## Setting initial value of variable to 131072 ##
|
||||
@ -18,19 +19,43 @@ SELECT @@global.key_buffer_size;
|
||||
@@global.key_buffer_size
|
||||
131072
|
||||
## Inserting some rows in table ##
|
||||
INSERT into t1(rollno, name) values(1, 'Record_1');
|
||||
INSERT into t1(rollno, name) values(2, 'Record_2');
|
||||
INSERT into t1(rollno, name) values(1, 'Record_3');
|
||||
INSERT into t1(rollno, name) values(3, 'Record_4');
|
||||
INSERT into t1(rollno, name) values(1, 'Record_5');
|
||||
INSERT into t1(rollno, name) values(3, 'Record_6');
|
||||
INSERT into t1(rollno, name) values(4, 'Record_7');
|
||||
INSERT into t1(rollno, name) values(4, 'Record_8');
|
||||
INSERT into t1(rollno, name) values(4, 'Record_9');
|
||||
INSERT into t1(rollno, name) values(4, 'Record_10');
|
||||
## Verifying status of reading & writing variables ##
|
||||
INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
|
||||
INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
|
||||
INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
|
||||
INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
|
||||
INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
|
||||
INSERT INTO t1(rollno, name) VALUES(3, 'Record_6');
|
||||
INSERT INTO t1(rollno, name) VALUES(4, 'Record_7');
|
||||
INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
|
||||
INSERT INTO t1(rollno, name) VALUES(4, 'Record_9');
|
||||
INSERT INTO t1(rollno, name) VALUES(4, 'Record_10');
|
||||
## Key_reads must be zero (no disk access) ##
|
||||
show status like 'Key_reads';
|
||||
Variable_name Value
|
||||
Key_reads 0
|
||||
## Switching to connection test_con2 ##
|
||||
## Verifying status of reading & writing variables ##
|
||||
## Key_reads must be zero (no disk access) ##
|
||||
show status like 'Key_reads';
|
||||
Variable_name Value
|
||||
Key_reads 0
|
||||
SET @@global.key_buffer_size = 36;
|
||||
## Connecting with connection test_con1 ##
|
||||
## Inserting some rows in table ##
|
||||
INSERT INTO t1(rollno, name) VALUES(5, 'Record_11');
|
||||
INSERT INTO t1(rollno, name) VALUES(6, 'Record_12');
|
||||
INSERT INTO t1(rollno, name) VALUES(5, 'Record_13');
|
||||
INSERT INTO t1(rollno, name) VALUES(7, 'Record_14');
|
||||
INSERT INTO t1(rollno, name) VALUES(5, 'Record_15');
|
||||
INSERT INTO t1(rollno, name) VALUES(7, 'Record_16');
|
||||
INSERT INTO t1(rollno, name) VALUES(8, 'Record_17');
|
||||
INSERT INTO t1(rollno, name) VALUES(8, 'Record_18');
|
||||
INSERT INTO t1(rollno, name) VALUES(8, 'Record_19');
|
||||
INSERT INTO t1(rollno, name) VALUES(8, 'Record_20');
|
||||
## Key_reads must be zero (no disk access) ##
|
||||
show status like 'Key_reads';
|
||||
Variable_name Value
|
||||
Key_reads 10
|
||||
## Dropping table ##
|
||||
DROP table if exists t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
## Disconnecting both the connections ##
|
||||
SET @@global.key_buffer_size= @start_value;
|
||||
|
@ -1,4 +1,5 @@
|
||||
'#--------------------FN_DYNVARS_062_01------------------#'
|
||||
SET @start_log= @@global.log;
|
||||
SELECT @@global.log AS INIT_VALUE;
|
||||
INIT_VALUE
|
||||
1
|
||||
@ -10,8 +11,9 @@ SET global log = 0;
|
||||
'Bug# 34832: log is a system but it is not accessible using SET @@global.log;'
|
||||
'SET GLOBAL log; and SELECT @@global.log. SHOW VARIABLES shows the value of log.'
|
||||
'#--------------------FN_DYNVARS_062_02-------------------------#'
|
||||
SELECT VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
SELECT VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='log';
|
||||
VARIABLE_VALUE
|
||||
OFF
|
||||
SET @@global.log= @start_log;
|
||||
|
@ -1,12 +1,12 @@
|
||||
drop table if exists t1;
|
||||
'#--------------------FN_DYNVARS_063_01-------------------------#'
|
||||
SET @start_value= @@global.log_bin_trust_function_creators;
|
||||
## Creating new user tt ##
|
||||
CREATE user tt@localhost;
|
||||
CREATE USER tt@localhost;
|
||||
## Setting value of variable to 0 ##
|
||||
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
|
||||
SET @@global.log_bin_trust_function_creators = 0;
|
||||
## Creating new table t2 ##
|
||||
create table t2 (a INT);
|
||||
CREATE TABLE t2 (a INT);
|
||||
## Creating & connecting with new connection test_con1 ##
|
||||
SELECT @@log_bin_trust_function_creators;
|
||||
@@log_bin_trust_function_creators
|
||||
@ -17,7 +17,7 @@ SELECT @@sql_log_bin;
|
||||
## Creating new function f1 ##
|
||||
CREATE FUNCTION f1(a INT) RETURNS INT
|
||||
BEGIN
|
||||
IF (a < 3) THEN
|
||||
IF (a < 3) THEN
|
||||
INSERT INTO t2 VALUES (a);
|
||||
END IF;
|
||||
RETURN 1;
|
||||
@ -34,8 +34,8 @@ f1(a)
|
||||
1
|
||||
1
|
||||
## Dropping function f1 & table t1 ##
|
||||
drop function f1;
|
||||
drop table t1;
|
||||
DROP FUNCTION f1;
|
||||
DROP TABLE t1;
|
||||
'#--------------------FN_DYNVARS_063_02-------------------------#'
|
||||
## Switching to default connection ##
|
||||
## Setting value of variable to 1 ##
|
||||
@ -51,7 +51,7 @@ SELECT @@sql_log_bin;
|
||||
## Creating new function f1 ##
|
||||
CREATE FUNCTION f1(a INT) RETURNS INT
|
||||
BEGIN
|
||||
IF (a < 3) THEN
|
||||
IF (a < 3) THEN
|
||||
INSERT INTO t2 VALUES (a);
|
||||
END IF;
|
||||
RETURN 1;
|
||||
@ -66,9 +66,9 @@ f1(a)
|
||||
1
|
||||
1
|
||||
## Dropping function f1 ##
|
||||
drop function f1;
|
||||
DROP FUNCTION f1;
|
||||
## Dropping table t1 & t2 ##
|
||||
drop table t1,t2;
|
||||
## Disconnecting both the connections ##
|
||||
DROP TABLE t1,t2;
|
||||
## Disconnecting test_con2##
|
||||
DROP USER tt@localhost;
|
||||
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
|
||||
SET @@global.log_bin_trust_function_creators= @start_value;
|
||||
|
@ -1,53 +1,104 @@
|
||||
'#---------------------BS_STVARS_041_01----------------------#'
|
||||
SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
|
||||
COUNT(@@GLOBAL.log_queries_not_using_indexes)
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_041_02----------------------#'
|
||||
SET @@GLOBAL.log_queries_not_using_indexes=1;
|
||||
Expected error 'Read only variable'
|
||||
"BUG:It should give error on setting this variable as it is readonly variable"
|
||||
SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
|
||||
COUNT(@@GLOBAL.log_queries_not_using_indexes)
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_041_03----------------------#'
|
||||
SELECT @@GLOBAL.log_queries_not_using_indexes = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='log_queries_not_using_indexes';
|
||||
@@GLOBAL.log_queries_not_using_indexes = VARIABLE_VALUE
|
||||
SET @start_value= @@global.log_queries_not_using_indexes;
|
||||
SET @@global.log_queries_not_using_indexes= DEFAULT;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
0
|
||||
1 Expected
|
||||
SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
|
||||
COUNT(@@GLOBAL.log_queries_not_using_indexes)
|
||||
SET @@global.log_queries_not_using_indexes= TRUE;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(VARIABLE_VALUE)
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='log_queries_not_using_indexes';
|
||||
COUNT(VARIABLE_VALUE)
|
||||
SET @@global.log_queries_not_using_indexes= true;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_041_04----------------------#'
|
||||
SELECT @@log_queries_not_using_indexes = @@GLOBAL.log_queries_not_using_indexes;
|
||||
@@log_queries_not_using_indexes = @@GLOBAL.log_queries_not_using_indexes
|
||||
SET @@global.log_queries_not_using_indexes= 0;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
0
|
||||
SET @@global.log_queries_not_using_indexes= 1;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
1
|
||||
1 Expected
|
||||
'#---------------------BS_STVARS_041_05----------------------#'
|
||||
SELECT COUNT(@@log_queries_not_using_indexes);
|
||||
COUNT(@@log_queries_not_using_indexes)
|
||||
SET @goodvar= TRUE;
|
||||
SET @@global.log_queries_not_using_indexes= @goodvar;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
1
|
||||
1 Expected
|
||||
SELECT COUNT(@@local.log_queries_not_using_indexes);
|
||||
ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable
|
||||
Expected error 'Variable is a GLOBAL variable'
|
||||
SELECT COUNT(@@SESSION.log_queries_not_using_indexes);
|
||||
ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable
|
||||
Expected error 'Variable is a GLOBAL variable'
|
||||
SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
|
||||
COUNT(@@GLOBAL.log_queries_not_using_indexes)
|
||||
SET GLOBAL log_queries_not_using_indexes= DEFAULT;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
0
|
||||
SET GLOBAL log_queries_not_using_indexes= ON;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
1
|
||||
1 Expected
|
||||
SELECT log_queries_not_using_indexes = @@SESSION.log_queries_not_using_indexes;
|
||||
ERROR 42S22: Unknown column 'log_queries_not_using_indexes' in 'field list'
|
||||
Expected error 'Readonly variable'
|
||||
SET GLOBAL log_queries_not_using_indexes= OFF;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
0
|
||||
SET GLOBAL log_queries_not_using_indexes= -0;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
0
|
||||
SET GLOBAL log_queries_not_using_indexes= 0.00;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
0
|
||||
SET GLOBAL log_queries_not_using_indexes= -0.0;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
0
|
||||
SET GLOBAL log_queries_not_using_indexes= 001.00;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
1
|
||||
SET GLOBAL log_queries_not_using_indexes= +1.0;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
1
|
||||
SET GLOBAL log_queries_not_using_indexes= +0;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
0
|
||||
SET GLOBAL log_queries_not_using_indexes= +0.000000;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
0
|
||||
SET GLOBAL log_queries_not_using_indexes= 0000.00000;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
0
|
||||
SET GLOBAL log_queries_not_using_indexes= .0;
|
||||
SELECT @@global.log_queries_not_using_indexes;
|
||||
@@global.log_queries_not_using_indexes
|
||||
0
|
||||
SET @@global.log_queries_not_using_indexes= 'DEFAULT';
|
||||
ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'DEFAULT'
|
||||
SET @@global.log_queries_not_using_indexes= 'true';
|
||||
ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'true'
|
||||
SET @@global.log_queries_not_using_indexes= BLABLA;
|
||||
ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'BLABLA'
|
||||
SET @@global.log_queries_not_using_indexes= 25;
|
||||
ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of '25'
|
||||
SET @@global.log_queries_not_using_indexes= 12.34;
|
||||
ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of '12'
|
||||
SET GLOBAL log_queries_not_using_indexes= -1;
|
||||
ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of '-1'
|
||||
SET @badvar= 'true';
|
||||
SET @@global.log_queries_not_using_indexes= @badvar;
|
||||
ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'true'
|
||||
SET GLOBAL log_queries_not_using_indexes= 'DEFAULT';
|
||||
ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'DEFAULT'
|
||||
SET log_queries_not_using_indexes= TRUE;
|
||||
ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
SET SESSION log_queries_not_using_indexes= TRUE;
|
||||
ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
SET @@session.log_queries_not_using_indexes= TRUE;
|
||||
ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
SET LOCAL log_queries_not_using_indexes= TRUE;
|
||||
ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
SET @@global log_queries_not_using_indexes= TRUE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'log_queries_not_using_indexes= TRUE' at line 1
|
||||
SET @@SESSION log_queries_not_using_indexes= TRUE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'log_queries_not_using_indexes= TRUE' at line 1
|
||||
SET @@global.log_queries_not_using_indexes= @start_value;
|
||||
|
@ -1,3 +1,6 @@
|
||||
set @start_general_log= @@global.general_log;
|
||||
set @start_slow_query_log= @@global.slow_query_log;
|
||||
set @start_general_log_file= @@global.general_log_file;
|
||||
set global general_log= OFF;
|
||||
truncate table mysql.general_log;
|
||||
truncate table mysql.slow_log;
|
||||
@ -271,3 +274,6 @@ SET GLOBAL slow_query_log_file = @slow_query_log_file_saved;
|
||||
|
||||
# -- End of Bug#32748.
|
||||
End of 5.1 tests
|
||||
set @@global.general_log= @start_general_log;
|
||||
set @@global.slow_query_log= @start_slow_query_log;
|
||||
set @@global.general_log_file= @start_general_log_file;
|
||||
|
@ -1,3 +1,5 @@
|
||||
SET @old_general_log_state = @@global.general_log;
|
||||
SET @old_slow_log_state = @@global.slow_query_log;
|
||||
use mysql;
|
||||
truncate table general_log;
|
||||
select * from general_log;
|
||||
@ -354,6 +356,7 @@ slow_log
|
||||
slow_log_new
|
||||
drop table slow_log_new, general_log_new;
|
||||
use test;
|
||||
SET @my_log_output= @@global.log_output;
|
||||
SET GLOBAL LOG_OUTPUT = 'TABLE';
|
||||
SET GLOBAL general_log = 0;
|
||||
FLUSH LOGS;
|
||||
@ -422,6 +425,8 @@ SET SESSION long_query_time =@old_long_query_time;
|
||||
FLUSH LOGS;
|
||||
ALTER TABLE mysql.slow_log DROP COLUMN seq;
|
||||
ALTER TABLE mysql.slow_log ENGINE = CSV;
|
||||
SET GLOBAL general_log = @old_general_log_state;
|
||||
SET GLOBAL slow_query_log = @old_slow_log_state;
|
||||
drop procedure if exists proc25422_truncate_slow;
|
||||
drop procedure if exists proc25422_truncate_general;
|
||||
drop procedure if exists proc25422_alter_slow;
|
||||
@ -725,6 +730,8 @@ execute long_query using @lparam;
|
||||
set global general_log = off;
|
||||
select command_type, argument from mysql.general_log where thread_id = @thread_id;
|
||||
command_type argument
|
||||
Query set @old_general_log_state = @@global.general_log
|
||||
Query set global general_log = on
|
||||
Query set @lparam = "000 001 002 003 004 005 006 007 008 009"
|
||||
"010 011 012 013 014 015 016 017 018 019"
|
||||
"020 021 022 023 024 025 026 027 028 029"
|
||||
@ -858,5 +865,6 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1
|
||||
TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
|
||||
DROP TABLE t1;
|
||||
TRUNCATE TABLE mysql.slow_log;
|
||||
SET GLOBAL log_output= @my_log_output;
|
||||
SET GLOBAL slow_query_log = @old_slow_log_state;
|
||||
SET SESSION long_query_time =@old_long_query_time;
|
||||
|
@ -1,3 +1,2 @@
|
||||
Variable_name Value
|
||||
lower_case_file_system ON
|
||||
lower_case_table_names 0
|
||||
|
@ -1,4 +1,5 @@
|
||||
1048576
|
||||
SET @start_max_allowed_packet= @@global.max_allowed_packet;
|
||||
SET @start_value= @@global.net_buffer_length;
|
||||
drop table if exists t1;
|
||||
## Creating new table t1 ##
|
||||
CREATE TABLE t1
|
||||
@ -8,7 +9,7 @@ PRIMARY KEY (id),
|
||||
name BLOB
|
||||
);
|
||||
'#--------------------FN_DYNVARS_070_01-------------------------#'
|
||||
## Setting value of max_allowed packet and net_buffer_length to 1024 ##
|
||||
## Setting value of max_allowed packet and net_buffer_length to 1024 ##
|
||||
SET @@session.max_allowed_packet = 1024;
|
||||
SET @@session.net_buffer_length = 1024;
|
||||
SELECT @@session.max_allowed_packet;
|
||||
@ -29,7 +30,7 @@ id name
|
||||
'Bug#35381: Error is not coming on inserting and fetching data of length'
|
||||
'greater than max_allowed_packet size at session level';
|
||||
'#--------------------FN_DYNVARS_070_02-------------------------#'
|
||||
## Setting value of max_allowed packet and net_buffer_length to 1024 ##
|
||||
## Setting value of max_allowed packet and net_buffer_length to 1024 ##
|
||||
SET @@global.max_allowed_packet = 1024;
|
||||
SET @@global.net_buffer_length = 1024;
|
||||
SELECT @@global.max_allowed_packet;
|
||||
@ -39,9 +40,8 @@ SELECT @@global.net_buffer_length;
|
||||
@@global.net_buffer_length
|
||||
1024
|
||||
## Creating new connection test_con1 ##
|
||||
## Inserting and fetching data of length greater than 1024 ##
|
||||
## Inserting and fetching data of length greater than 1024 ##
|
||||
INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
|
||||
drop table t1;
|
||||
SET @@global.max_allowed_packet = 1048576;
|
||||
## Server disconnects after this case and error occurs that Server ##
|
||||
## has gone away ##
|
||||
SET @@global.max_allowed_packet= @start_max_allowed_packet;
|
||||
SET @@global.net_buffer_length= @start_value;
|
||||
|
@ -1,8 +1,9 @@
|
||||
drop table if exists t1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1
|
||||
(a int auto_increment primary key,
|
||||
b char(20)
|
||||
(a INT AUTO_INCREMENT PRIMARY KEY,
|
||||
b CHAR(20)
|
||||
);
|
||||
SET @start_value= @@global.max_seeks_for_key;
|
||||
'#--------------------FN_DYNVARS_084_01-------------------------#'
|
||||
SELECT @@global.max_seeks_for_key = 10;
|
||||
@@global.max_seeks_for_key = 10
|
||||
@ -14,8 +15,8 @@ SET @@global.max_seeks_for_key = 20;
|
||||
SELECT @@global.max_seeks_for_key;
|
||||
@@global.max_seeks_for_key
|
||||
20
|
||||
INSERT into t1(b) values("AREc");
|
||||
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
|
||||
INSERT INTO t1(b) VALUES("AREc");
|
||||
EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 1
|
||||
1 SIMPLE t2 system NULL NULL NULL NULL 1
|
||||
@ -23,9 +24,9 @@ SET @@session.max_seeks_for_key = 2;
|
||||
SELECT @@session.max_seeks_for_key;
|
||||
@@session.max_seeks_for_key
|
||||
2
|
||||
INSERT into t1(b) values("BREc");
|
||||
INSERT into t1(b) values("CRec");
|
||||
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
|
||||
INSERT INTO t1(b) VALUES("BREc");
|
||||
INSERT INTO t1(b) VALUES("CRec");
|
||||
EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer
|
||||
@ -40,8 +41,8 @@ SET @@global.max_seeks_for_key = 20;
|
||||
SELECT @@global.max_seeks_for_key;
|
||||
@@global.max_seeks_for_key
|
||||
20
|
||||
INSERT into t1(b) values("AREc");
|
||||
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
|
||||
INSERT INTO t1(b) VALUES("AREc");
|
||||
EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer
|
||||
@ -49,27 +50,28 @@ SET @@session.max_seeks_for_key = 2;
|
||||
SELECT @@session.max_seeks_for_key;
|
||||
@@session.max_seeks_for_key
|
||||
2
|
||||
INSERT into t1(b) values("BREc");
|
||||
INSERT into t1(b) values("CRec");
|
||||
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
|
||||
INSERT INTO t1(b) VALUES("BREc");
|
||||
INSERT INTO t1(b) VALUES("CRec");
|
||||
EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 6
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer
|
||||
INSERT INTO t1 values(null,"test");
|
||||
INSERT INTO t1 VALUES(null,"test");
|
||||
INSERT INTO t1 VALUES (null,"a"),(null,"a"),(null,"a"),
|
||||
(null,"a"),(null,"a"),(null,"a"),(null,"a"),
|
||||
(null,"a"),(null,"a"),(null,"a");
|
||||
explain SELECT STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
|
||||
EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 17
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 17 Using where; Using join buffer
|
||||
analyze table t1;
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
SET MAX_SEEKS_FOR_KEY=1;
|
||||
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
|
||||
EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 17
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 17 Using where; Using join buffer
|
||||
SET MAX_SEEKS_FOR_KEY=DEFAULT;
|
||||
drop table t1;
|
||||
DROP TABLE t1;
|
||||
SET @@global.max_seeks_for_key= @start_value;
|
||||
|
@ -1,3 +1,4 @@
|
||||
SET @start_value= @@global.max_sort_length;
|
||||
SET @session_max_sort_length = @@Session.max_sort_length;
|
||||
DROP TABLE IF EXISTS t;
|
||||
** creating tables **
|
||||
@ -296,3 +297,4 @@ SET @@SESSION.max_sort_length = @session_max_sort_length;
|
||||
DROP TABLE IF EXISTS t;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
SET @@global.max_sort_length= @start_value;
|
||||
|
@ -108,11 +108,11 @@ id
|
||||
1
|
||||
select * from v1 group by id limit 0;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t1 v1 id id 3 10 0 Y 32768 0 63
|
||||
def test v1 v1 id id 3 10 0 Y 32768 0 63
|
||||
id
|
||||
select * from v1 where id=1000 group by id;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t1 v1 id id 3 10 0 Y 32768 0 63
|
||||
def test v1 v1 id id 3 10 0 Y 32768 0 63
|
||||
id
|
||||
select * from v1 where id=1 group by id;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
@ -126,7 +126,7 @@ renamed
|
||||
1
|
||||
select * from v3 where renamed=1 group by renamed;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def v3 renamed 8 12 0 Y 32896 0 63
|
||||
def v3 v3 renamed renamed 8 12 0 Y 32896 0 63
|
||||
renamed
|
||||
drop table t1;
|
||||
drop view v1,v2,v3;
|
||||
@ -156,8 +156,8 @@ c1
|
||||
3
|
||||
SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t1 v1 c1 c1 254 1 1 Y 0 0 8
|
||||
def test t2 v2 c2 c2 254 1 1 Y 0 0 8
|
||||
def test v1 v1 c1 c1 254 1 1 Y 0 0 8
|
||||
def test v2 v2 c2 c2 254 1 1 Y 0 0 8
|
||||
c1 c2
|
||||
1 1
|
||||
2 2
|
||||
|
@ -1831,6 +1831,28 @@ id ref
|
||||
3 2
|
||||
4 5
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE t1 (a INT) ENGINE=MyISAM CHECKSUM=1 ROW_FORMAT=DYNAMIC;
|
||||
INSERT INTO t1 VALUES (0);
|
||||
UPDATE t1 SET a=1;
|
||||
SELECT a FROM t1;
|
||||
a
|
||||
1
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
INSERT INTO t1 VALUES (0), (5), (4), (2);
|
||||
UPDATE t1 SET a=2;
|
||||
SELECT a FROM t1;
|
||||
a
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
create table t1 (a int not null, key `a` (a) key_block_size=1024);
|
||||
show create table t1;
|
||||
|
@ -1,4 +1,5 @@
|
||||
'#--------------------FN_DYNVARS_093_01-------------------------#'
|
||||
SET @start_value= @@global.myisam_data_pointer_size;
|
||||
SET @@global.myisam_data_pointer_size = 2;
|
||||
'connect (con1,localhost,root,,,,)'
|
||||
'connection con1'
|
||||
@ -40,3 +41,4 @@ count(*)
|
||||
65536
|
||||
DROP PROCEDURE sp_addRec;
|
||||
DROP TABLE t1;
|
||||
SET @@global.myisam_data_pointer_size= @start_value;
|
||||
|
@ -1,4 +1,5 @@
|
||||
'#--------------------FN_DYNVARS_097_01-------------------------#'
|
||||
SET @start_value = @@global.myisam_stats_method;
|
||||
SET @@global.myisam_stats_method = nulls_equal;
|
||||
'connect (con1,localhost,root,,,,)'
|
||||
'connection con1'
|
||||
@ -11,11 +12,11 @@ nulls_equal
|
||||
'#--------------------FN_DYNVARS_097_02-------------------------#'
|
||||
'connection default'
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a int, key (a));
|
||||
CREATE TABLE t1 (a INT, KEY (a));
|
||||
INSERT INTO t1 VALUES (0),(1),(2),(3),(4);
|
||||
INSERT INTO t1 SELECT NULL FROM t1;
|
||||
'default: NULLs considered unequal'
|
||||
SET myisam_stats_method=nulls_unequal;
|
||||
SET myisam_stats_method = nulls_unequal;
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
@ -23,7 +24,7 @@ SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a A 10 NULL NULL YES BTREE
|
||||
INSERT INTO t1 VALUES (11);
|
||||
DELETE FROM t1 WHERE a=11;
|
||||
DELETE FROM t1 WHERE a = 11;
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
@ -31,9 +32,9 @@ SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a A 10 NULL NULL YES BTREE
|
||||
'Set nulls to be equal'
|
||||
SET myisam_stats_method=nulls_equal;
|
||||
SET myisam_stats_method = nulls_equal;
|
||||
INSERT INTO t1 VALUES (11);
|
||||
DELETE FROM t1 WHERE a=11;
|
||||
DELETE FROM t1 WHERE a = 11;
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
@ -41,7 +42,7 @@ SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a A 5 NULL NULL YES BTREE
|
||||
INSERT INTO t1 VALUES (11);
|
||||
DELETE FROM t1 WHERE a=11;
|
||||
DELETE FROM t1 WHERE a = 11;
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
@ -49,14 +50,14 @@ SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a A 5 NULL NULL YES BTREE
|
||||
'Set nulls to be ignored'
|
||||
SET myisam_stats_method=nulls_ignored;
|
||||
SHOW variables LIKE 'myisam_stats_method';
|
||||
SET myisam_stats_method = nulls_ignored;
|
||||
SHOW VARIABLES LIKE 'myisam_stats_method';
|
||||
Variable_name Value
|
||||
myisam_stats_method nulls_ignored
|
||||
drop TABLE t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
a char(3), b char(4), c char(5), d char(6),
|
||||
key(a,b,c,d)
|
||||
a CHAR(3), b CHAR(4), c CHAR(5), d CHAR(6),
|
||||
KEY(a,b,c,d)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('bcd','def1', NULL, 'zz');
|
||||
INSERT INTO t1 VALUES ('bcd','def2', NULL, 'zz');
|
||||
@ -81,5 +82,6 @@ t1 1 a 1 a A 0 NULL NULL YES BTREE
|
||||
t1 1 a 2 b A 0 NULL NULL YES BTREE
|
||||
t1 1 a 3 c A 0 NULL NULL YES BTREE
|
||||
t1 1 a 4 d A 0 NULL NULL YES BTREE
|
||||
SET myisam_stats_method=DEFAULT;
|
||||
SET myisam_stats_method = DEFAULT;
|
||||
DROP TABLE t1;
|
||||
SET @@global.myisam_stats_method= @start_value;
|
||||
|
4137
mysql-test/r/mysqlbinlog_row.result
Normal file
4137
mysql-test/r/mysqlbinlog_row.result
Normal file
File diff suppressed because it is too large
Load Diff
74
mysql-test/r/mysqlbinlog_row_big.result
Normal file
74
mysql-test/r/mysqlbinlog_row_big.result
Normal file
@ -0,0 +1,74 @@
|
||||
#
|
||||
# Preparatory cleanup.
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
#
|
||||
# We need a fixed timestamp to avoid varying results.
|
||||
#
|
||||
SET timestamp=1000000000;
|
||||
#
|
||||
# We need big packets.
|
||||
#
|
||||
SET @@session.max_allowed_packet= 1024*1024*1024;
|
||||
#
|
||||
# Delete all existing binary logs.
|
||||
#
|
||||
RESET MASTER;
|
||||
#
|
||||
# Create a test table.
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
c1 LONGTEXT
|
||||
) ENGINE=MyISAM DEFAULT CHARSET latin1;
|
||||
#
|
||||
# Show how much rows are affected by each statement.
|
||||
#
|
||||
#
|
||||
# Insert a big row.
|
||||
#
|
||||
INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
|
||||
affected rows: 1
|
||||
#
|
||||
# Show what we have in the table.
|
||||
# Do not display the column value itself, just its length.
|
||||
#
|
||||
SELECT LENGTH(c1) FROM t1;
|
||||
LENGTH(c1) 33554432
|
||||
affected rows: 1
|
||||
#
|
||||
# Grow the row by updating.
|
||||
#
|
||||
UPDATE t1 SET c1 = CONCAT(c1, c1);
|
||||
affected rows: 1
|
||||
info: Rows matched: 1 Changed: 1 Warnings: 0
|
||||
#
|
||||
# Show what we have in the table.
|
||||
# Do not display the column value itself, just its length.
|
||||
#
|
||||
SELECT LENGTH(c1) FROM t1;
|
||||
LENGTH(c1) 67108864
|
||||
affected rows: 1
|
||||
#
|
||||
# Delete the row.
|
||||
#
|
||||
DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck';
|
||||
affected rows: 1
|
||||
#
|
||||
# Hide how much rows are affected by each statement.
|
||||
#
|
||||
#
|
||||
# Flush all log buffers to the log file.
|
||||
#
|
||||
FLUSH LOGS;
|
||||
#
|
||||
# Call mysqlbinlog to display the log file contents.
|
||||
# NOTE: The output of mysqlbinlog is redirected to
|
||||
# $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out
|
||||
# If you want to examine it, disable remove_file
|
||||
# at the bottom of the test script.
|
||||
#
|
||||
#
|
||||
# Cleanup.
|
||||
#
|
||||
DROP TABLE t1;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_big_1.out
|
4859
mysql-test/r/mysqlbinlog_row_innodb.result
Normal file
4859
mysql-test/r/mysqlbinlog_row_innodb.result
Normal file
File diff suppressed because it is too large
Load Diff
4899
mysql-test/r/mysqlbinlog_row_myisam.result
Normal file
4899
mysql-test/r/mysqlbinlog_row_myisam.result
Normal file
File diff suppressed because it is too large
Load Diff
500
mysql-test/r/mysqlbinlog_row_trans.result
Normal file
500
mysql-test/r/mysqlbinlog_row_trans.result
Normal file
@ -0,0 +1,500 @@
|
||||
#
|
||||
# Preparatory cleanup.
|
||||
#
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
#
|
||||
# We need a fixed timestamp to avoid varying results.
|
||||
#
|
||||
SET timestamp=1000000000;
|
||||
#
|
||||
# Delete all existing binary logs.
|
||||
#
|
||||
RESET MASTER;
|
||||
#
|
||||
# Create test tables.
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 VARCHAR(20)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET latin1;
|
||||
CREATE TABLE t2 (
|
||||
c1 INT,
|
||||
c2 VARCHAR(20)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET latin1;
|
||||
#
|
||||
# Start transaction #1, transactional table only, commit.
|
||||
#
|
||||
START TRANSACTION;
|
||||
#
|
||||
# Do some statements.
|
||||
#
|
||||
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t1 SET c1 = c1 + 10;
|
||||
DELETE FROM t1 WHERE c1 = 12;
|
||||
#
|
||||
# Commit transaction.
|
||||
#
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
11 varchar-1
|
||||
13 varchar-3
|
||||
TRUNCATE TABLE t1;
|
||||
#
|
||||
# Start transaction #2, transactional table only, rollback.
|
||||
#
|
||||
START TRANSACTION;
|
||||
#
|
||||
# Do some statements.
|
||||
#
|
||||
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t1 SET c1 = c1 + 10;
|
||||
DELETE FROM t1 WHERE c1 = 12;
|
||||
#
|
||||
# Rollback transaction.
|
||||
#
|
||||
ROLLBACK;
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
TRUNCATE TABLE t1;
|
||||
#
|
||||
# Start transaction #3, both tables, commit.
|
||||
#
|
||||
START TRANSACTION;
|
||||
#
|
||||
# Do some statements on the transactional table.
|
||||
#
|
||||
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t1 SET c1 = c1 + 10;
|
||||
DELETE FROM t1 WHERE c1 = 12;
|
||||
#
|
||||
# Do some statements on the non-transactional table.
|
||||
#
|
||||
INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t2 SET c1 = c1 + 10;
|
||||
DELETE FROM t2 WHERE c1 = 12;
|
||||
#
|
||||
# Commit transaction.
|
||||
#
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
11 varchar-1
|
||||
13 varchar-3
|
||||
SELECT * FROM t2;
|
||||
c1 c2
|
||||
11 varchar-1
|
||||
13 varchar-3
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
#
|
||||
# Start transaction #4, both tables, rollback.
|
||||
#
|
||||
START TRANSACTION;
|
||||
#
|
||||
# Do some statements on the transactional table.
|
||||
#
|
||||
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t1 SET c1 = c1 + 10;
|
||||
DELETE FROM t1 WHERE c1 = 12;
|
||||
#
|
||||
# Do some statements on the non-transactional table.
|
||||
#
|
||||
INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
||||
UPDATE t2 SET c1 = c1 + 10;
|
||||
DELETE FROM t2 WHERE c1 = 12;
|
||||
#
|
||||
# Rollback transaction.
|
||||
#
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
SELECT * FROM t2;
|
||||
c1 c2
|
||||
11 varchar-1
|
||||
13 varchar-3
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
#
|
||||
# Flush all log buffers to the log file.
|
||||
#
|
||||
FLUSH LOGS;
|
||||
#
|
||||
# Call mysqlbinlog to display the log file contents.
|
||||
#
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
|
||||
DELIMITER /*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
|
||||
ROLLBACK/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
use test/*!*/;
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.pseudo_thread_id=#/*!*/;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
|
||||
SET @@session.sql_mode=0/*!*/;
|
||||
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
|
||||
/*!\C latin1 *//*!*/;
|
||||
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
|
||||
SET @@session.lc_time_names=0/*!*/;
|
||||
SET @@session.collation_database=DEFAULT/*!*/;
|
||||
CREATE TABLE t1 (
|
||||
c1 INT,
|
||||
c2 VARCHAR(20)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET latin1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
CREATE TABLE t2 (
|
||||
c1 INT,
|
||||
c2 VARCHAR(20)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET latin1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t2
|
||||
### WHERE
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t2
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t1
|
||||
### SET
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t1
|
||||
### WHERE
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t1
|
||||
### WHERE
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### INSERT INTO test.t2
|
||||
### SET
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### UPDATE test.t2
|
||||
### WHERE
|
||||
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
### SET
|
||||
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
|
||||
### DELETE FROM test.t2
|
||||
### WHERE
|
||||
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
|
||||
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
ROLLBACK
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
BEGIN
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t1
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Xid = #
|
||||
COMMIT/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
TRUNCATE TABLE t2
|
||||
/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4
|
||||
DELIMITER ;
|
||||
# End of log file
|
||||
ROLLBACK /* added by mysqlbinlog */;
|
||||
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
|
||||
#
|
||||
# Cleanup.
|
||||
#
|
||||
DROP TABLE t1, t2;
|
@ -538,7 +538,7 @@ PARTITION BY LIST (a)
|
||||
(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze note The storage engine for the table doesn't support analyze
|
||||
test.t1 analyze status OK
|
||||
drop table t1;
|
||||
create table t1
|
||||
(a int)
|
||||
@ -1239,7 +1239,11 @@ SHOW TABLE STATUS;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MyISAM 10 Fixed 1 14 14 0 0 7 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
ALTER TABLE t1 OPTIMIZE PARTITION p0;
|
||||
ERROR 42000: The storage engine for the table doesn't support optimize partition
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
SHOW TABLE STATUS;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 MyISAM 10 Fixed 1 7 7 0 1024 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a);
|
||||
ALTER TABLE t1 DISABLE KEYS;
|
||||
@ -1499,13 +1503,17 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
|
||||
ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EXTENDED' at line 1
|
||||
ALTER TABLE t1 ANALYZE PARTITION p1;
|
||||
ERROR 42000: The storage engine for the table doesn't support analyze partition
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
ALTER TABLE t1 CHECK PARTITION p1;
|
||||
ERROR 42000: The storage engine for the table doesn't support check partition
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
ALTER TABLE t1 REPAIR PARTITION p1;
|
||||
ERROR 42000: The storage engine for the table doesn't support repair partition
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
ALTER TABLE t1 OPTIMIZE PARTITION p1;
|
||||
ERROR 42000: The storage engine for the table doesn't support optimize partition
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (s1 BIGINT UNSIGNED)
|
||||
PARTITION BY RANGE (s1) (
|
||||
@ -1604,4 +1612,29 @@ t1 CREATE TABLE `t1` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (id) SUBPARTITION BY HASH (id) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION pa2 VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`createdDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`number` int,
|
||||
PRIMARY KEY (`ID`, number)
|
||||
)
|
||||
PARTITION BY RANGE (number) (
|
||||
PARTITION p0 VALUES LESS THAN (6),
|
||||
PARTITION p1 VALUES LESS THAN (11)
|
||||
);
|
||||
create table t2 (
|
||||
`ID` bigint(20),
|
||||
`createdDate` TIMESTAMP,
|
||||
`number` int
|
||||
);
|
||||
INSERT INTO t1 SET number=1;
|
||||
insert into t2 select * from t1;
|
||||
SELECT SLEEP(1);
|
||||
SLEEP(1)
|
||||
0
|
||||
UPDATE t1 SET number=6;
|
||||
select count(*) from t1, t2 where t1.createdDate = t2.createdDate;
|
||||
count(*)
|
||||
1
|
||||
drop table t1, t2;
|
||||
End of 5.1 tests
|
||||
|
@ -113,9 +113,9 @@ set @@sql_mode=@org_mode;
|
||||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
|
||||
ERROR 42000: Incorrect table name 'part-data'
|
||||
Got one of the listed errors
|
||||
create table t1 (a int)
|
||||
partition by key (a)
|
||||
(partition p0,
|
||||
partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
|
||||
ERROR 42000: Incorrect table name 'part-data'
|
||||
Got one of the listed errors
|
||||
|
@ -11,6 +11,7 @@ select @@profiling;
|
||||
0
|
||||
set global profiling = ON;
|
||||
ERROR HY000: Variable 'profiling' is a SESSION variable and can't be used with SET GLOBAL
|
||||
set @start_value= @@global.profiling_history_size;
|
||||
set global profiling_history_size=100;
|
||||
show global variables like 'profil%';
|
||||
Variable_name Value
|
||||
@ -412,4 +413,5 @@ Warnings:
|
||||
Note 1051 Unknown table 'test.v1'
|
||||
drop function if exists f1;
|
||||
set session profiling = OFF;
|
||||
set global profiling_history_size= @start_value;
|
||||
End of 5.0 tests
|
||||
|
@ -446,7 +446,7 @@ def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 1365 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 0 31 8
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 14 N 1 31 8
|
||||
@ -462,7 +462,7 @@ def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 5 Y 0 31 8
|
||||
def possible_keys 253 4096 7 Y 0 31 8
|
||||
def key 253 64 7 Y 0 31 8
|
||||
def key_len 253 1365 1 Y 0 31 8
|
||||
def key_len 253 4096 1 Y 0 31 8
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 27 N 1 31 8
|
||||
|
@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 1365 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 0 31 8
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
|
@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 1365 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 0 31 8
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
|
@ -1159,7 +1159,7 @@ def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 1365 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 0 31 8
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
|
@ -1201,7 +1201,7 @@ def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 1365 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 0 31 8
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
@ -4222,7 +4222,7 @@ def table 253 64 2 Y 0 31 8
|
||||
def type 253 10 3 Y 0 31 8
|
||||
def possible_keys 253 4096 0 Y 0 31 8
|
||||
def key 253 64 0 Y 0 31 8
|
||||
def key_len 253 1365 0 Y 0 31 8
|
||||
def key_len 253 4096 0 Y 0 31 8
|
||||
def ref 253 1024 0 Y 0 31 8
|
||||
def rows 8 10 1 Y 32928 0 63
|
||||
def Extra 253 255 0 N 1 31 8
|
||||
|
@ -1567,11 +1567,13 @@ drop table if exists t_12093;
|
||||
drop function if exists f_12093;
|
||||
drop function if exists f_12093_unrelated;
|
||||
drop procedure if exists p_12093;
|
||||
drop view if exists v_12093_unrelated;
|
||||
create table t_12093 (a int);
|
||||
create function f_12093() returns int return (select count(*) from t_12093);
|
||||
create procedure p_12093(a int) select * from t_12093;
|
||||
create function f_12093_unrelated() returns int return 2;
|
||||
create procedure p_12093_unrelated() begin end;
|
||||
create view v_12093_unrelated as select * from t_12093;
|
||||
prepare stmt_sf from 'select f_12093();';
|
||||
prepare stmt_sp from 'call p_12093(f_12093())';
|
||||
execute stmt_sf;
|
||||
@ -1580,6 +1582,27 @@ f_12093()
|
||||
execute stmt_sp;
|
||||
a
|
||||
drop function f_12093_unrelated;
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sf;
|
||||
f_12093()
|
||||
0
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sp;
|
||||
a
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sf;
|
||||
f_12093()
|
||||
0
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sp;
|
||||
a
|
||||
prepare stmt_sf from 'select f_12093();';
|
||||
prepare stmt_sp from 'call p_12093(f_12093())';
|
||||
execute stmt_sf;
|
||||
f_12093()
|
||||
0
|
||||
execute stmt_sp;
|
||||
a
|
||||
drop procedure p_12093_unrelated;
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sf;
|
||||
@ -1595,7 +1618,29 @@ f_12093()
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sp;
|
||||
a
|
||||
call p_verify_reprepare_count(2);
|
||||
prepare stmt_sf from 'select f_12093();';
|
||||
prepare stmt_sp from 'call p_12093(f_12093())';
|
||||
execute stmt_sf;
|
||||
f_12093()
|
||||
0
|
||||
execute stmt_sp;
|
||||
a
|
||||
drop view v_12093_unrelated;
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sf;
|
||||
f_12093()
|
||||
0
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sp;
|
||||
a
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sf;
|
||||
f_12093()
|
||||
0
|
||||
# XXX: used to be a bug
|
||||
execute stmt_sp;
|
||||
a
|
||||
call p_verify_reprepare_count(6);
|
||||
SUCCESS
|
||||
|
||||
drop table t_12093;
|
||||
|
@ -1,6 +1,8 @@
|
||||
** Setup **
|
||||
|
||||
SET @global_query_cache_limit = @@global.query_cache_limit;
|
||||
SET @global_query_cache_size = @@global.query_cache_size;
|
||||
SET @global_query_cache_type = @@global.query_cache_type;
|
||||
** warnings **
|
||||
DROP TABLE IF EXISTS t;
|
||||
** creating table **
|
||||
@ -48,7 +50,7 @@ Qcache_queries_in_cache 1
|
||||
FLUSH STATUS;
|
||||
RESET QUERY CACHE;
|
||||
** set cache limit **
|
||||
SET @@GLOBAL.query_cache_limit=0;
|
||||
SET @@GLOBAL.query_cache_limit = 0;
|
||||
** fetching results **
|
||||
SELECT * FROM t;
|
||||
id c
|
||||
@ -67,7 +69,7 @@ Qcache_queries_in_cache 0
|
||||
0 Expected
|
||||
'#---------------------FN_DYNVARS_132_03----------------------#'
|
||||
** set cache limit **
|
||||
SET @@GLOBAL.query_cache_limit=DEFAULT;
|
||||
SET @@GLOBAL.query_cache_limit = DEFAULT;
|
||||
** Reset cache values **
|
||||
FLUSH STATUS;
|
||||
RESET QUERY CACHE;
|
||||
@ -86,7 +88,7 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
1 Expected
|
||||
SET @@GLOBAL.query_cache_limit=0;
|
||||
SET @@GLOBAL.query_cache_limit = 0;
|
||||
SHOW STATUS LIKE 'Qcache_not_cached';
|
||||
Variable_name Value
|
||||
Qcache_not_cached 0
|
||||
@ -112,4 +114,6 @@ Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
1 Expected
|
||||
SET @@GLOBAL.query_cache_limit = @global_query_cache_limit;
|
||||
SET GLOBAL query_cache_size = @global_query_cache_size;
|
||||
SET GLOBAL query_cache_type = @global_query_cache_type;
|
||||
DROP TABLE IF EXISTS t;
|
||||
|
@ -4,6 +4,7 @@
|
||||
** Connection con0 **
|
||||
SET @start_global_value = @@GLOBAL.query_cache_type;
|
||||
SET @start_session_value = @@SESSION.query_cache_type;
|
||||
SET @start_query_cache_size= @@global.query_cache_size;
|
||||
CREATE TABLE t1(id int, value varchar(10));
|
||||
INSERT INTO t1 VALUES(1, 'val1');
|
||||
INSERT INTO t1 VALUES(2, 'val2');
|
||||
@ -216,6 +217,7 @@ Disconnecting con1,con2,con3
|
||||
** Connection con0 **
|
||||
SET @@GLOBAL.query_cache_type = @start_global_value;
|
||||
SET @@SESSION.query_cache_type = @start_session_value;
|
||||
SET GLOBAL query_cache_size = @start_query_cache_size;
|
||||
DROP TABLE t1;
|
||||
DROP PROCEDURE testProcHit;
|
||||
Disconnecting con0
|
||||
|
@ -1,17 +1,18 @@
|
||||
** Setup **
|
||||
|
||||
CREATE TABLE t1 (id int auto_increment primary key, val text(200));
|
||||
INSERT INTO t1 values(NULL,'a');
|
||||
INSERT INTO t1 values(NULL,'b');
|
||||
INSERT INTO t1 values(NULL,'c');
|
||||
INSERT INTO t1 values(NULL,'d');
|
||||
SET @start_value = @@global.query_prealloc_size;
|
||||
CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, val TEXT(200));
|
||||
INSERT INTO t1 VALUES(NULL,'a');
|
||||
INSERT INTO t1 VALUES(NULL,'b');
|
||||
INSERT INTO t1 VALUES(NULL,'c');
|
||||
INSERT INTO t1 VALUES(NULL,'d');
|
||||
SELECT * FROM t1 ORDER BY val;
|
||||
id val
|
||||
1 a
|
||||
2 b
|
||||
3 c
|
||||
4 d
|
||||
SET SESSION query_prealloc_size = 8192;
|
||||
SET SESSION query_prealloc_size = 8192;
|
||||
'#----------------------------FN_DYNVARS_137_05-----------------#'
|
||||
SET GLOBAL query_prealloc_size = 8192;
|
||||
SELECT @@SESSION.query_prealloc_size;
|
||||
@ -36,3 +37,5 @@ SELECT @@GLOBAL.query_prealloc_size;
|
||||
@@GLOBAL.query_prealloc_size
|
||||
8192
|
||||
Expected Value : 8192;
|
||||
DROP TABLE t1;
|
||||
SET @@global.query_prealloc_size = @start_value;
|
||||
|
@ -12,51 +12,51 @@ insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
|
||||
-- after Bug#29394 is implemented.
|
||||
check table t1 fast;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Table 253 42 7 Y 0 31 8
|
||||
def Op 253 3 5 Y 0 31 8
|
||||
def Msg_type 253 3 6 Y 0 31 8
|
||||
def Msg_text 253 85 27 Y 0 31 8
|
||||
def Table 253 128 7 Y 0 31 8
|
||||
def Op 253 10 5 Y 0 31 8
|
||||
def Msg_type 253 10 6 Y 0 31 8
|
||||
def Msg_text 253 255 27 Y 0 31 8
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status Table is already up to date
|
||||
check table t1 fast;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Table 253 42 7 Y 0 31 8
|
||||
def Op 253 3 5 Y 0 31 8
|
||||
def Msg_type 253 3 6 Y 0 31 8
|
||||
def Msg_text 253 85 27 Y 0 31 8
|
||||
def Table 253 128 7 Y 0 31 8
|
||||
def Op 253 10 5 Y 0 31 8
|
||||
def Msg_type 253 10 6 Y 0 31 8
|
||||
def Msg_text 253 255 27 Y 0 31 8
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status Table is already up to date
|
||||
check table t1 changed;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Table 253 42 7 Y 0 31 8
|
||||
def Op 253 3 5 Y 0 31 8
|
||||
def Msg_type 253 3 6 Y 0 31 8
|
||||
def Msg_text 253 85 2 Y 0 31 8
|
||||
def Table 253 128 7 Y 0 31 8
|
||||
def Op 253 10 5 Y 0 31 8
|
||||
def Msg_type 253 10 6 Y 0 31 8
|
||||
def Msg_text 253 255 2 Y 0 31 8
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
insert into t1 values (5,5,5);
|
||||
check table t1 changed;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Table 253 42 7 Y 0 31 8
|
||||
def Op 253 3 5 Y 0 31 8
|
||||
def Msg_type 253 3 6 Y 0 31 8
|
||||
def Msg_text 253 85 2 Y 0 31 8
|
||||
def Table 253 128 7 Y 0 31 8
|
||||
def Op 253 10 5 Y 0 31 8
|
||||
def Msg_type 253 10 6 Y 0 31 8
|
||||
def Msg_text 253 255 2 Y 0 31 8
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
check table t1 medium;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Table 253 42 7 Y 0 31 8
|
||||
def Op 253 3 5 Y 0 31 8
|
||||
def Msg_type 253 3 6 Y 0 31 8
|
||||
def Msg_text 253 85 2 Y 0 31 8
|
||||
def Table 253 128 7 Y 0 31 8
|
||||
def Op 253 10 5 Y 0 31 8
|
||||
def Msg_type 253 10 6 Y 0 31 8
|
||||
def Msg_text 253 255 2 Y 0 31 8
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
check table t1 extended;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Table 253 42 7 Y 0 31 8
|
||||
def Op 253 3 5 Y 0 31 8
|
||||
def Msg_type 253 3 6 Y 0 31 8
|
||||
def Msg_text 253 85 2 Y 0 31 8
|
||||
def Table 253 128 7 Y 0 31 8
|
||||
def Op 253 10 5 Y 0 31 8
|
||||
def Msg_type 253 10 6 Y 0 31 8
|
||||
def Msg_text 253 255 2 Y 0 31 8
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
show index from t1;
|
||||
@ -84,10 +84,10 @@ ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
|
||||
-- after Bug#29394 is implemented.
|
||||
optimize table t1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Table 253 42 7 Y 0 31 8
|
||||
def Op 253 3 8 Y 0 31 8
|
||||
def Msg_type 253 3 6 Y 0 31 8
|
||||
def Msg_text 253 85 2 Y 0 31 8
|
||||
def Table 253 128 7 Y 0 31 8
|
||||
def Op 253 10 8 Y 0 31 8
|
||||
def Msg_type 253 10 6 Y 0 31 8
|
||||
def Msg_text 253 255 2 Y 0 31 8
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
optimize table t1;
|
||||
@ -155,10 +155,10 @@ insert into t1 values (1,1,1,0),(1,1,2,0),(1,1,3,0),(1,2,1,0),(1,2,2,0),(1,2,3,0
|
||||
-- after Bug#29394 is implemented.
|
||||
analyze table t1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Table 253 42 7 Y 0 31 8
|
||||
def Op 253 3 7 Y 0 31 8
|
||||
def Msg_type 253 3 6 Y 0 31 8
|
||||
def Msg_text 253 85 2 Y 0 31 8
|
||||
def Table 253 128 7 Y 0 31 8
|
||||
def Op 253 10 7 Y 0 31 8
|
||||
def Msg_type 253 10 6 Y 0 31 8
|
||||
def Msg_text 253 255 2 Y 0 31 8
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
show index from t1;
|
||||
@ -172,10 +172,10 @@ t1 0 PRIMARY 4 f4 A 18 NULL NULL BTREE
|
||||
-- after Bug#29394 is implemented.
|
||||
repair table t1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Table 253 42 7 Y 0 31 8
|
||||
def Op 253 3 6 Y 0 31 8
|
||||
def Msg_type 253 3 6 Y 0 31 8
|
||||
def Msg_text 253 85 2 Y 0 31 8
|
||||
def Table 253 128 7 Y 0 31 8
|
||||
def Op 253 10 6 Y 0 31 8
|
||||
def Msg_type 253 10 6 Y 0 31 8
|
||||
def Msg_text 253 255 2 Y 0 31 8
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
show index from t1;
|
||||
@ -879,8 +879,8 @@ latin1_bin latin1 47 Yes 1
|
||||
----------------------------------------------------------------
|
||||
SHOW CREATE DATABASE mysqltest1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Database 253 63 10 N 1 31 33
|
||||
def Create Database 253 1023 69 N 1 31 33
|
||||
def Database 253 192 10 N 1 31 33
|
||||
def Create Database 253 3072 69 N 1 31 33
|
||||
Database Create Database
|
||||
mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */
|
||||
----------------------------------------------------------------
|
||||
@ -892,8 +892,8 @@ mysqltest1
|
||||
----------------------------------------------------------------
|
||||
SHOW CREATE TABLE t1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Table 253 63 2 N 1 31 33
|
||||
def Create Table 253 1023 102 N 1 31 33
|
||||
def Table 253 192 2 N 1 31 33
|
||||
def Create Table 253 3072 102 N 1 31 33
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c` int(11) NOT NULL,
|
||||
@ -1053,10 +1053,10 @@ NULL test t1_bi INSERT NULL test t1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW
|
||||
----------------------------------------------------------------
|
||||
SHOW CREATE VIEW v1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def View 253 63 2 N 1 31 33
|
||||
def Create View 253 1023 103 N 1 31 33
|
||||
def character_set_client 253 30 6 N 1 31 33
|
||||
def collation_connection 253 30 6 N 1 31 33
|
||||
def View 253 192 2 N 1 31 33
|
||||
def Create View 253 3072 103 N 1 31 33
|
||||
def character_set_client 253 96 6 N 1 31 33
|
||||
def collation_connection 253 96 6 N 1 31 33
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` binary binary
|
||||
----------------------------------------------------------------
|
||||
@ -1079,12 +1079,12 @@ NULL test v1 select 1 AS `1` NONE NO root@localhost DEFINER binary binary
|
||||
----------------------------------------------------------------
|
||||
SHOW CREATE PROCEDURE p1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Procedure 253 63 2 N 1 31 33
|
||||
def Procedure 253 192 2 N 1 31 33
|
||||
def sql_mode 253 0 0 N 1 31 33
|
||||
def Create Procedure 253 1023 59 Y 0 31 33
|
||||
def character_set_client 253 30 6 N 1 31 33
|
||||
def collation_connection 253 30 6 N 1 31 33
|
||||
def Database Collation 253 30 17 N 1 31 33
|
||||
def Create Procedure 253 3072 59 Y 0 31 33
|
||||
def character_set_client 253 96 6 N 1 31 33
|
||||
def collation_connection 253 96 6 N 1 31 33
|
||||
def Database Collation 253 96 17 N 1 31 33
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
|
||||
SELECT 1 binary binary latin1_swedish_ci
|
||||
@ -1134,12 +1134,12 @@ p1 NULL test p1 PROCEDURE NULL SQL SELECT 1 NULL NULL SQL NO CONTAINS SQL NULL D
|
||||
----------------------------------------------------------------
|
||||
SHOW CREATE FUNCTION f1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Function 253 63 2 N 1 31 33
|
||||
def Function 253 192 2 N 1 31 33
|
||||
def sql_mode 253 0 0 N 1 31 33
|
||||
def Create Function 253 1023 74 Y 0 31 33
|
||||
def character_set_client 253 30 6 N 1 31 33
|
||||
def collation_connection 253 30 6 N 1 31 33
|
||||
def Database Collation 253 30 17 N 1 31 33
|
||||
def Create Function 253 3072 74 Y 0 31 33
|
||||
def character_set_client 253 96 6 N 1 31 33
|
||||
def collation_connection 253 96 6 N 1 31 33
|
||||
def Database Collation 253 96 17 N 1 31 33
|
||||
Function sql_mode Create Function character_set_client collation_connection Database Collation
|
||||
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
|
||||
RETURN 1 binary binary latin1_swedish_ci
|
||||
@ -1245,6 +1245,36 @@ Slow_queries 2
|
||||
show variables like 'myisam_recover_options';
|
||||
Variable_name Value
|
||||
myisam_recover_options OFF
|
||||
CREATE TABLE t1 (
|
||||
Codigo int(10) unsigned NOT NULL auto_increment,
|
||||
Nombre varchar(255) default NULL,
|
||||
Telefono varchar(255) default NULL,
|
||||
Observaciones longtext,
|
||||
Direccion varchar(255) default NULL,
|
||||
Dni varchar(255) default NULL,
|
||||
CP int(11) default NULL,
|
||||
Provincia varchar(255) default NULL,
|
||||
Poblacion varchar(255) default NULL,
|
||||
PRIMARY KEY (Codigo)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
|
||||
show create table t1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def Table 253 64 2 N 1 31 7
|
||||
def Create Table 253 1024 445 N 1 31 7
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`Codigo` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`Nombre` varchar(255) DEFAULT NULL,
|
||||
`Telefono` varchar(255) DEFAULT NULL,
|
||||
`Observaciones` longtext,
|
||||
`Direccion` varchar(255) DEFAULT NULL,
|
||||
`Dni` varchar(255) DEFAULT NULL,
|
||||
`CP` int(11) DEFAULT NULL,
|
||||
`Provincia` varchar(255) DEFAULT NULL,
|
||||
`Poblacion` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`Codigo`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
SHOW AUTHORS;
|
||||
create database mysqltest;
|
||||
|
@ -1,7 +1,4 @@
|
||||
SET @start_value = @@global.slow_query_log_file;
|
||||
SELECT @start_value;
|
||||
@start_value
|
||||
slowtest.log
|
||||
'#---------------------FN_DYNVARS_004_01-------------------------#'
|
||||
SET @@global.slow_query_log_file = DEFAULT;
|
||||
SELECT RIGHT(@@global.slow_query_log_file,15);
|
||||
@ -17,3 +14,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE VARIABLE_NAME='slow_query_log_file';
|
||||
@@global.slow_query_log_file = VARIABLE_VALUE
|
||||
1
|
||||
SET @@global.slow_query_log_file= @start_value;
|
||||
|
@ -1,3 +1,3 @@
|
||||
'#--------------------FN_DYNVARS_018_01-------------------------#'
|
||||
## Checking if my_slow_test.log exist in servers datadir ##
|
||||
## Checking if my_slow_test.log exists in servers datadir ##
|
||||
## This case should pass because we have set this filename in opt file ##
|
||||
|
@ -6820,6 +6820,22 @@ ttt
|
||||
2
|
||||
drop function func30787;
|
||||
drop table t1;
|
||||
create table t1(c1 INT);
|
||||
create function f1(p1 int) returns varchar(32)
|
||||
return 'aaa';
|
||||
create view v1 as select f1(c1) as parent_control_name from t1;
|
||||
create procedure p1()
|
||||
begin
|
||||
select parent_control_name as c1 from v1;
|
||||
end //
|
||||
call p1();
|
||||
c1
|
||||
call p1();
|
||||
c1
|
||||
drop procedure p1;
|
||||
drop function f1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
# ------------------------------------------------------------------
|
||||
# -- End of 5.0 tests
|
||||
# ------------------------------------------------------------------
|
||||
|
@ -4409,4 +4409,43 @@ pk a
|
||||
3 30
|
||||
2 20
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a), KEY b (b));
|
||||
INSERT INTO t1 VALUES (1,NULL), (9,NULL);
|
||||
CREATE TABLE t2 (
|
||||
a int,
|
||||
b int,
|
||||
c int,
|
||||
d int,
|
||||
PRIMARY KEY (a),
|
||||
UNIQUE KEY b (b,c,d),
|
||||
KEY b_2 (b),
|
||||
KEY c (c),
|
||||
KEY d (d)
|
||||
);
|
||||
INSERT INTO t2 VALUES
|
||||
(43, 2, 11 ,30),
|
||||
(44, 2, 12 ,30),
|
||||
(45, 1, 1 ,10000),
|
||||
(46, 1, 2 ,10000),
|
||||
(556,1, 32 ,10000);
|
||||
CREATE TABLE t3 (
|
||||
a int,
|
||||
b int,
|
||||
c int,
|
||||
PRIMARY KEY (a),
|
||||
UNIQUE KEY b (b,c),
|
||||
KEY c (c),
|
||||
KEY b_2 (b)
|
||||
);
|
||||
INSERT INTO t3 VALUES (1,1,1), (2,32,1);
|
||||
explain
|
||||
SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t3 index b,b_2 b 10 NULL 2 Using index
|
||||
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.b 1 Using index
|
||||
2 DEPENDENT SUBQUERY t2 index b,b_2,c d 5 NULL 1 Using where
|
||||
SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
|
||||
a incorrect
|
||||
1 1
|
||||
DROP TABLE t1,t2,t3;
|
||||
End of 5.1 tests.
|
||||
|
@ -1,4 +1,4 @@
|
||||
drop table if exists t0, t1, t2, t3, t4;
|
||||
drop table if exists t0, t1, t2, t3, t4, t5;
|
||||
create table t1 (oref int, grp int, ie int) ;
|
||||
insert into t1 (oref, grp, ie) values
|
||||
(1, 1, 1),
|
||||
@ -780,3 +780,29 @@ SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
|
||||
1
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.0 tests
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (
|
||||
a int(11) default null,
|
||||
b int(11) default null,
|
||||
key (a)
|
||||
);
|
||||
insert into t1 select A.a+10*(B.a+10*C.a),A.a+10*(B.a+10*C.a) from t0 A, t0 B, t0 C;
|
||||
create table t2 (a int(11) default null);
|
||||
insert into t2 values (0),(1);
|
||||
create table t3 (a int(11) default null);
|
||||
insert into t3 values (0),(1);
|
||||
create table t4 (a int(11) default null);
|
||||
insert into t4 values (0),(1);
|
||||
create table t5 (a int(11) default null);
|
||||
insert into t5 values (0),(1),(0),(1);
|
||||
select * from t2, t3
|
||||
where
|
||||
t2.a < 10 and
|
||||
t3.a+1 = 2 and
|
||||
t3.a in (select t1.b from t1
|
||||
where t1.a+1=t1.a+1 and
|
||||
t1.a < (select t4.a+10
|
||||
from t4, t5 limit 2));
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
drop table t0, t1, t2, t3, t4, t5;
|
||||
|
@ -55,13 +55,9 @@ t9 CREATE TABLE `t9` (
|
||||
`d` int(11) NOT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
|
||||
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp";
|
||||
Got one of the listed errors
|
||||
create database mysqltest;
|
||||
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist";
|
||||
Got one of the listed errors
|
||||
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path";
|
||||
Got one of the listed errors
|
||||
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="MYSQLTEST_VARDIR/run";
|
||||
Got one of the listed errors
|
||||
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="MYSQLTEST_VARDIR/tmp";
|
||||
|
@ -19,6 +19,7 @@ a b
|
||||
THE LION 13
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status OK
|
||||
select trigger_schema, trigger_name, event_object_schema,
|
||||
event_object_table, action_statement from information_schema.triggers
|
||||
|
@ -684,6 +684,30 @@ SELECT 1 FROM t1 GROUP BY a;
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (b BIT NOT NULL, i2 INTEGER NOT NULL, s VARCHAR(255) NOT NULL);
|
||||
INSERT INTO t1 VALUES(0x01,100,''), (0x00,300,''), (0x01,200,''), (0x00,100,'');
|
||||
SELECT HEX(b), i2 FROM t1 WHERE (i2>=100 AND i2<201) AND b=TRUE;
|
||||
HEX(b) i2
|
||||
1 100
|
||||
1 200
|
||||
CREATE TABLE t2 (b1 BIT NOT NULL, b2 BIT NOT NULL, i2 INTEGER NOT NULL,
|
||||
s VARCHAR(255) NOT NULL);
|
||||
INSERT INTO t2 VALUES (0x01,0x00,100,''), (0x00,0x01,300,''),
|
||||
(0x01,0x00,200,''), (0x00,0x01,100,'');
|
||||
SELECT HEX(b1), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b1=TRUE;
|
||||
HEX(b1) i2
|
||||
1 100
|
||||
1 200
|
||||
SELECT HEX(b2), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b2=FALSE;
|
||||
HEX(b2) i2
|
||||
0 100
|
||||
0 200
|
||||
SELECT HEX(b1), HEX(b2), i2 FROM t2
|
||||
WHERE (i2>=100 AND i2<201) AND b1=TRUE AND b2=FALSE;
|
||||
HEX(b1) HEX(b2) i2
|
||||
1 0 100
|
||||
1 0 200
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.0 tests
|
||||
create table t1(a bit(7));
|
||||
insert into t1 values(0x40);
|
||||
|
@ -1529,6 +1529,11 @@ SELECT f1 FROM t1;
|
||||
f1
|
||||
99999999999999999999999999999.999999999999999999999999999999
|
||||
DROP TABLE t1;
|
||||
select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
|
||||
1.01500000 * 1.01500000 * 0.99500000);
|
||||
(1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
|
||||
1.01500000 * 1.01500000 * 0.99500000)
|
||||
0.812988073953673124592306939480
|
||||
End of 5.0 tests
|
||||
select cast(143.481 as decimal(4,1));
|
||||
cast(143.481 as decimal(4,1))
|
||||
|
@ -15,3 +15,4 @@ slave_skip_errors 3,100,137,643,1752
|
||||
---- Clean Up ----
|
||||
set global slave_net_timeout=default;
|
||||
set global sql_slave_skip_counter= 0;
|
||||
set @@global.slave_net_timeout= @my_slave_net_timeout;
|
||||
|
@ -15,6 +15,7 @@ set @my_max_heap_table_size =@@global.max_heap_table_size;
|
||||
set @my_max_insert_delayed_threads=@@global.max_insert_delayed_threads;
|
||||
set @my_max_join_size =@@global.max_join_size;
|
||||
set @my_myisam_data_pointer_size =@@global.myisam_data_pointer_size;
|
||||
set @my_myisam_max_sort_file_size =@@global.myisam_max_sort_file_size;
|
||||
set @my_net_buffer_length =@@global.net_buffer_length;
|
||||
set @my_net_write_timeout =@@global.net_write_timeout;
|
||||
set @my_net_read_timeout =@@global.net_read_timeout;
|
||||
@ -988,7 +989,7 @@ set global delayed_queue_size =@my_delayed_queue_size;
|
||||
set global flush =@my_flush;
|
||||
set global flush_time =@my_flush_time;
|
||||
set global key_buffer_size =@my_key_buffer_size;
|
||||
set global max_binlog_cache_size =default;
|
||||
set global max_binlog_cache_size =@my_max_binlog_cache_size;
|
||||
set global max_binlog_size =@my_max_binlog_size;
|
||||
set global max_connect_errors =@my_max_connect_errors;
|
||||
set global max_connections =@my_max_connections;
|
||||
@ -999,6 +1000,7 @@ set global max_join_size =@my_max_join_size;
|
||||
set global max_user_connections =default;
|
||||
set global max_write_lock_count =default;
|
||||
set global myisam_data_pointer_size =@my_myisam_data_pointer_size;
|
||||
set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size;
|
||||
set global net_buffer_length =@my_net_buffer_length;
|
||||
set global net_write_timeout =@my_net_write_timeout;
|
||||
set global net_read_timeout =@my_net_read_timeout;
|
||||
|
BIN
mysql-test/std_data/corrupt_t1#P#p1.MYI
Normal file
BIN
mysql-test/std_data/corrupt_t1#P#p1.MYI
Normal file
Binary file not shown.
BIN
mysql-test/std_data/corrupt_t1.MYI
Normal file
BIN
mysql-test/std_data/corrupt_t1.MYI
Normal file
Binary file not shown.
BIN
mysql-test/std_data/parts/t1_will_crash#P#p1_first_1024.MYD
Normal file
BIN
mysql-test/std_data/parts/t1_will_crash#P#p1_first_1024.MYD
Normal file
Binary file not shown.
BIN
mysql-test/std_data/parts/t1_will_crash#P#p2.MYD
Normal file
BIN
mysql-test/std_data/parts/t1_will_crash#P#p2.MYD
Normal file
Binary file not shown.
BIN
mysql-test/std_data/parts/t1_will_crash#P#p2.MYI
Normal file
BIN
mysql-test/std_data/parts/t1_will_crash#P#p2.MYI
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user