[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.15.198.149: ~ $
#
# Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout 
#  without error
#
CREATE TABLE t1 (a int, b int, PRIMARY KEY  (a,b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1070109,99);
CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB;
INSERT INTO t2 (b,a) VALUES (7,1070109);
SELECT * FROM t1;
a	b
1070109	99
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
b
7
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7));
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT * FROM t1;
a	b
1070109	99
DROP TABLE t2, t1;
# End of 5.0 tests
#
# Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT
#           FOR UPDATE
#
drop table if exists t1;
create table t1 (a int primary key auto_increment,
b int, index(b)) engine=innodb;
insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
set autocommit=0;
begin;
select * from t1 where b=5 for update;
a	b
5	5
insert ignore into t1 (b) select a as b from t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# Cleanup
#
commit;
set autocommit=default;
drop table t1;
#
# Bug #37183 insert ignore into .. select ... hangs 
#            after deadlock was encountered
#
create table t1(id int primary key,v int)engine=innodb;
insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
create table t2 like t1;
begin;
update t1 set v=id*2 where id=1;
begin;
update t1 set v=id*2 where id=2;
update t1 set v=id*2 where id=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
insert ignore into t2 select * from t1 where id=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
rollback;
drop table t1, t2;
#
# Bug#41756 Strange error messages about locks from InnoDB
#
drop table if exists t1;
# In the default transaction isolation mode, and/or with
# innodb_locks_unsafe_for_binlog=OFF, handler::unlock_row()
# in InnoDB does nothing.
# Thus in order to reproduce the condition that led to the
# warning, one needs to relax isolation by either
# setting a weaker tx_isolation value, or by turning on
# the unsafe replication switch.
# For testing purposes, choose to tweak the isolation level,
# since it's settable at runtime, unlike
# innodb_locks_unsafe_for_binlog, which is
# only a command-line switch.
#
set @@session.tx_isolation="read-committed";
# Prepare data. We need a table with a unique index,
# for join_read_key to be used. The other column
# allows to control what passes WHERE clause filter.
create table t1 (a int primary key, b int) engine=innodb stats_persistent=0;
# Let's make sure t1 has sufficient amount of rows
# to exclude JT_ALL access method when reading it,
# i.e. make sure that JT_EQ_REF(a) is always preferred.
insert into t1 values (1,1), (2,null), (3,1), (4,1),
(5,1), (6,1), (7,1), (8,1), (9,1), (10,1),
(11,1), (12,1), (13,1), (14,1), (15,1),
(16,1), (17,1), (18,1), (19,1), (20,1);
#
# Demonstrate that for the SELECT statement
# used later in the test JT_EQ_REF access method is used.
#
explain
select 1 from t1 natural join (select 2 as a, 1 as b union all
select 2 as a, 2 as b) as t2 for update;
id	1
select_type	PRIMARY
table	<derived2>
type	ALL
possible_keys	NULL
key	NULL
key_len	NULL
ref	NULL
rows	2
Extra	NULL
id	1
select_type	PRIMARY
table	t1
type	eq_ref
possible_keys	PRIMARY
key	PRIMARY
key_len	4
ref	t2.a
rows	1
Extra	Using where
id	2
select_type	DERIVED
table	NULL
type	NULL
possible_keys	NULL
key	NULL
key_len	NULL
ref	NULL
rows	NULL
Extra	No tables used
id	3
select_type	UNION
table	NULL
type	NULL
possible_keys	NULL
key	NULL
key_len	NULL
ref	NULL
rows	NULL
Extra	No tables used
id	NULL
select_type	UNION RESULT
table	<union2,3>
type	ALL
possible_keys	NULL
key	NULL
key_len	NULL
ref	NULL
rows	NULL
Extra	Using temporary
#
# Demonstrate that the reported SELECT statement
# no longer produces warnings.
#
select 1 from t1 natural join (select 2 as a, 1 as b union all
select 2 as a, 2 as b) as t2 for update;
1
commit;
# 
# Demonstrate that due to lack of inter-sweep "reset" function,
# we keep some non-matching records locked, even though we know
# we could unlock them.
# To do that, show that if there is only one distinct value
# for a in t2 (a=2), we will keep record (2,null) in t1 locked.
# But if we add another value for "a" to t2, say 6,
# join_read_key cache will be pruned at least once, 
# and thus record (2, null) in t1 will get unlocked.
#
begin;
select 1 from t1 natural join (select 2 as a, 1 as b union all
select 2 as a, 2 as b) as t2 for update;
1
#
# Switching to connection con1
# We should be able to delete all records from t1 except (2, null),
# since they were not locked.
begin;
# Delete in series of 3 records so that full scan
# is not used and we're not blocked on record (2,null)
delete from t1 where a in (1,3,4);
delete from t1 where a in (5,6,7);
delete from t1 where a in (8,9,10);
delete from t1 where a in (11,12,13);
delete from t1 where a in (14,15,16);
delete from t1 where a in (17,18);
delete from t1 where a in (19,20);
# 
# Record (2, null) is locked. This is actually unnecessary, 
# because the previous select returned no rows. 
# Just demonstrate the effect.
#
delete from t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
#
# Switching to connection default
#
# Show that the original contents of t1 is intact:
select * from t1;
a	b
1	1
2	NULL
3	1
4	1
5	1
6	1
7	1
8	1
9	1
10	1
11	1
12	1
13	1
14	1
15	1
16	1
17	1
18	1
19	1
20	1
commit;
#
# Have a one more record in t2 to show that 
# if join_read_key cache is purned, the current
# row under the cursor is unlocked (provided, this row didn't 
# match the partial WHERE clause, of course).
# Sic: the result of this test dependent on the order of retrieval
# of records --echo # from the derived table, if !
# We use DELETE to disable the JOIN CACHE. This DELETE modifies no
# records. It also should leave no InnoDB row locks.
#
begin;
delete t1.* from t1 natural join (select 2 as a, 2 as b union all
select 0 as a, 0 as b) as t2;
# Demonstrate that nothing was deleted form t1
select * from t1;
a	b
1	1
2	NULL
3	1
4	1
5	1
6	1
7	1
8	1
9	1
10	1
11	1
12	1
13	1
14	1
15	1
16	1
17	1
18	1
19	1
20	1
#
# Switching to connection con1
begin;
# Since there is another distinct record in the derived table
# the previous matching record in t1 -- (2,null) -- was unlocked.
delete from t1;
# We will need the contents of the table again.
rollback;
select * from t1;
a	b
1	1
2	NULL
3	1
4	1
5	1
6	1
7	1
8	1
9	1
10	1
11	1
12	1
13	1
14	1
15	1
16	1
17	1
18	1
19	1
20	1
commit;
#
# Switching to connection default
rollback;
begin;
#
# Before this patch, we could wrongly unlock a record
# that was cached and later used in a join. Demonstrate that
# this is no longer the case.
# Sic: this test is also order-dependent (i.e. the
# the bug would show up only if the first record in the union
# is retreived and processed first.
#
# Verify that JT_EQ_REF is used.
explain
select 1 from t1 natural join (select 3 as a, 2 as b union all
select 3 as a, 1 as b) as t2 for update;
id	1
select_type	PRIMARY
table	<derived2>
type	ALL
possible_keys	NULL
key	NULL
key_len	NULL
ref	NULL
rows	2
Extra	NULL
id	1
select_type	PRIMARY
table	t1
type	eq_ref
possible_keys	PRIMARY
key	PRIMARY
key_len	4
ref	t2.a
rows	1
Extra	Using where
id	2
select_type	DERIVED
table	NULL
type	NULL
possible_keys	NULL
key	NULL
key_len	NULL
ref	NULL
rows	NULL
Extra	No tables used
id	3
select_type	UNION
table	NULL
type	NULL
possible_keys	NULL
key	NULL
key_len	NULL
ref	NULL
rows	NULL
Extra	No tables used
id	NULL
select_type	UNION RESULT
table	<union2,3>
type	ALL
possible_keys	NULL
key	NULL
key_len	NULL
ref	NULL
rows	NULL
Extra	Using temporary
# Lock the record.
select 1 from t1 natural join (select 3 as a, 2 as b union all
select 3 as a, 1 as b) as t2 for update;
1
1
# Switching to connection con1
#
# We should not be able to delete record (3,1) from t1,
# (previously it was possible).
#
delete from t1 where a=3;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# Switching to connection default
commit;
set @@session.tx_isolation=default;
drop table t1;
#
# End of 5.1 tests
#

Filemanager

Name Type Size Permission Actions
add_foreign_key.result File 1.28 KB 0644
alter_rename_existing.result File 2.96 KB 0644
analyze_table.result File 538 B 0644
autoinc_debug.result File 2.52 KB 0644
blob-update-debug.result File 489 B 0644
blob_redo.result File 1.1 KB 0644
bulk_create_index_online.result File 760 B 0644
checksum.result File 372 B 0644
create-index.result File 1.17 KB 0644
create_isl_with_direct.result File 328 B 0644
dropdb.result File 222 B 0644
end_range_check.result File 1.53 KB 0644
events-merge-tmp-path.result File 1.33 KB 0644
flush-hang.result File 1.27 KB 0644
foreign_key.result File 3.24 KB 0644
ibuf_not_empty.result File 1.01 KB 0644
import.result File 1.79 KB 0644
import_tablespace_schema_missmatch.result File 2.14 KB 0644
import_update_stats.result File 2.86 KB 0644
index_length.result File 1.44 KB 0644
index_tree_operation.result File 1.65 KB 0644
innodb-2byte-collation.result File 3.28 KB 0644
innodb-ac-non-locking-select.result File 861 B 0644
innodb-alter-autoinc.result File 4.46 KB 0644
innodb-alter-debug.result File 2.66 KB 0644
innodb-alter-discard.result File 1.18 KB 0644
innodb-alter-nullable.result File 1.59 KB 0644
innodb-alter-tempfile.result File 1.42 KB 0644
innodb-alter.result File 32.02 KB 0644
innodb-analyze.result File 58 B 0644
innodb-autoinc-18274.result File 805 B 0644
innodb-autoinc-44030.result File 722 B 0644
innodb-autoinc-56228.result File 847 B 0644
innodb-autoinc-optimize.result File 321 B 0644
innodb-autoinc.result File 39.22 KB 0644
innodb-blob.result File 3.76 KB 0644
innodb-bug-14068765.result File 3 KB 0644
innodb-bug-14084530.result File 898 B 0644
innodb-bug12552164.result File 1.73 KB 0644
innodb-bug14219515.result File 244 B 0644
innodb-change-buffer-recovery.result File 1.04 KB 0644
innodb-consistent.result File 670 B 0644
innodb-double-write.result File 8.72 KB 0644
innodb-index-debug.result File 2.87 KB 0644
innodb-index-online-delete.result File 642 B 0644
innodb-index-online-fk.result File 23.42 KB 0644
innodb-index-online-norebuild.result File 897 B 0644
innodb-index-online-purge.result File 1.2 KB 0644
innodb-index-online.result File 13.59 KB 0644
innodb-index.result File 34.22 KB 0644
innodb-index_ucs2.result File 2.74 KB 0644
innodb-lock-inherit-read_commited.result File 3.36 KB 0644
innodb-lock.result File 2.86 KB 0644
innodb-log-file-size-1.result File 4.91 KB 0644
innodb-log-file-size.result File 1.18 KB 0644
innodb-multiple-tablespaces.result File 13.19 KB 0644
innodb-read-view.result File 2.06 KB 0644
innodb-replace.result File 445 B 0644
innodb-semi-consistent.result File 1.35 KB 0644
innodb-status-output.result File 2.2 KB 0644
innodb-system-table-view.result File 5.26 KB 0644
innodb-table-online.result File 12.88 KB 0644
innodb-tablespace.result File 21.6 KB 0644
innodb-timeout.result File 953 B 0644
innodb-truncate.result File 2.28 KB 0644
innodb-ucs2.result File 15.36 KB 0644
innodb-update-insert.result File 948 B 0644
innodb-use-sys-malloc.result File 1.47 KB 0644
innodb-wl5522-1.result File 28.06 KB 0644
innodb-wl5522-debug.result File 32.19 KB 0644
innodb-wl5522.result File 20.52 KB 0644
innodb-wl5980-alter.result File 35.51 KB 0644
innodb-wl5980-debug.result File 1.33 KB 0644
innodb-wl5980-discard.result File 28.63 KB 0644
innodb-wl5980-linux.result File 5.29 KB 0644
innodb-wl5980-windows.result File 5.77 KB 0644
innodb-wl6445-1.result File 68.57 KB 0644
innodb-wl6445-2.result File 3.9 KB 0644
innodb-wl6445.result File 1.78 KB 0644
innodb.result File 97.48 KB 0644
innodb_autoinc_lock_mode_zero.result File 1.22 KB 0644
innodb_autoinc_reset.result File 423 B 0644
innodb_blob_unrecoverable_crash.result File 764 B 0644
innodb_buffer_pool_load.result File 978 B 0644
innodb_bug-13628249.result File 973 B 0644
innodb_bug11754376.result File 180 B 0644
innodb_bug11766634.result File 396 B 0644
innodb_bug11789106.result File 394 B 0644
innodb_bug11933790.result File 229 B 0644
innodb_bug12400341.result File 1 KB 0644
innodb_bug12429573.result File 708 B 0644
innodb_bug12661768.result File 524 B 0644
innodb_bug13635833.result File 1.61 KB 0644
innodb_bug13867871.result File 3.71 KB 0644
innodb_bug14006907.result File 934 B 0644
innodb_bug14007109.result File 223 B 0644
innodb_bug14007649.result File 1.17 KB 0644
innodb_bug14147491.result File 1.29 KB 0644
innodb_bug14169459.result File 1.51 KB 0644
innodb_bug14676111.result File 1.99 KB 0644
innodb_bug14704286.result File 1.12 KB 0644
innodb_bug21704.result File 2.69 KB 0644
innodb_bug30423.result File 3.04 KB 0644
innodb_bug30919.result File 17.44 KB 0644
innodb_bug34053.result File 35 B 0644
innodb_bug34300.result File 173 B 0644
innodb_bug35220.result File 35 B 0644
innodb_bug38231.result File 35 B 0644
innodb_bug39438.result File 35 B 0644
innodb_bug40360.result File 134 B 0644
innodb_bug40565.result File 311 B 0644
innodb_bug41904.result File 195 B 0644
innodb_bug42101-nonzero.result File 810 B 0644
innodb_bug42101.result File 704 B 0644
innodb_bug42419.result File 858 B 0644
innodb_bug44032.result File 313 B 0644
innodb_bug44369.result File 300 B 0644
innodb_bug44571.result File 334 B 0644
innodb_bug45357.result File 290 B 0644
innodb_bug46000.result File 905 B 0644
innodb_bug46676.result File 362 B 0644
innodb_bug47167.result File 990 B 0644
innodb_bug47621.result File 777 B 0644
innodb_bug47622.result File 748 B 0644
innodb_bug47777.result File 516 B 0644
innodb_bug48024.result File 592 B 0644
innodb_bug49164.result File 633 B 0644
innodb_bug51378.result File 2.19 KB 0644
innodb_bug51920.result File 316 B 0644
innodb_bug52199.result File 175 B 0644
innodb_bug52663.result File 857 B 0644
innodb_bug53046.result File 1016 B 0644
innodb_bug53290.result File 771 B 0644
innodb_bug53592.result File 1.54 KB 0644
innodb_bug53674.result File 234 B 0644
innodb_bug53756.result File 2.39 KB 0644
innodb_bug54044.result File 678 B 0644
innodb_bug56143.result File 73.65 KB 0644
innodb_bug56716.result File 168 B 0644
innodb_bug56947.result File 406 B 0644
innodb_bug57252.result File 89 B 0644
innodb_bug57255.result File 501 B 0644
innodb_bug57904.result File 1.3 KB 0644
innodb_bug59307.result File 476 B 0644
innodb_bug59410.result File 529 B 0644
innodb_bug59641.result File 898 B 0644
innodb_bug59733.result File 802 B 0644
innodb_bug60049.result File 430 B 0644
innodb_bug60196.result File 2.9 KB 0644
innodb_bug60229.result File 955 B 0644
innodb_bug70867.result File 171 B 0644
innodb_copy_col_in_partition.result File 976 B 0644
innodb_corrupt_bit.result File 2.97 KB 0644
innodb_ctype_ldml.result File 27.54 KB 0644
innodb_deadlock_with_autoinc.result File 565 B 0644
innodb_file_format.result File 1.68 KB 0644
innodb_file_limit_check.result File 319 B 0644
innodb_force_recovery.result File 3.22 KB 0644
innodb_gis.result File 25.08 KB 0644
innodb_i_s_innodb_locks.result File 4.33 KB 0644
innodb_i_s_innodb_trx.result File 2.85 KB 0644
innodb_information_schema_buffer.result File 2.23 KB 0644
innodb_io_pf.result File 407 B 0644
innodb_lock_wait_timeout_1.result File 8.29 KB 0644
innodb_misc1.result File 28.04 KB 0644
innodb_multi_update.result File 1.58 KB 0644
innodb_mysql.result File 77.3 KB 0644
innodb_mysql_rbk.result File 629 B 0644
innodb_notembedded.result File 637 B 0644
innodb_page_size_func.result File 1.48 KB 0644
innodb_prefix_index_restart_server.result File 2.91 KB 0644
innodb_replace.result File 2.33 KB 0644
innodb_stats.result File 11.62 KB 0644
innodb_stats_auto_recalc.result File 1.33 KB 0644
innodb_stats_auto_recalc_ddl.result File 1.13 KB 0644
innodb_stats_auto_recalc_lots.result File 2.07 KB 0644
innodb_stats_auto_recalc_on_nonexistent.result File 2.19 KB 0644
innodb_stats_create_on_corrupted.result File 893 B 0644
innodb_stats_create_table.result File 1.1 KB 0644
innodb_stats_del_mark.result File 2.81 KB 0644
innodb_stats_drop_locked.result File 1.55 KB 0644
innodb_stats_external_pages.result File 880 B 0644
innodb_stats_fetch.result File 3.35 KB 0644
innodb_stats_fetch_corrupted.result File 1.2 KB 0644
innodb_stats_fetch_nonexistent.result File 980 B 0644
innodb_stats_flag_global_off.result File 7.34 KB 0644
innodb_stats_flag_global_on.result File 7.34 KB 0644
innodb_stats_rename_table.result File 1.48 KB 0644
innodb_stats_rename_table_if_exists.result File 1.89 KB 0644
innodb_stats_sample_pages.result File 1023 B 0644
innodb_stats_table_flag_auto_recalc.result File 3 KB 0644
innodb_stats_table_flag_sample_pages.result File 4.27 KB 0644
innodb_sys_var_valgrind.result File 2.35 KB 0644
innodb_timeout_rollback.result File 570 B 0644
innodb_trx_weight.result File 35 B 0644
innodb_upd_stats_if_needed_not_inited.result File 457 B 0644
innodb_ut_format_name.result File 140 B 0644
insert_debug.result File 380 B 0644
monitor.result File 22.89 KB 0644
monitor_debug.result File 569 B 0644
sp_temp_table.result File 5.72 KB 0644
strict_checksum.result File 787 B 0644
strict_mode.result File 3.47 KB 0644
timestamp.result File 790 B 0644
tmpdir.result File 1.8 KB 0644
undo_space_id.result File 155 B 0644
xa_recovery.result File 352 B 0644