Commit d4b10d1f authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

merge

parents 09dfcfa1 cbb02487
...@@ -3072,6 +3072,9 @@ libmysqld/rpl_handler.cc ...@@ -3072,6 +3072,9 @@ libmysqld/rpl_handler.cc
libmysqld/debug_sync.cc libmysqld/debug_sync.cc
libmysqld/rpl_handler.cc libmysqld/rpl_handler.cc
dbug/tests dbug/tests
libmysqld/mdl.cc
client/transaction.h
libmysqld/transaction.cc
libmysqld/sys_vars.cc libmysqld/sys_vars.cc
libmysqld/keycaches.cc libmysqld/keycaches.cc
client/dtoa.c client/dtoa.c
......
...@@ -107,8 +107,9 @@ sql_src=log_event.h mysql_priv.h rpl_constants.h \ ...@@ -107,8 +107,9 @@ sql_src=log_event.h mysql_priv.h rpl_constants.h \
rpl_tblmap.h rpl_tblmap.cc \ rpl_tblmap.h rpl_tblmap.cc \
log_event.cc my_decimal.h my_decimal.cc \ log_event.cc my_decimal.h my_decimal.cc \
log_event_old.h log_event_old.cc \ log_event_old.h log_event_old.cc \
rpl_record_old.h rpl_record_old.cc \
rpl_utility.h rpl_utility.cc \ rpl_utility.h rpl_utility.cc \
rpl_record_old.h rpl_record_old.cc transaction.h
strings_src=decimal.c dtoa.c strings_src=decimal.c dtoa.c
link_sources: link_sources:
......
...@@ -191,10 +191,11 @@ enum ha_extra_function { ...@@ -191,10 +191,11 @@ enum ha_extra_function {
/* Inform handler that we will do a rename */ /* Inform handler that we will do a rename */
HA_EXTRA_PREPARE_FOR_RENAME, HA_EXTRA_PREPARE_FOR_RENAME,
/* /*
Orders MERGE handler to attach or detach its child tables. Used at Special actions for MERGE tables.
begin and end of a statement.
*/ */
HA_EXTRA_ADD_CHILDREN_LIST,
HA_EXTRA_ATTACH_CHILDREN, HA_EXTRA_ATTACH_CHILDREN,
HA_EXTRA_IS_ATTACHED_CHILDREN,
HA_EXTRA_DETACH_CHILDREN HA_EXTRA_DETACH_CHILDREN
}; };
......
...@@ -1681,7 +1681,7 @@ inline void operator delete[](void*, void*) { /* Do nothing */ } ...@@ -1681,7 +1681,7 @@ inline void operator delete[](void*, void*) { /* Do nothing */ }
#if !defined(max) #if !defined(max)
#define max(a, b) ((a) > (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b))
#endif #endif
/* /*
Only Linux is known to need an explicit sync of the directory to make sure a Only Linux is known to need an explicit sync of the directory to make sure a
file creation/deletion/renaming in(from,to) this directory durable. file creation/deletion/renaming in(from,to) this directory durable.
...@@ -1694,6 +1694,25 @@ inline void operator delete[](void*, void*) { /* Do nothing */ } ...@@ -1694,6 +1694,25 @@ inline void operator delete[](void*, void*) { /* Do nothing */ }
#define bool In_C_you_should_use_my_bool_instead() #define bool In_C_you_should_use_my_bool_instead()
#endif #endif
/* Provide __func__ macro definition for platforms that miss it. */
#if __STDC_VERSION__ < 199901L
# if __GNUC__ >= 2
# define __func__ __FUNCTION__
# else
# define __func__ "<unknown>"
# endif
#elif defined(_MSC_VER)
# if _MSC_VER < 1300
# define __func__ "<unknown>"
# else
# define __func__ __FUNCTION__
# endif
#elif defined(__BORLANDC__)
# define __func__ __FUNC__
#else
# define __func__ "<unknown>"
#endif
#ifndef HAVE_RINT #ifndef HAVE_RINT
/** /**
All integers up to this number can be represented exactly as double precision All integers up to this number can be represented exactly as double precision
......
...@@ -102,6 +102,19 @@ struct timespec { ...@@ -102,6 +102,19 @@ struct timespec {
(ABSTIME).max_timeout_msec= (long)((NSEC)/1000000); \ (ABSTIME).max_timeout_msec= (long)((NSEC)/1000000); \
} }
/**
Compare two timespec structs.
@retval 1 If TS1 ends after TS2.
@retval 0 If TS1 is equal to TS2.
@retval -1 If TS1 ends before TS2.
*/
#define cmp_timespec(TS1, TS2) \
((TS1.tv.i64 > TS2.tv.i64) ? 1 : \
((TS1.tv.i64 < TS2.tv.i64) ? -1 : 0))
int win_pthread_mutex_trylock(pthread_mutex_t *mutex); int win_pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *); int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *);
...@@ -415,6 +428,33 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex); ...@@ -415,6 +428,33 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
(ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \ (ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
} }
#endif /* !set_timespec_nsec */ #endif /* !set_timespec_nsec */
#endif /* HAVE_TIMESPEC_TS_SEC */
/**
Compare two timespec structs.
@retval 1 If TS1 ends after TS2.
@retval 0 If TS1 is equal to TS2.
@retval -1 If TS1 ends before TS2.
*/
#ifdef HAVE_TIMESPEC_TS_SEC
#ifndef cmp_timespec
#define cmp_timespec(TS1, TS2) \
((TS1.ts_sec > TS2.ts_sec || \
(TS1.ts_sec == TS2.ts_sec && TS1.ts_nsec > TS2.ts_nsec)) ? 1 : \
((TS1.ts_sec < TS2.ts_sec || \
(TS1.ts_sec == TS2.ts_sec && TS1.ts_nsec < TS2.ts_nsec)) ? -1 : 0))
#endif /* !cmp_timespec */
#else
#ifndef cmp_timespec
#define cmp_timespec(TS1, TS2) \
((TS1.tv_sec > TS2.tv_sec || \
(TS1.tv_sec == TS2.tv_sec && TS1.tv_nsec > TS2.tv_nsec)) ? 1 : \
((TS1.tv_sec < TS2.tv_sec || \
(TS1.tv_sec == TS2.tv_sec && TS1.tv_nsec < TS2.tv_nsec)) ? -1 : 0))
#endif /* !cmp_timespec */
#endif /* HAVE_TIMESPEC_TS_SEC */ #endif /* HAVE_TIMESPEC_TS_SEC */
/* safe_mutex adds checking to mutex for easier debugging */ /* safe_mutex adds checking to mutex for easier debugging */
......
...@@ -238,6 +238,9 @@ extern void (*fatal_error_handler_hook)(uint my_err, const char *str, ...@@ -238,6 +238,9 @@ extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
extern uint my_file_limit; extern uint my_file_limit;
extern ulong my_thread_stack_size; extern ulong my_thread_stack_size;
extern const char *(*proc_info_hook)(void *, const char *, const char *,
const char *, const unsigned int);
#ifdef HAVE_LARGE_PAGES #ifdef HAVE_LARGE_PAGES
extern my_bool my_use_large_pages; extern my_bool my_use_large_pages;
extern uint my_large_page_size; extern uint my_large_page_size;
......
...@@ -83,7 +83,6 @@ enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1, ...@@ -83,7 +83,6 @@ enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1,
extern ulong max_write_lock_count; extern ulong max_write_lock_count;
extern ulong table_lock_wait_timeout;
extern my_bool thr_lock_inited; extern my_bool thr_lock_inited;
extern enum thr_lock_type thr_upgraded_concurrent_insert_lock; extern enum thr_lock_type thr_upgraded_concurrent_insert_lock;
...@@ -156,19 +155,25 @@ void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data, ...@@ -156,19 +155,25 @@ void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data,
void *status_param); void *status_param);
enum enum_thr_lock_result thr_lock(THR_LOCK_DATA *data, enum enum_thr_lock_result thr_lock(THR_LOCK_DATA *data,
THR_LOCK_OWNER *owner, THR_LOCK_OWNER *owner,
enum thr_lock_type lock_type); enum thr_lock_type lock_type,
ulong lock_wait_timeout);
void thr_unlock(THR_LOCK_DATA *data); void thr_unlock(THR_LOCK_DATA *data);
enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data, enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
uint count, THR_LOCK_OWNER *owner); uint count, THR_LOCK_OWNER *owner,
ulong lock_wait_timeout);
void thr_multi_unlock(THR_LOCK_DATA **data,uint count); void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
void
thr_lock_merge_status(THR_LOCK_DATA **data, uint count);
void thr_abort_locks(THR_LOCK *lock, my_bool upgrade_lock); void thr_abort_locks(THR_LOCK *lock, my_bool upgrade_lock);
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread); my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread);
void thr_print_locks(void); /* For debugging */ void thr_print_locks(void); /* For debugging */
my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data, my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data,
enum thr_lock_type new_lock_type); enum thr_lock_type new_lock_type,
ulong lock_wait_timeout);
void thr_downgrade_write_lock(THR_LOCK_DATA *data, void thr_downgrade_write_lock(THR_LOCK_DATA *data,
enum thr_lock_type new_lock_type); enum thr_lock_type new_lock_type);
my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data); my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data,
ulong lock_wait_timeout);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -81,9 +81,10 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ...@@ -81,9 +81,10 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/scheduler.cc ../sql/sql_audit.cc ../sql/scheduler.cc ../sql/sql_audit.cc
../sql/event_parse_data.cc ../sql/event_parse_data.cc
../sql/sql_signal.cc ../sql/rpl_handler.cc ../sql/sql_signal.cc ../sql/rpl_handler.cc
../sql/rpl_utility.cc ../sql/rpl_utility.cc
../sql/sys_vars.cc ../sql/sys_vars.cc
${CMAKE_BINARY_DIR}/sql/sql_builtin.cc ${CMAKE_BINARY_DIR}/sql/sql_builtin.cc
../sql/mdl.cc ../sql/transaction.cc
${GEN_SOURCES} ${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE} ${MYSYS_LIBWRAP_SOURCE}
) )
......
...@@ -75,11 +75,10 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ ...@@ -75,11 +75,10 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \ sp_head.cc sp_pcontext.cc sp.cc sp_cache.cc sp_rcontext.cc \
parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \ parse_file.cc sql_view.cc sql_trigger.cc my_decimal.cc \
rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \ rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \
debug_sync.cc \ debug_sync.cc sql_tablespace.cc transaction.cc \
sql_tablespace.cc \
rpl_injector.cc my_user.c partition_info.cc \ rpl_injector.cc my_user.c partition_info.cc \
sql_servers.cc sql_audit.cc event_parse_data.cc \ sql_servers.cc event_parse_data.cc sql_signal.cc \
sql_signal.cc rpl_handler.cc keycaches.cc rpl_handler.cc mdl.cc keycaches.cc sql_audit.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources) libmysqld_int_a_SOURCES= $(libmysqld_sources)
nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources) nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources)
......
#
# Bug#989: If DROP TABLE while there's an active transaction, wrong binlog order
#
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
RESET MASTER;
CREATE TABLE t1 (a INT);
SET AUTOCOMMIT=OFF;
BEGIN;
INSERT INTO t1 VALUES(1);
connection con2;
--send DROP TABLE t1;
connection con1;
COMMIT;
connection con2;
--reap
connection default;
--disconnect con1
--disconnect con2
let $VERSION=`select version()`;
source include/show_binlog_events.inc;
...@@ -205,6 +205,10 @@ select (@after:=unix_timestamp())*0; # always give repeatable output ...@@ -205,6 +205,10 @@ select (@after:=unix_timestamp())*0; # always give repeatable output
# the bug, the reap would return immediately after the insert into t2. # the bug, the reap would return immediately after the insert into t2.
select (@after-@before) >= 2; select (@after-@before) >= 2;
connection con3;
commit;
connection con2;
drop table t1,t2; drop table t1,t2;
commit; commit;
......
...@@ -118,6 +118,71 @@ connection master; ...@@ -118,6 +118,71 @@ connection master;
FLUSH LOGS; FLUSH LOGS;
DROP DATABASE mysqltest1; DROP DATABASE mysqltest1;
-- source include/master-slave-end.inc
--echo End of 5.1 tests --echo End of 5.1 tests
--echo #
--echo # Bug#39675 rename tables on innodb tables with pending
--echo # transactions causes slave data issue.
--echo #
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
--enable_warnings
CREATE TABLE t1 (
id INT PRIMARY KEY auto_increment,
b INT DEFAULT NULL
) ENGINE=InnoDB;
CREATE TABLE t2 (
id INT PRIMARY KEY auto_increment,
b INT DEFAULT NULL
) ENGINE=InnoDB;
INSERT INTO t1 (b) VALUES (1),(2),(3);
BEGIN;
INSERT INTO t1(b) VALUES (4);
--echo -------- switch to master1 --------
connection master1;
--send RENAME TABLE t1 TO t3, t2 TO t1;
--echo -------- switch to master --------
connection master;
# Need to wait until RENAME is received
let $wait_condition=
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE info = "RENAME TABLE t1 TO t3, t2 TO t1" and
state = "Waiting for table";
--source include/wait_condition.inc
COMMIT;
--echo -------- switch to master1 --------
connection master1;
--reap
--echo -------- switch to master --------
connection master;
SELECT * FROM t1;
SELECT * FROM t3;
sync_slave_with_master;
--echo -------- switch to slave --------
connection slave;
SELECT * FROM t1;
SELECT * FROM t3;
--echo -------- switch to master --------
connection master;
DROP TABLE t1;
DROP TABLE t3;
--echo End of 6.0 tests
--source include/master-slave-end.inc
...@@ -729,15 +729,15 @@ call p_verify_status_increment(2, 0, 4, 4); ...@@ -729,15 +729,15 @@ call p_verify_status_increment(2, 0, 4, 4);
alter table t3 add column (b int); alter table t3 add column (b int);
call p_verify_status_increment(2, 0, 2, 0); call p_verify_status_increment(2, 0, 2, 0);
alter table t3 rename t4; alter table t3 rename t4;
call p_verify_status_increment(1, 0, 1, 0); call p_verify_status_increment(2, 0, 2, 0);
rename table t4 to t3; rename table t4 to t3;
call p_verify_status_increment(1, 0, 1, 0); call p_verify_status_increment(0, 0, 0, 0);
truncate table t3; truncate table t3;
call p_verify_status_increment(2, 0, 2, 0); call p_verify_status_increment(2, 0, 2, 0);
create view v1 as select * from t2; create view v1 as select * from t2;
call p_verify_status_increment(1, 0, 1, 0); call p_verify_status_increment(2, 0, 2, 0);
check table t1; check table t1;
call p_verify_status_increment(3, 0, 3, 0); call p_verify_status_increment(2, 0, 2, 0);
--echo # Sic: after this bug is fixed, CHECK leaves no pending transaction --echo # Sic: after this bug is fixed, CHECK leaves no pending transaction
commit; commit;
call p_verify_status_increment(0, 0, 0, 0); call p_verify_status_increment(0, 0, 0, 0);
......
This diff is collapsed.
INSERT INTO db1.trans (a) VALUES (1);
--disable_result_log
eval $statement;
--enable_result_log
CALL db1.test_if_commit();
...@@ -899,6 +899,8 @@ CREATE PROCEDURE p1 () ...@@ -899,6 +899,8 @@ CREATE PROCEDURE p1 ()
BEGIN BEGIN
DECLARE i INT DEFAULT 50; DECLARE i INT DEFAULT 50;
DECLARE cnt INT; DECLARE cnt INT;
# Continue even in the presence of ER_LOCK_DEADLOCK.
DECLARE CONTINUE HANDLER FOR 1213 BEGIN END;
START TRANSACTION; START TRANSACTION;
ALTER TABLE t1 ENGINE=InnoDB; ALTER TABLE t1 ENGINE=InnoDB;
COMMIT; COMMIT;
...@@ -1392,6 +1394,7 @@ SELECT * FROM t1; ...@@ -1392,6 +1394,7 @@ SELECT * FROM t1;
connection con2; connection con2;
--reap --reap
SELECT * FROM t1; SELECT * FROM t1;
COMMIT;
--echo # Switch to connection con1 --echo # Switch to connection con1
connection con1; connection con1;
......
...@@ -1994,6 +1994,7 @@ commit; ...@@ -1994,6 +1994,7 @@ commit;
connection b; connection b;
set autocommit = 0; set autocommit = 0;
update t1 set b = 5 where a = 2; update t1 set b = 5 where a = 2;
commit;
connection a; connection a;
delimiter |; delimiter |;
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end | create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
...@@ -2056,6 +2057,7 @@ update t2 set b = b + 5 where a = 1; ...@@ -2056,6 +2057,7 @@ update t2 set b = b + 5 where a = 1;
update t3 set b = b + 5 where a = 1; update t3 set b = b + 5 where a = 1;
update t4 set b = b + 5 where a = 1; update t4 set b = b + 5 where a = 1;
insert into t5(a) values(20); insert into t5(a) values(20);
commit;
connection b; connection b;
set autocommit = 0; set autocommit = 0;
insert into t1(a) values(7); insert into t1(a) values(7);
......
...@@ -194,6 +194,14 @@ INSERT INTO global_suppressions VALUES ...@@ -194,6 +194,14 @@ INSERT INTO global_suppressions VALUES
("Slave I/O: Get master COLLATION_SERVER failed with error:.*"), ("Slave I/O: Get master COLLATION_SERVER failed with error:.*"),
("Slave I/O: Get master TIME_ZONE failed with error:.*"), ("Slave I/O: Get master TIME_ZONE failed with error:.*"),
/*
BUG#42147 - Concurrent DML and LOCK TABLE ... READ for InnoDB
table cause warnings in errlog
Note: This is a temporary suppression until Bug#42147 can be
fixed properly. See bug page for more information.
*/
("Found lock of type 6 that is write and read locked"),
("THE_LAST_SUPPRESSION")|| ("THE_LAST_SUPPRESSION")||
......
...@@ -376,6 +376,9 @@ sub mtr_report_stats ($) { ...@@ -376,6 +376,9 @@ sub mtr_report_stats ($) {
/Slave: Can't DROP 'c7'.* 1091/ or /Slave: Can't DROP 'c7'.* 1091/ or
/Slave: Key column 'c6'.* 1072/ or /Slave: Key column 'c6'.* 1072/ or
# Warnings generated until bug#42147 is properly resolved
/Found lock of type 6 that is write and read locked/ or
# rpl_idempotency.test produces warnings for the slave. # rpl_idempotency.test produces warnings for the slave.
($testname eq 'rpl.rpl_idempotency' and ($testname eq 'rpl.rpl_idempotency' and
(/Slave: Can\'t find record in \'t1\' Error_code: 1032/ or (/Slave: Can\'t find record in \'t1\' Error_code: 1032/ or
......
...@@ -842,11 +842,11 @@ call p_verify_status_increment(2, 0, 2, 0); ...@@ -842,11 +842,11 @@ call p_verify_status_increment(2, 0, 2, 0);
SUCCESS SUCCESS
alter table t3 rename t4; alter table t3 rename t4;
call p_verify_status_increment(1, 0, 1, 0); call p_verify_status_increment(2, 0, 2, 0);
SUCCESS SUCCESS
rename table t4 to t3; rename table t4 to t3;
call p_verify_status_increment(1, 0, 1, 0); call p_verify_status_increment(0, 0, 0, 0);
SUCCESS SUCCESS
truncate table t3; truncate table t3;
...@@ -854,13 +854,13 @@ call p_verify_status_increment(2, 0, 2, 0); ...@@ -854,13 +854,13 @@ call p_verify_status_increment(2, 0, 2, 0);
SUCCESS SUCCESS
create view v1 as select * from t2; create view v1 as select * from t2;
call p_verify_status_increment(1, 0, 1, 0); call p_verify_status_increment(2, 0, 2, 0);
SUCCESS SUCCESS
check table t1; check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
call p_verify_status_increment(3, 0, 3, 0); call p_verify_status_increment(2, 0, 2, 0);
SUCCESS SUCCESS
# Sic: after this bug is fixed, CHECK leaves no pending transaction # Sic: after this bug is fixed, CHECK leaves no pending transaction
......
...@@ -785,7 +785,7 @@ drop table t1; ...@@ -785,7 +785,7 @@ drop table t1;
create table t1 select * from t2; create table t1 select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist ERROR 42S02: Table 'test.t2' doesn't exist
create table t1 select * from t1; create table t1 select * from t1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause ERROR 42S02: Table 'test.t1' doesn't exist
create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin); create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'coalesce' ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'coalesce'
create table t1 (primary key(a)) select "b" as b; create table t1 (primary key(a)) select "b" as b;
...@@ -805,6 +805,11 @@ Note 1050 Table 't1' already exists ...@@ -805,6 +805,11 @@ Note 1050 Table 't1' already exists
select * from t1; select * from t1;
i i
1 1
create table if not exists t1 select * from t1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause
select * from t1;
i
1
create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin); create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'coalesce' ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'coalesce'
select * from t1; select * from t1;
...@@ -1953,3 +1958,22 @@ END ;| ...@@ -1953,3 +1958,22 @@ END ;|
ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
DROP TABLE t1; DROP TABLE t1;
DROP TABLE B; DROP TABLE B;
#
# Bug #47107 assert in notify_shared_lock on incorrect
# CREATE TABLE , HANDLER
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(f1 integer);
# The following CREATE TABLEs before gave an assert.
HANDLER t1 OPEN AS A;
CREATE TABLE t1 SELECT 1 AS f2;
ERROR 42S01: Table 't1' already exists
HANDLER t1 OPEN AS A;
CREATE TABLE t1(f1 integer);
ERROR 42S01: Table 't1' already exists
CREATE TABLE t2(f1 integer);
HANDLER t1 OPEN AS A;
CREATE TABLE t1 LIKE t2;
ERROR 42S01: Table 't1' already exists
DROP TABLE t2;
DROP TABLE t1;
...@@ -263,7 +263,7 @@ DROP TABLE t1; ...@@ -263,7 +263,7 @@ DROP TABLE t1;
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT); CREATE TABLE t1 (c1 INT);
LOCK TABLE t1 WRITE; LOCK TABLE t1 READ;
connection con1 connection con1
SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2'; SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
......
...@@ -79,8 +79,8 @@ drop table t1; ...@@ -79,8 +79,8 @@ drop table t1;
drop database if exists mysqltest; drop database if exists mysqltest;
drop table if exists t1; drop table if exists t1;
create table t1 (i int); create table t1 (i int);
lock tables t1 read;
create database mysqltest; create database mysqltest;
lock tables t1 read;
drop table t1; drop table t1;
show open tables; show open tables;
drop database mysqltest; drop database mysqltest;
......
...@@ -7,12 +7,16 @@ DROP DATABASE IF EXISTS mysql_test; ...@@ -7,12 +7,16 @@ DROP DATABASE IF EXISTS mysql_test;
CREATE DATABASE mysql_test; CREATE DATABASE mysql_test;
CREATE TABLE mysql_test.t1(a INT); CREATE TABLE mysql_test.t1(a INT);
CREATE TABLE mysql_test.t2(b INT);
CREATE TABLE mysql_test.t3(c INT);
SET SESSION DEBUG = "+d,bug43138"; SET SESSION DEBUG = "+d,bug43138";
DROP DATABASE mysql_test; DROP DATABASE mysql_test;
Warnings: Warnings:
Error 1051 Unknown table 't1' Error 1051 Unknown table 't1'
Error 1051 Unknown table 't2'
Error 1051 Unknown table 't3'
SET SESSION DEBUG = "-d,bug43138"; SET SESSION DEBUG = "-d,bug43138";
......
...@@ -33,6 +33,9 @@ flush tables with read lock; ...@@ -33,6 +33,9 @@ flush tables with read lock;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
lock table t1 read; lock table t1 read;
flush tables with read lock; flush tables with read lock;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables;
flush tables with read lock;
lock table t1 write; lock table t1 write;
ERROR HY000: Can't execute the query because you have a conflicting read lock ERROR HY000: Can't execute the query because you have a conflicting read lock
lock table t1 read; lock table t1 read;
...@@ -46,6 +49,7 @@ flush tables with read lock; ...@@ -46,6 +49,7 @@ flush tables with read lock;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
lock table t1 read, t2 read, t3 read; lock table t1 read, t2 read, t3 read;
flush tables with read lock; flush tables with read lock;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables; unlock tables;
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (c1 int); create table t1 (c1 int);
...@@ -69,6 +73,7 @@ ERROR HY000: Can't execute the given command because you have active locked tabl ...@@ -69,6 +73,7 @@ ERROR HY000: Can't execute the given command because you have active locked tabl
unlock tables; unlock tables;
lock tables t1 read; lock tables t1 read;
flush tables with read lock; flush tables with read lock;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
unlock tables; unlock tables;
drop table t1, t2; drop table t1, t2;
set session low_priority_updates=default; set session low_priority_updates=default;
...@@ -89,3 +94,20 @@ unlock tables; ...@@ -89,3 +94,20 @@ unlock tables;
set global general_log= @old_general_log; set global general_log= @old_general_log;
set global read_only= @old_read_only; set global read_only= @old_read_only;
End of 5.1 tests End of 5.1 tests
#
# Additional test for bug #51136 "Crash in pthread_rwlock_rdlock
# on TEMPORARY + HANDLER + LOCK + SP".
# Also see the main test for this bug in include/handler.inc.
#
drop tables if exists t1, t2;
create table t1 (i int);
create temporary table t2 (j int);
flush tables with read lock;
lock table t2 read;
# This commit should not release any MDL locks.
commit;
# The below statement crashed before the bug fix as it
# has attempted to release global shared metadata lock
# which was already released by commit.
unlock tables;
drop tables t1, t2;
# Save the initial number of concurrent sessions
# Establish connection con1 (user=root) # Establish connection con1 (user=root)
# Establish connection con2 (user=root) # Establish connection con2 (user=root)
# Establish connection con3 (user=root) # Establish connection con3 (user=root)
...@@ -8,15 +9,17 @@ BEGIN; ...@@ -8,15 +9,17 @@ BEGIN;
INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(1);
# Switch to connection con2 # Switch to connection con2
FLUSH TABLES WITH READ LOCK; FLUSH TABLES WITH READ LOCK;
SELECT * FROM t1;
a
# Switch to connection con1 # Switch to connection con1
# Sending:
COMMIT; COMMIT;
# Switch to connection con2 # Switch to connection con2
# Wait until COMMIT gets blocked.
# Verify that 'con1' was blocked and data did not move.
SELECT * FROM t1; SELECT * FROM t1;
a a
UNLOCK TABLES; UNLOCK TABLES;
# Switch to connection con1 # Switch to connection con1
# Reaping COMMIT
# Switch to connection con1 # Switch to connection con1
BEGIN; BEGIN;
SELECT * FROM t1 FOR UPDATE; SELECT * FROM t1 FOR UPDATE;
...@@ -32,6 +35,7 @@ COMMIT; ...@@ -32,6 +35,7 @@ COMMIT;
# Switch to connection con2 # Switch to connection con2
a a
1 1
COMMIT;
# Switch to connection con3 # Switch to connection con3
UNLOCK TABLES; UNLOCK TABLES;
# Switch to connection con2 # Switch to connection con2
...@@ -40,8 +44,6 @@ COMMIT; ...@@ -40,8 +44,6 @@ COMMIT;
BEGIN; BEGIN;
INSERT INTO t1 VALUES(10); INSERT INTO t1 VALUES(10);
FLUSH TABLES WITH READ LOCK; FLUSH TABLES WITH READ LOCK;
COMMIT;
UNLOCK TABLES;
# Switch to connection con2 # Switch to connection con2
FLUSH TABLES WITH READ LOCK; FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES; UNLOCK TABLES;
...@@ -53,5 +55,11 @@ a ...@@ -53,5 +55,11 @@ a
SHOW CREATE DATABASE test; SHOW CREATE DATABASE test;
Database Create Database Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
DROP TABLE t1; COMMIT;
# Cleanup
# Switch to connection default and close connections con1, con2, con3 # Switch to connection default and close connections con1, con2, con3
# We commit open transactions when we disconnect: only then we can
# drop the table.
DROP TABLE t1;
# End of 4.1 tests
# Wait till all disconnects are completed
# Save the initial number of concurrent sessions
# Establish connection con1 (user=root) # Establish connection con1 (user=root)
# Establish connection con2 (user=root) # Establish connection con2 (user=root)
# Switch to connection con1 # Switch to connection con1
CREATE TABLE t1 (a INT) ENGINE=innodb; CREATE TABLE t1 (a INT) ENGINE=innodb;
RESET MASTER; RESET MASTER;
SET AUTOCOMMIT=0; SET AUTOCOMMIT=0;
INSERT t1 VALUES (1); SELECT 1;
1
1
# Switch to connection con2 # Switch to connection con2
FLUSH TABLES WITH READ LOCK; FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS; SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 107 master-bin.000001 107
# Switch to connection con1 # Switch to connection con1
COMMIT; INSERT INTO t1 VALUES (1);
# Switch to connection con2 # Switch to connection con2
SHOW MASTER STATUS; SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
...@@ -20,4 +23,12 @@ UNLOCK TABLES; ...@@ -20,4 +23,12 @@ UNLOCK TABLES;
# Switch to connection con1 # Switch to connection con1
DROP TABLE t1; DROP TABLE t1;
SET AUTOCOMMIT=1; SET AUTOCOMMIT=1;
create table t1 (a int) engine=innodb;
flush tables with read lock;
begin;
insert into t1 values (1);;
unlock tables;
commit;
drop table t1;
# Switch to connection default and close connections con1 and con2 # Switch to connection default and close connections con1 and con2
# Wait till all disconnects are completed
...@@ -3,21 +3,14 @@ create table t1 (a int not null auto_increment primary key); ...@@ -3,21 +3,14 @@ create table t1 (a int not null auto_increment primary key);
insert into t1 values(0); insert into t1 values(0);
lock table t1 read; lock table t1 read;
flush table t1; flush table t1;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
unlock tables;
lock table t1 write;
flush table t1;
check table t1; check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
unlock tables; unlock tables;
lock table t1 read;
lock table t1 read;
flush table t1;
select * from t1;
a
1
unlock tables;
select * from t1;
a
1
unlock tables;
lock table t1 write; lock table t1 write;
lock table t1 read; lock table t1 read;
flush table t1; flush table t1;
...@@ -26,7 +19,7 @@ a ...@@ -26,7 +19,7 @@ a
1 1
unlock tables; unlock tables;
unlock tables; unlock tables;
lock table t1 read; lock table t1 write;
lock table t1 write; lock table t1 write;
flush table t1; flush table t1;
select * from t1; select * from t1;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -1682,6 +1682,57 @@ DROP USER nonpriv; ...@@ -1682,6 +1682,57 @@ DROP USER nonpriv;
DROP TABLE db1.t1; DROP TABLE db1.t1;
DROP DATABASE db1; DROP DATABASE db1;
End of 5.1 tests. End of 5.1 tests.
#
# Additional test for WL#3726 "DDL locking for all metadata objects"
# To avoid possible deadlocks process of filling of I_S tables should
# use high-priority metadata lock requests when opening tables.
# Below we just test that we really use high-priority lock request
# since reproducing a deadlock will require much more complex test.
#
drop tables if exists t1, t2, t3;
create table t1 (i int);
create table t2 (j int primary key auto_increment);
# Switching to connection 'con3726_1'
lock table t2 read;
# Switching to connection 'con3726_2'
# RENAME below will be blocked by 'lock table t2 read' above but
# will add two pending requests for exclusive metadata locks.
rename table t2 to t3;
# Switching to connection 'default'
# These statements should not be blocked by pending lock requests
select table_name, column_name, data_type from information_schema.columns
where table_schema = 'test' and table_name in ('t1', 't2');
table_name column_name data_type
t1 i int
t2 j int
select table_name, auto_increment from information_schema.tables
where table_schema = 'test' and table_name in ('t1', 't2');
table_name auto_increment
t1 NULL
t2 1
# Switching to connection 'con3726_1'
unlock tables;
# Switching to connection 'con3726_2'
# Switching to connection 'default'
drop tables t1, t3;
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE KEY_COLUMN_USAGE ALL NULL NULL NULL NULL NULL Open_full_table; Scanned all databases
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME='t1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE PARTITIONS ALL NULL TABLE_NAME NULL NULL NULL Using where; Open_full_table; Scanned 1 database
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA='test';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE REFERENTIAL_CONSTRAINTS ALL NULL CONSTRAINT_SCHEMA NULL NULL NULL Using where; Open_full_table; Scanned 1 database
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE TABLE_NAME='t1' and TABLE_SCHEMA='test';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE TABLE_CONSTRAINTS ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Using where; Open_full_table; Scanned 0 databases
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
WHERE EVENT_OBJECT_SCHEMA='test';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE TRIGGERS ALL NULL EVENT_OBJECT_SCHEMA NULL NULL NULL Using where; Open_frm_only; Scanned 1 database
create table information_schema.t1 (f1 INT); create table information_schema.t1 (f1 INT);
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
drop table information_schema.t1; drop table information_schema.t1;
...@@ -1720,28 +1771,10 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_ ...@@ -1720,28 +1771,10 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
LOCK TABLES t1 READ, information_schema.tables READ; LOCK TABLES t1 READ, information_schema.tables READ;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP TABLE t1; DROP TABLE t1;
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE KEY_COLUMN_USAGE ALL NULL NULL NULL NULL NULL Open_full_table; Scanned all databases
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME='t1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE PARTITIONS ALL NULL TABLE_NAME NULL NULL NULL Using where; Open_full_table; Scanned 1 database
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
WHERE CONSTRAINT_SCHEMA='test';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE REFERENTIAL_CONSTRAINTS ALL NULL CONSTRAINT_SCHEMA NULL NULL NULL Using where; Open_full_table; Scanned 1 database
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE TABLE_NAME='t1' and TABLE_SCHEMA='test';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE TABLE_CONSTRAINTS ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL Using where; Open_full_table; Scanned 0 databases
EXPLAIN SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
WHERE EVENT_OBJECT_SCHEMA='test';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE TRIGGERS ALL NULL EVENT_OBJECT_SCHEMA NULL NULL NULL Using where; Open_frm_only; Scanned 1 database
SELECT * SELECT *
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
LEFT JOIN INFORMATION_SCHEMA.COLUMNS LEFT JOIN INFORMATION_SCHEMA.COLUMNS
USING (TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME) USING (TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME)
WHERE COLUMNS.TABLE_SCHEMA = 'test' WHERE COLUMNS.TABLE_SCHEMA = 'test'
AND COLUMNS.TABLE_NAME = 't1'; AND COLUMNS.TABLE_NAME = 't1';
TABLE_SCHEMA TABLE_NAME COLUMN_NAME CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME TABLE_CATALOG 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 TABLE_SCHEMA TABLE_NAME COLUMN_NAME CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME TABLE_CATALOG 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
...@@ -25,6 +25,12 @@ id x ...@@ -25,6 +25,12 @@ id x
0 2 0 2
commit; commit;
drop table t1; drop table t1;
#
# Old lock method (where LOCK TABLE was ignored by InnoDB) no longer
# works due to fix for bugs #46272 "MySQL 5.4.4, new MDL: unnecessary
# deadlock" and bug #37346 "innodb does not detect deadlock between
# update and alter table".
#
set @@innodb_table_locks=0; set @@innodb_table_locks=0;
create table t1 (id integer primary key, x integer) engine=INNODB; create table t1 (id integer primary key, x integer) engine=INNODB;
insert into t1 values(0, 0),(1,1),(2,2); insert into t1 values(0, 0),(1,1),(2,2);
...@@ -32,26 +38,27 @@ commit; ...@@ -32,26 +38,27 @@ commit;
SELECT * from t1 where id = 0 FOR UPDATE; SELECT * from t1 where id = 0 FOR UPDATE;
id x id x
0 0 0 0
# Connection 'con2'.
set autocommit=0; set autocommit=0;
set @@innodb_table_locks=0; set @@innodb_table_locks=0;
lock table t1 write; # The following statement should block because SQL-level lock
update t1 set x=10 where id = 2; # is taken on t1 which will wait until concurrent transaction
SELECT * from t1 where id = 2; # is commited.
id x # Sending:
2 2 lock table t1 write;;
UPDATE t1 set x=3 where id = 2; # Connection 'con1'.
commit; # Wait until LOCK TABLE is blocked on SQL-level lock.
SELECT * from t1; # We should be able to do UPDATEs and SELECTs within transaction.
update t1 set x=1 where id = 0;
select * from t1;
id x id x
0 0 0 1
1 1 1 1
2 3 2 2
# Unblock LOCK TABLE.
commit; commit;
# Connection 'con2'.
# Reap LOCK TABLE.
unlock tables; unlock tables;
commit; # Connection 'con1'.
select * from t1;
id x
0 0
1 1
2 10
drop table t1; drop table t1;
...@@ -2834,10 +2834,10 @@ t2 CREATE TABLE `t2` ( ...@@ -2834,10 +2834,10 @@ t2 CREATE TABLE `t2` (
DROP TABLE t2,t1; DROP TABLE t2,t1;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
insert into t1(a) values (1),(2),(3); insert into t1(a) values (1),(2),(3);
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
commit; commit;
set autocommit = 0; set autocommit = 0;
update t1 set b = 5 where a = 2; update t1 set b = 5 where a = 2;
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
set autocommit = 0; set autocommit = 0;
insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100), insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
(11),(21),(31),(41),(51),(61),(71),(81),(91),(101), (11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
...@@ -2885,6 +2885,7 @@ insert into t2(a) values(8); ...@@ -2885,6 +2885,7 @@ insert into t2(a) values(8);
delete from t2 where a = 3; delete from t2 where a = 3;
update t4 set b = b + 1 where a = 3; update t4 set b = b + 1 where a = 3;
commit; commit;
commit;
drop trigger t1t; drop trigger t1t;
drop trigger t2t; drop trigger t2t;
drop trigger t3t; drop trigger t3t;
......
...@@ -1105,6 +1105,8 @@ CREATE PROCEDURE p1 () ...@@ -1105,6 +1105,8 @@ CREATE PROCEDURE p1 ()
BEGIN BEGIN
DECLARE i INT DEFAULT 50; DECLARE i INT DEFAULT 50;
DECLARE cnt INT; DECLARE cnt INT;
# Continue even in the presence of ER_LOCK_DEADLOCK.
DECLARE CONTINUE HANDLER FOR 1213 BEGIN END;
START TRANSACTION; START TRANSACTION;
ALTER TABLE t1 ENGINE=InnoDB; ALTER TABLE t1 ENGINE=InnoDB;
COMMIT; COMMIT;
...@@ -1618,6 +1620,7 @@ a b ...@@ -1618,6 +1620,7 @@ a b
SELECT * FROM t1; SELECT * FROM t1;
a b a b
1 init+con1+con2 1 init+con1+con2
COMMIT;
# Switch to connection con1 # Switch to connection con1
# 3. test for updated key column: # 3. test for updated key column:
TRUNCATE t1; TRUNCATE t1;
......
This diff is collapsed.
#
# Bug 42074 concurrent optimize table and
# alter table = Assertion failed: thd->is_error()
#
DROP TABLE IF EXISTS t1;
# Create InnoDB table
CREATE TABLE t1 (id INT) engine=innodb;
# Connection 1
# Start optimizing table
SET DEBUG_SYNC='ha_admin_try_alter SIGNAL optimize_started WAIT_FOR table_altered';
OPTIMIZE TABLE t1;
# Connection 2
# Change table to engine=memory
SET DEBUG_SYNC='now WAIT_FOR optimize_started';
ALTER TABLE t1 engine=memory;
SET DEBUG_SYNC='now SIGNAL table_altered';
# Connection 1
# Complete optimization
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize error Got error -1 from storage engine
test.t1 optimize status Operation failed
Warnings:
Error 1030 Got error -1 from storage engine
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -226,10 +226,9 @@ drop table t_bug44738_UPPERCASE; ...@@ -226,10 +226,9 @@ drop table t_bug44738_UPPERCASE;
create table t_bug44738_UPPERCASE (i int); create table t_bug44738_UPPERCASE (i int);
drop table t_bug44738_UPPERCASE; drop table t_bug44738_UPPERCASE;
# Finally, let us check that another issue which was exposed by # Finally, let us check that another issue which was exposed by
# the original test case is solved. I.e. that fuse in CREATE TABLE # the original test case is solved. I.e. that the table is not
# which ensures that table is not created if there is an entry for # created if there is an entry for it in TDC even though it was
# it in TDC even though it was removed from disk uses normalized # removed from disk.
# version of the table name.
create table t_bug44738_UPPERCASE (i int) engine = myisam; create table t_bug44738_UPPERCASE (i int) engine = myisam;
# Load table definition in TDC. # Load table definition in TDC.
select table_schema, table_name, table_comment from information_schema.tables select table_schema, table_name, table_comment from information_schema.tables
...@@ -237,10 +236,13 @@ where table_schema = 'test' and table_name like 't_bug44738_%'; ...@@ -237,10 +236,13 @@ where table_schema = 'test' and table_name like 't_bug44738_%';
table_schema table_name table_comment table_schema table_name table_comment
test t_bug44738_UPPERCASE test t_bug44738_UPPERCASE
# Simulate manual removal of the table. # Simulate manual removal of the table.
# After manual removal of table still there should be an entry for table # Check that still there is an entry for table in TDC.
# in TDC so attempt to create table with the same name should fail. show open tables like 't_bug44738_%';
Database Table In_use Name_locked
test t_bug44738_uppercase 0 0
# So attempt to create table with the same name should fail.
create table t_bug44738_UPPERCASE (i int); create table t_bug44738_UPPERCASE (i int);
ERROR 42S01: Table 't_bug44738_uppercase' already exists ERROR HY000: Can't find file: 't_bug44738_uppercase' (errno: 2)
# And should succeed after FLUSH TABLES. # And should succeed after FLUSH TABLES.
flush tables; flush tables;
create table t_bug44738_UPPERCASE (i int); create table t_bug44738_UPPERCASE (i int);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -102,7 +102,7 @@ a b ...@@ -102,7 +102,7 @@ a b
# Switch to connection con1 # Switch to connection con1
# 3. test for updated key column: # 3. test for updated key column:
TRUNCATE t1; TRUNCATE t1;
TRUNCATE t2; DELETE FROM t2;
INSERT INTO t1 VALUES (1,'init'); INSERT INTO t1 VALUES (1,'init');
BEGIN; BEGIN;
UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1; UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -15,3 +15,4 @@ ndb_condition_pushdown : Bug#49746 2010-02-08 alik ndb_condition_pushdown fai ...@@ -15,3 +15,4 @@ ndb_condition_pushdown : Bug#49746 2010-02-08 alik ndb_condition_pushdown fai
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
ndb_alter_table3 : Bug#45621 2009-06-10 alik A few test files are disabled due to WL#4284
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment