~vadim-tk/percona-server/percona-galera-5.1.57-0.8.1

« back to all changes in this revision

Viewing changes to mysql-test/suite/innodb_plugin/t/innodb_information_schema.test

  • Committer: root
  • Date: 2011-07-28 00:14:23 UTC
  • Revision ID: root@r815.office.percona.com-20110728001423-6pw0v4b7r0dkbsr4
Ported to Galera 0.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
2
# Test that user data is correctly "visualized" in
 
3
# INFORMATION_SCHEMA.innodb_locks.lock_data
 
4
#
 
5
 
 
6
-- source include/have_innodb_plugin.inc
 
7
 
 
8
-- disable_query_log
 
9
-- disable_result_log
 
10
 
 
11
SET storage_engine=InnoDB;
 
12
 
 
13
-- disable_warnings
 
14
DROP TABLE IF EXISTS t_min, t_max;
 
15
-- enable_warnings
 
16
 
 
17
let $table_def =
 
18
(
 
19
        c01 TINYINT,
 
20
        c02 TINYINT UNSIGNED,
 
21
        c03 SMALLINT,
 
22
        c04 SMALLINT UNSIGNED,
 
23
        c05 MEDIUMINT,
 
24
        c06 MEDIUMINT UNSIGNED,
 
25
        c07 INT,
 
26
        c08 INT UNSIGNED,
 
27
        c09 BIGINT,
 
28
        c10 BIGINT UNSIGNED,
 
29
        PRIMARY KEY(c01, c02, c03, c04, c05, c06, c07, c08, c09, c10)
 
30
);
 
31
 
 
32
-- eval CREATE TABLE t_min $table_def;
 
33
INSERT INTO t_min VALUES
 
34
(-128, 0,
 
35
 -32768, 0,
 
36
 -8388608, 0,
 
37
 -2147483648, 0,
 
38
 -9223372036854775808, 0);
 
39
 
 
40
-- eval CREATE TABLE t_max $table_def;
 
41
INSERT INTO t_max VALUES
 
42
(127, 255,
 
43
 32767, 65535,
 
44
 8388607, 16777215,
 
45
 2147483647, 4294967295,
 
46
 9223372036854775807, 18446744073709551615);
 
47
 
 
48
CREATE TABLE ```t'\"_str` (
 
49
        c1 VARCHAR(32),
 
50
        c2 VARCHAR(32),
 
51
        c3 VARCHAR(32),
 
52
        c4 VARCHAR(32),
 
53
        c5 VARCHAR(32),
 
54
        c6 VARCHAR(32),
 
55
        c7 VARCHAR(32),
 
56
        PRIMARY KEY(c1, c2, c3, c4, c5, c6, c7)
 
57
);
 
58
INSERT INTO ```t'\"_str` VALUES
 
59
('1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc''''');
 
60
INSERT INTO ```t'\"_str` VALUES
 
61
('2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""');
 
62
INSERT INTO ```t'\"_str` VALUES
 
63
('3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\');
 
64
INSERT INTO ```t'\"_str` VALUES
 
65
('4', 'abc', 0x00616263, 0x61626300, 0x61006263, 0x6100626300, 0x610062630000);
 
66
 
 
67
-- connect (con_lock,localhost,root,,)
 
68
-- connect (con_min_trylock,localhost,root,,)
 
69
-- connect (con_max_trylock,localhost,root,,)
 
70
-- connect (con_str_insert_supremum,localhost,root,,)
 
71
-- connect (con_str_lock_row1,localhost,root,,)
 
72
-- connect (con_str_lock_row2,localhost,root,,)
 
73
-- connect (con_str_lock_row3,localhost,root,,)
 
74
-- connect (con_str_lock_row4,localhost,root,,)
 
75
-- connect (con_verify_innodb_locks,localhost,root,,)
 
76
 
 
77
-- connection con_lock
 
78
SET autocommit=0;
 
79
SELECT * FROM t_min FOR UPDATE;
 
80
SELECT * FROM t_max FOR UPDATE;
 
81
SELECT * FROM ```t'\"_str` FOR UPDATE;
 
82
 
 
83
-- connection con_min_trylock
 
84
-- send
 
85
SELECT * FROM t_min FOR UPDATE;
 
86
 
 
87
-- connection con_max_trylock
 
88
-- send
 
89
SELECT * FROM t_max FOR UPDATE;
 
90
 
 
91
-- connection con_str_insert_supremum
 
92
-- send
 
93
INSERT INTO ```t'\"_str` VALUES
 
94
('z', 'z', 'z', 'z', 'z', 'z', 'z');
 
95
 
 
96
-- connection con_str_lock_row1
 
97
-- send
 
98
SELECT * FROM ```t'\"_str` WHERE c1 = '1' FOR UPDATE;
 
99
 
 
100
-- connection con_str_lock_row2
 
101
-- send
 
102
SELECT * FROM ```t'\"_str` WHERE c1 = '2' FOR UPDATE;
 
103
 
 
104
-- connection con_str_lock_row3
 
105
-- send
 
106
SELECT * FROM ```t'\"_str` WHERE c1 = '3' FOR UPDATE;
 
107
 
 
108
-- connection con_str_lock_row4
 
109
-- send
 
110
SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE;
 
111
 
 
112
-- enable_result_log
 
113
-- connection con_verify_innodb_locks
 
114
# Wait for the above queries to execute before continuing.
 
115
# Without this, it sometimes happens that the SELECT from innodb_locks
 
116
# executes before some of them, resulting in less than expected number
 
117
# of rows being selected from innodb_locks. If there is a bug and there
 
118
# are no 14 rows in innodb_locks then this test will fail with timeout.
 
119
# Notice that if we query INNODB_LOCKS more often than once per 0.1 sec
 
120
# then its contents will never change because the cache from which it is
 
121
# filled is updated only if it has not been read for 0.1 seconds. See
 
122
# CACHE_MIN_IDLE_TIME_US in trx/trx0i_s.c.
 
123
let $cnt=10;
 
124
while ($cnt)
 
125
{
 
126
    let $success=`SELECT COUNT(*) = 14 FROM INFORMATION_SCHEMA.INNODB_LOCKS`;
 
127
    if ($success)
 
128
    {
 
129
        let $cnt=0;
 
130
    }
 
131
    if (!$success)
 
132
    {
 
133
        real_sleep 0.2;
 
134
        dec $cnt;
 
135
    }
 
136
}
 
137
if (!$success)
 
138
{
 
139
    -- echo Timeout waiting for rows in INNODB_LOCKS to appear
 
140
}
 
141
 
 
142
SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data
 
143
FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data;
 
144
 
 
145
SELECT lock_table,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
 
146
GROUP BY lock_table;
 
147
 
 
148
set @save_sql_mode = @@sql_mode;
 
149
SET SQL_MODE='ANSI_QUOTES';
 
150
SELECT lock_table,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
 
151
GROUP BY lock_table;
 
152
SET @@sql_mode=@save_sql_mode;
 
153
-- disable_result_log
 
154
 
 
155
-- connection default
 
156
 
 
157
-- disconnect con_lock
 
158
-- disconnect con_min_trylock
 
159
-- disconnect con_max_trylock
 
160
-- disconnect con_str_insert_supremum
 
161
-- disconnect con_str_lock_row1
 
162
-- disconnect con_str_lock_row2
 
163
-- disconnect con_str_lock_row3
 
164
-- disconnect con_str_lock_row4
 
165
-- disconnect con_verify_innodb_locks
 
166
 
 
167
DROP TABLE t_min, t_max, ```t'\"_str`;