Debian Codegraph @

mysql-test/suite/sql_sequence/lock.test

raw
1 --source include/have_sequence.inc
2 --source include/have_innodb.inc
3
4 --disable_warnings
5 drop table if exists s1, t1, t2;
6 --enable_warnings
7
8 #
9 # MDEV-14831 CREATE OR REPLACE SEQUENCE under LOCK TABLE corrupts the
10 # sequence, causes ER_KEY_NOT_FOUND
11 #
12 CREATE SEQUENCE s1;
13 create table t1 (a int);
14 create table t2 (a int);
15 LOCK TABLE s1 WRITE, t1 write;
16 create or replace sequence s1;
17 select * from s1;
18 select * from t1;
19 --error ER_TABLE_NOT_LOCKED
20 select * from t2;
21 unlock tables;
22 select * from t1;
23 select * from t2;
24 drop tables s1, t1, t2;
25
26 #
27 # MDEV-15742 Assertion `table_share->tmp_table != NO_TMP_TABLE ||
28 # m_lock_type == 1' failed in handler::ha_write_row
29 #
30
31 CREATE SEQUENCE s1;
32 LOCK TABLE s1 READ;
33 --error ER_TABLE_NOT_LOCKED_FOR_WRITE
34 SELECT NEXTVAL(s1);
35 --error ER_TABLE_NOT_LOCKED
36 SELECT NEXTVAL(s);
37 --error ER_TABLE_NOT_LOCKED_FOR_WRITE
38 DROP SEQUENCE s1;
39 unlock tables;
40 DROP SEQUENCE s1;
41
42 #
43 # MDEV-15106 Unexpected ER_WRONG_INSERT_INTO_SEQUENCE upon INSERT with
44 # multiple locks on sequences
45 #
46
47 CREATE SEQUENCE seq1;
48 CREATE SEQUENCE seq2;
49 LOCK TABLE seq1 WRITE, seq2 WRITE;
50 INSERT INTO seq1 VALUES (1, 1, 100000, 1, 1, 100, 1, 1);
51 DROP SEQUENCE seq1, seq2;
52
53 #
54 # MDEV-15970
55 # Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failure and/or
56 # ER_KEY_NOT_FOUND upon TRUNCATE sequence under lock
57 #
58
59 CREATE OR REPLACE SEQUENCE s1 ENGINE=MyISAM;
60 LOCK TABLE s1 WRITE;
61 --error ER_ILLEGAL_HA
62 TRUNCATE TABLE s1;
63 # Cleanup
64 DROP SEQUENCE s1;