Merge lp:~laurynas-biveinis/percona-server/fake-changes-from-fb-5.6 into lp:percona-server/5.6
- fake-changes-from-fb-5.6
- Merge into 5.6
Proposed by
Laurynas Biveinis
Status: | Superseded |
---|---|
Proposed branch: | lp:~laurynas-biveinis/percona-server/fake-changes-from-fb-5.6 |
Merge into: | lp:percona-server/5.6 |
Prerequisite: | lp:~laurynas-biveinis/percona-server/fake-changes-binlog-5.6 |
Diff against target: |
1832 lines (+1197/-174) 15 files modified
Percona-Server/mysql-test/include/start_fake_changes.inc (+34/-0) Percona-Server/mysql-test/include/stop_fake_changes.inc (+35/-0) Percona-Server/mysql-test/r/percona_innodb_fake_changes.result (+583/-43) Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_898306.result (+53/-3) Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_917942.result (+143/-0) Percona-Server/mysql-test/t/percona_innodb_fake_changes.test (+300/-76) Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_898306.test (+8/-4) Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942.test (+14/-24) Percona-Server/mysql-test/t/percona_innodb_fake_changes_locks.test (+1/-0) Percona-Server/sql/sql_insert.cc (+1/-1) Percona-Server/storage/innobase/btr/btr0cur.cc (+10/-10) Percona-Server/storage/innobase/handler/ha_innodb.cc (+9/-7) Percona-Server/storage/innobase/lock/lock0lock.cc (+4/-4) Percona-Server/storage/innobase/que/que0que.cc (+1/-1) Percona-Server/storage/innobase/row/row0upd.cc (+1/-1) |
To merge this branch: | bzr merge lp:~laurynas-biveinis/percona-server/fake-changes-from-fb-5.6 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Laurynas Biveinis (community) | Needs Fixing | ||
Registry Administrators | Pending | ||
Review via email: mp+174193@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-07-16.
Commit message
Description of the change
No BT or ST but BT 20439 prerequisite.
http://
Merge bug 1190604 fix from 5.5.
Merge bug 1200162 changes from 5.5.
To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : | # |
review:
Needs Fixing
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'Percona-Server/mysql-test/include/start_fake_changes.inc' |
2 | --- Percona-Server/mysql-test/include/start_fake_changes.inc 1970-01-01 00:00:00 +0000 |
3 | +++ Percona-Server/mysql-test/include/start_fake_changes.inc 2013-07-15 16:29:43 +0000 |
4 | @@ -0,0 +1,34 @@ |
5 | +# |
6 | +# Include this file in a session before fake changes workload. It will enable |
7 | +# the fake changes for the current session and save the relevant server state |
8 | +# to variables that will be used by stop_fake_changes.inc that it didn't change. |
9 | +# |
10 | +# Since some of the state checked is global InnoDB counters, do not issue a |
11 | +# non-fake-changes workload in parallel. |
12 | +# |
13 | + |
14 | +# Requires userstat |
15 | +SELECT @@global.userstat = 1 AS should_be_1; |
16 | + |
17 | +# Have up-to-date stats for the fake changes table, so that, if there is a |
18 | +# non-fake-changes session running in parallel, it does not trigger an auto |
19 | +# stat recalc which then fails these checks. |
20 | +eval ANALYZE TABLE $fake_changes_table; |
21 | + |
22 | +let $t_checksum_1= `CHECKSUM TABLE $fake_changes_table EXTENDED`; |
23 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
24 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
25 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
26 | +# eval SELECT ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_TABLE_STATS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE '$fake_changes_table'; |
27 | +eval SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/$fake_changes_table'; |
28 | +eval SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE '$fake_changes_table'; |
29 | +eval SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE '$fake_changes_table'; |
30 | +eval SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/$fake_changes_table'; |
31 | + |
32 | +# |
33 | +# Index stats should not change, but it's only possible to inspect them |
34 | +# manually. |
35 | +# |
36 | +eval SHOW INDEXES IN $fake_changes_table; |
37 | + |
38 | +SET innodb_fake_changes=1; |
39 | |
40 | === added file 'Percona-Server/mysql-test/include/stop_fake_changes.inc' |
41 | --- Percona-Server/mysql-test/include/stop_fake_changes.inc 1970-01-01 00:00:00 +0000 |
42 | +++ Percona-Server/mysql-test/include/stop_fake_changes.inc 2013-07-15 16:29:43 +0000 |
43 | @@ -0,0 +1,35 @@ |
44 | +# |
45 | +# Include this file in a session after fake changes workload. It will disable the fake |
46 | +# changes and assert that the relevant server state has not changed from the one saved |
47 | +# by a previous start_fake_changes.inc. |
48 | +# |
49 | +SET innodb_fake_changes=0; |
50 | + |
51 | +eval CHECK TABLE $fake_changes_table; |
52 | + |
53 | +let $t_checksum_2= `CHECKSUM TABLE $fake_changes_table EXTENDED`; |
54 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
55 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
56 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
57 | +# eval SELECT ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_TABLE_STATS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE '$fake_changes_table'; |
58 | +eval SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/$fake_changes_table'; |
59 | +eval SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE '$fake_changes_table'; |
60 | +eval SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE '$fake_changes_table'; |
61 | +eval SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/$fake_changes_table'; |
62 | + |
63 | +--disable_query_log |
64 | +eval SELECT "$t_checksum_1" LIKE "$t_checksum_2" AS should_be_1; |
65 | +--enable_query_log |
66 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
67 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
68 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
69 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
70 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
71 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
72 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
73 | + |
74 | +# |
75 | +# Index stats should not change, but it's only possible to inspect them |
76 | +# manually. |
77 | +# |
78 | +eval SHOW INDEXES IN $fake_changes_table; |
79 | |
80 | === modified file 'Percona-Server/mysql-test/r/percona_innodb_fake_changes.result' |
81 | --- Percona-Server/mysql-test/r/percona_innodb_fake_changes.result 2013-05-06 15:43:51 +0000 |
82 | +++ Percona-Server/mysql-test/r/percona_innodb_fake_changes.result 2013-07-15 16:29:43 +0000 |
83 | @@ -22,10 +22,24 @@ |
84 | OFF |
85 | # Explicit COMMIT should fail when innodb_fake_changes is enabled |
86 | # DML should be fine |
87 | -SET @@GLOBAL.userstat= TRUE; |
88 | +SET @@GLOBAL.userstat=TRUE; |
89 | CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
90 | INSERT INTO t1 VALUES (1); |
91 | -SET autocommit=0; |
92 | +SELECT @@global.userstat = 1 AS should_be_1; |
93 | +should_be_1 |
94 | +1 |
95 | +ANALYZE TABLE t1; |
96 | +Table Op Msg_type Msg_text |
97 | +test.t1 analyze status OK |
98 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
99 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
100 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
101 | +SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
102 | +SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
103 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
104 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
105 | +SHOW INDEXES IN t1; |
106 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
107 | SET innodb_fake_changes=1; |
108 | BEGIN; |
109 | INSERT INTO t1 VALUES (2); |
110 | @@ -36,31 +50,437 @@ |
111 | 1 |
112 | COMMIT; |
113 | ERROR HY000: Got error 131 during COMMIT |
114 | -SET innodb_fake_changes=default; |
115 | -# Verify that the fake changes to t1 did not leak through |
116 | -CHECK TABLE t1; |
117 | -Table Op Msg_type Msg_text |
118 | -test.t1 check status OK |
119 | -should_be_1 |
120 | -1 |
121 | -should_be_0 |
122 | -0 |
123 | -should_be_0 |
124 | -0 |
125 | -should_be_0 |
126 | -0 |
127 | -should_be_0 |
128 | -0 |
129 | -should_be_0 |
130 | -0 |
131 | -should_be_0 |
132 | -0 |
133 | -should_be_0 |
134 | -0 |
135 | -DROP TABLE t1; |
136 | +SET innodb_fake_changes=0; |
137 | +CHECK TABLE t1; |
138 | +Table Op Msg_type Msg_text |
139 | +test.t1 check status OK |
140 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
141 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
142 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
143 | +SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
144 | +SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
145 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
146 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
147 | +should_be_1 |
148 | +1 |
149 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
150 | +should_be_0 |
151 | +0 |
152 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
153 | +should_be_0 |
154 | +0 |
155 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
156 | +should_be_0 |
157 | +0 |
158 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
159 | +should_be_0 |
160 | +0 |
161 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
162 | +should_be_0 |
163 | +0 |
164 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
165 | +should_be_0 |
166 | +0 |
167 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
168 | +should_be_0 |
169 | +0 |
170 | +SHOW INDEXES IN t1; |
171 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
172 | +DROP TABLE t1; |
173 | +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, UNIQUE KEY (b)) ENGINE=InnoDB; |
174 | +INSERT INTO t1 VALUES (1,1); |
175 | +SELECT @@global.userstat = 1 AS should_be_1; |
176 | +should_be_1 |
177 | +1 |
178 | +ANALYZE TABLE t1; |
179 | +Table Op Msg_type Msg_text |
180 | +test.t1 analyze status OK |
181 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
182 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
183 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
184 | +SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
185 | +SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
186 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
187 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
188 | +SHOW INDEXES IN t1; |
189 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
190 | +t1 0 PRIMARY 1 a A 1 NULL NULL BTREE |
191 | +t1 0 b 1 b A 1 NULL NULL YES BTREE |
192 | +SET innodb_fake_changes=1; |
193 | +SELECT * FROM t1; |
194 | +ERROR HY000: Got error 131 during COMMIT |
195 | +INSERT INTO t1 VALUES (2,2); |
196 | +ERROR HY000: Got error 131 during COMMIT |
197 | +UPDATE t1 SET a=0 where b=1; |
198 | +ERROR 23000: Duplicate entry '1' for key 'b' |
199 | +UPDATE t1 SET b=0 where a=1; |
200 | +ERROR HY000: Got error 131 during COMMIT |
201 | +UPDATE t1 SET b=0 where a=2; |
202 | +ERROR HY000: Got error 131 during COMMIT |
203 | +DELETE FROM t1 where b=2; |
204 | +ERROR HY000: Got error 131 during COMMIT |
205 | +DELETE FROM t1 where b=1; |
206 | +ERROR HY000: Got error 131 during COMMIT |
207 | +DELETE FROM t1 where a=2; |
208 | +ERROR HY000: Got error 131 during COMMIT |
209 | +DELETE FROM t1 where a=1; |
210 | +ERROR HY000: Got error 131 during COMMIT |
211 | +REPLACE INTO t1 values (2,3); |
212 | +ERROR HY000: Got error 131 during COMMIT |
213 | +BEGIN; |
214 | +SELECT * FROM t1; |
215 | +a b |
216 | +1 1 |
217 | +COMMIT; |
218 | +ERROR HY000: Got error 131 during COMMIT |
219 | +BEGIN; |
220 | +INSERT INTO t1 VALUES (2,2); |
221 | +COMMIT; |
222 | +ERROR HY000: Got error 131 during COMMIT |
223 | +BEGIN; |
224 | +UPDATE t1 SET a=0 where b=1; |
225 | +ERROR 23000: Duplicate entry '1' for key 'b' |
226 | +COMMIT; |
227 | +ERROR HY000: Got error 131 during COMMIT |
228 | +BEGIN; |
229 | +UPDATE t1 SET b=0 where a=1; |
230 | +COMMIT; |
231 | +ERROR HY000: Got error 131 during COMMIT |
232 | +BEGIN; |
233 | +UPDATE t1 SET b=0 where a=2; |
234 | +COMMIT; |
235 | +ERROR HY000: Got error 131 during COMMIT |
236 | +BEGIN; |
237 | +DELETE FROM t1 where b=2; |
238 | +COMMIT; |
239 | +ERROR HY000: Got error 131 during COMMIT |
240 | +BEGIN; |
241 | +DELETE FROM t1 where b=1; |
242 | +COMMIT; |
243 | +ERROR HY000: Got error 131 during COMMIT |
244 | +BEGIN; |
245 | +DELETE FROM t1 where a=2; |
246 | +COMMIT; |
247 | +ERROR HY000: Got error 131 during COMMIT |
248 | +BEGIN; |
249 | +DELETE FROM t1 where a=1; |
250 | +COMMIT; |
251 | +ERROR HY000: Got error 131 during COMMIT |
252 | +BEGIN; |
253 | +REPLACE INTO t1 values (2,3); |
254 | +COMMIT; |
255 | +ERROR HY000: Got error 131 during COMMIT |
256 | +INSERT INTO t1 VALUES (1,1) ON DUPLICATE KEY UPDATE b=2; |
257 | +ERROR HY000: Got error 131 during COMMIT |
258 | +CREATE INDEX bx ON t1(b); |
259 | +ERROR HY000: Got error 131 during COMMIT |
260 | +SET innodb_fake_changes=0; |
261 | +CHECK TABLE t1; |
262 | +Table Op Msg_type Msg_text |
263 | +test.t1 check status OK |
264 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
265 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
266 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
267 | +SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
268 | +SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
269 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
270 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
271 | +should_be_1 |
272 | +1 |
273 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
274 | +should_be_0 |
275 | +0 |
276 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
277 | +should_be_0 |
278 | +0 |
279 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
280 | +should_be_0 |
281 | +0 |
282 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
283 | +should_be_0 |
284 | +0 |
285 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
286 | +should_be_0 |
287 | +0 |
288 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
289 | +should_be_0 |
290 | +0 |
291 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
292 | +should_be_0 |
293 | +0 |
294 | +SHOW INDEXES IN t1; |
295 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
296 | +t1 0 PRIMARY 1 a A 1 NULL NULL BTREE |
297 | +t1 0 b 1 b A 1 NULL NULL YES BTREE |
298 | +DROP TABLE t1; |
299 | +CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; |
300 | +INSERT INTO t2 VALUES (1, 1); |
301 | +SELECT @@global.userstat = 1 AS should_be_1; |
302 | +should_be_1 |
303 | +1 |
304 | +ANALYZE TABLE t2; |
305 | +Table Op Msg_type Msg_text |
306 | +test.t2 analyze status OK |
307 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
308 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
309 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
310 | +SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2'; |
311 | +SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't2'; |
312 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't2'; |
313 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2'; |
314 | +SHOW INDEXES IN t2; |
315 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
316 | +t2 0 PRIMARY 1 a A 1 NULL NULL BTREE |
317 | +SET innodb_fake_changes=1; |
318 | +SELECT * FROM t2; |
319 | +ERROR HY000: Got error 131 during COMMIT |
320 | +INSERT INTO t2 VALUES (2,2); |
321 | +ERROR HY000: Got error 131 during COMMIT |
322 | +UPDATE t2 SET b=0 where a=1; |
323 | +ERROR HY000: Got error 131 during COMMIT |
324 | +UPDATE t2 SET b=0 where a=2; |
325 | +ERROR HY000: Got error 131 during COMMIT |
326 | +DELETE FROM t2 where b=2; |
327 | +ERROR HY000: Got error 131 during COMMIT |
328 | +DELETE FROM t2 where b=1; |
329 | +ERROR HY000: Got error 131 during COMMIT |
330 | +DELETE FROM t2 where a=2; |
331 | +ERROR HY000: Got error 131 during COMMIT |
332 | +DELETE FROM t2 where a=1; |
333 | +ERROR HY000: Got error 131 during COMMIT |
334 | +REPLACE INTO t2 values (2,3); |
335 | +ERROR HY000: Got error 131 during COMMIT |
336 | +REPLACE INTO t2 VALUES (1,1); |
337 | +ERROR HY000: Got error 131 during COMMIT |
338 | +REPLACE INTO t2 VALUES (1,2); |
339 | +ERROR HY000: Got error 131 during COMMIT |
340 | +BEGIN; |
341 | +SELECT * FROM t2; |
342 | +a b |
343 | +1 1 |
344 | +COMMIT; |
345 | +ERROR HY000: Got error 131 during COMMIT |
346 | +BEGIN; |
347 | +INSERT INTO t2 VALUES (2,2); |
348 | +COMMIT; |
349 | +ERROR HY000: Got error 131 during COMMIT |
350 | +BEGIN; |
351 | +UPDATE t2 SET b=0 where a=1; |
352 | +COMMIT; |
353 | +ERROR HY000: Got error 131 during COMMIT |
354 | +BEGIN; |
355 | +UPDATE t2 SET b=0 where a=2; |
356 | +COMMIT; |
357 | +ERROR HY000: Got error 131 during COMMIT |
358 | +BEGIN; |
359 | +DELETE FROM t2 where b=2; |
360 | +COMMIT; |
361 | +ERROR HY000: Got error 131 during COMMIT |
362 | +BEGIN; |
363 | +DELETE FROM t2 where b=1; |
364 | +COMMIT; |
365 | +ERROR HY000: Got error 131 during COMMIT |
366 | +BEGIN; |
367 | +DELETE FROM t2 where a=2; |
368 | +COMMIT; |
369 | +ERROR HY000: Got error 131 during COMMIT |
370 | +BEGIN; |
371 | +DELETE FROM t2 where a=1; |
372 | +COMMIT; |
373 | +ERROR HY000: Got error 131 during COMMIT |
374 | +BEGIN; |
375 | +REPLACE INTO t2 values (2,3); |
376 | +COMMIT; |
377 | +ERROR HY000: Got error 131 during COMMIT |
378 | +BEGIN; |
379 | +REPLACE INTO t2 VALUES (1,1); |
380 | +COMMIT; |
381 | +ERROR HY000: Got error 131 during COMMIT |
382 | +BEGIN; |
383 | +REPLACE INTO t2 VALUES (1,2); |
384 | +COMMIT; |
385 | +ERROR HY000: Got error 131 during COMMIT |
386 | +BEGIN; |
387 | +REPLACE INTO t2 VALUES (1,2); |
388 | +SELECT * from t2; |
389 | +a b |
390 | +1 1 |
391 | +REPLACE INTO t2 VALUES (1,1); |
392 | +SELECT * from t2; |
393 | +a b |
394 | +1 1 |
395 | +ROLLBACK; |
396 | +BEGIN; |
397 | +INSERT INTO t2 VALUES (1,1); |
398 | +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' |
399 | +INSERT INTO t2 VALUES (1,2); |
400 | +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' |
401 | +ROLLBACK; |
402 | +INSERT INTO t2 VALUES (1,1) ON DUPLICATE KEY UPDATE b=2; |
403 | +ERROR HY000: Got error 131 during COMMIT |
404 | +INSERT INTO t2 VALUES (1,1) ON DUPLICATE KEY UPDATE b=b+10; |
405 | +ERROR HY000: Got error 131 during COMMIT |
406 | +INSERT INTO t2 VALUES (1,2) ON DUPLICATE KEY UPDATE b=b+10; |
407 | +ERROR HY000: Got error 131 during COMMIT |
408 | +CREATE INDEX bx ON t2(b); |
409 | +ERROR HY000: Got error 131 during COMMIT |
410 | +SET innodb_fake_changes=0; |
411 | +CHECK TABLE t2; |
412 | +Table Op Msg_type Msg_text |
413 | +test.t2 check status OK |
414 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
415 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
416 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
417 | +SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2'; |
418 | +SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't2'; |
419 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't2'; |
420 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2'; |
421 | +should_be_1 |
422 | +1 |
423 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
424 | +should_be_0 |
425 | +0 |
426 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
427 | +should_be_0 |
428 | +0 |
429 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
430 | +should_be_0 |
431 | +0 |
432 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
433 | +should_be_0 |
434 | +0 |
435 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
436 | +should_be_0 |
437 | +0 |
438 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
439 | +should_be_0 |
440 | +0 |
441 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
442 | +should_be_0 |
443 | +0 |
444 | +SHOW INDEXES IN t2; |
445 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
446 | +t2 0 PRIMARY 1 a A 1 NULL NULL BTREE |
447 | +DROP TABLE t2; |
448 | +CREATE TABLE t3 (a INT PRIMARY KEY, B TEXT) ENGINE=InnoDB; |
449 | +INSERT INTO t3 VALUES (1, ''); |
450 | +SELECT @@global.userstat = 1 AS should_be_1; |
451 | +should_be_1 |
452 | +1 |
453 | +ANALYZE TABLE t3; |
454 | +Table Op Msg_type Msg_text |
455 | +test.t3 analyze status OK |
456 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
457 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
458 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
459 | +SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3'; |
460 | +SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3'; |
461 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3'; |
462 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3'; |
463 | +SHOW INDEXES IN t3; |
464 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
465 | +t3 0 PRIMARY 1 a A 1 NULL NULL BTREE |
466 | +SET innodb_fake_changes=1; |
467 | +SELECT * FROM t3; |
468 | +ERROR HY000: Got error 131 during COMMIT |
469 | +INSERT INTO t3 VALUES (2,lpad('a',10000, 'b')); |
470 | +ERROR HY000: Got error 131 during COMMIT |
471 | +UPDATE t3 SET a=0 where a=1; |
472 | +ERROR HY000: Got error 131 during COMMIT |
473 | +DELETE FROM t3 where a=2; |
474 | +ERROR HY000: Got error 131 during COMMIT |
475 | +DELETE FROM t3 where a=1; |
476 | +ERROR HY000: Got error 131 during COMMIT |
477 | +REPLACE INTO t3 values (2,lpad('a',9000,'q')); |
478 | +ERROR HY000: Got error 131 during COMMIT |
479 | +INSERT INTO t3 VALUES (1,1) ON DUPLICATE KEY UPDATE b=lpad('b',11000,'c'); |
480 | +ERROR HY000: Got error 131 during COMMIT |
481 | +BEGIN; |
482 | +SELECT * FROM t3; |
483 | +a B |
484 | +1 |
485 | +COMMIT; |
486 | +ERROR HY000: Got error 131 during COMMIT |
487 | +BEGIN; |
488 | +INSERT INTO t3 VALUES (2,lpad('a',10000, 'b')); |
489 | +COMMIT; |
490 | +ERROR HY000: Got error 131 during COMMIT |
491 | +BEGIN; |
492 | +UPDATE t3 SET a=0 where a=1; |
493 | +COMMIT; |
494 | +ERROR HY000: Got error 131 during COMMIT |
495 | +BEGIN; |
496 | +DELETE FROM t3 where a=2; |
497 | +COMMIT; |
498 | +ERROR HY000: Got error 131 during COMMIT |
499 | +BEGIN; |
500 | +DELETE FROM t3 where a=1; |
501 | +COMMIT; |
502 | +ERROR HY000: Got error 131 during COMMIT |
503 | +BEGIN; |
504 | +REPLACE INTO t3 values (2,lpad('a',9000,'q')); |
505 | +COMMIT; |
506 | +ERROR HY000: Got error 131 during COMMIT |
507 | +BEGIN; |
508 | +INSERT INTO t3 VALUES (1,1) ON DUPLICATE KEY UPDATE b=lpad('b',11000,'c'); |
509 | +COMMIT; |
510 | +ERROR HY000: Got error 131 during COMMIT |
511 | +SET innodb_fake_changes=0; |
512 | +CHECK TABLE t3; |
513 | +Table Op Msg_type Msg_text |
514 | +test.t3 check status OK |
515 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
516 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
517 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
518 | +SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3'; |
519 | +SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3'; |
520 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3'; |
521 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3'; |
522 | +should_be_1 |
523 | +1 |
524 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
525 | +should_be_0 |
526 | +0 |
527 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
528 | +should_be_0 |
529 | +0 |
530 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
531 | +should_be_0 |
532 | +0 |
533 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
534 | +should_be_0 |
535 | +0 |
536 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
537 | +should_be_0 |
538 | +0 |
539 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
540 | +should_be_0 |
541 | +0 |
542 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
543 | +should_be_0 |
544 | +0 |
545 | +SHOW INDEXES IN t3; |
546 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
547 | +t3 0 PRIMARY 1 a A 1 NULL NULL BTREE |
548 | +DROP TABLE t3; |
549 | # DDL must result in error |
550 | CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
551 | -SET autocommit=0; |
552 | +SELECT @@global.userstat = 1 AS should_be_1; |
553 | +should_be_1 |
554 | +1 |
555 | +ANALYZE TABLE t1; |
556 | +Table Op Msg_type Msg_text |
557 | +test.t1 analyze status OK |
558 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
559 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
560 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
561 | +SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
562 | +SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
563 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
564 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
565 | +SHOW INDEXES IN t1; |
566 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
567 | +t1 0 PRIMARY 1 a A 0 NULL NULL BTREE |
568 | SET innodb_fake_changes=1; |
569 | BEGIN; |
570 | CREATE TABLE t2 (a INT) ENGINE=InnoDB; |
571 | @@ -68,52 +488,172 @@ |
572 | DROP TABLE t1; |
573 | ERROR 42S02: Unknown table 'test.t1' |
574 | TRUNCATE TABLE t1; |
575 | -ERROR HY000: Got error 131 during COMMIT |
576 | +ERROR HY000: Table storage engine for 't1' doesn't have this option |
577 | ALTER TABLE t1 ENGINE=MyISAM; |
578 | ERROR HY000: Got error 131 during COMMIT |
579 | ROLLBACK; |
580 | SET innodb_fake_changes=0; |
581 | +CHECK TABLE t1; |
582 | +Table Op Msg_type Msg_text |
583 | +test.t1 check status OK |
584 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
585 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
586 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
587 | +SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
588 | +SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
589 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
590 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
591 | +should_be_1 |
592 | +1 |
593 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
594 | +should_be_0 |
595 | +0 |
596 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
597 | +should_be_0 |
598 | +0 |
599 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
600 | +should_be_0 |
601 | +0 |
602 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
603 | +should_be_0 |
604 | +0 |
605 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
606 | +should_be_0 |
607 | +0 |
608 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
609 | +should_be_0 |
610 | +0 |
611 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
612 | +should_be_0 |
613 | +0 |
614 | +SHOW INDEXES IN t1; |
615 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
616 | +t1 0 PRIMARY 1 a A 0 NULL NULL BTREE |
617 | INSERT INTO t1 VALUES (1), (2); |
618 | -COMMIT; |
619 | CREATE TABLE t2 (a INT PRIMARY KEY, b INT, INDEX b_ind (b), |
620 | FOREIGN KEY (b) REFERENCES t1(a) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB; |
621 | INSERT INTO t2 VALUES (1, 1); |
622 | INSERT INTO t2 VALUES (2, 2); |
623 | COMMIT; |
624 | +SELECT @@global.userstat = 1 AS should_be_1; |
625 | +should_be_1 |
626 | +1 |
627 | +ANALYZE TABLE t1; |
628 | +Table Op Msg_type Msg_text |
629 | +test.t1 analyze status OK |
630 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
631 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
632 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
633 | +SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
634 | +SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
635 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
636 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
637 | +SHOW INDEXES IN t1; |
638 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
639 | +t1 0 PRIMARY 1 a A 2 NULL NULL BTREE |
640 | SET innodb_fake_changes=1; |
641 | +BEGIN; |
642 | DELETE FROM t1 WHERE a=1; |
643 | UPDATE t1 SET a=3 WHERE a=2; |
644 | COMMIT; |
645 | ERROR HY000: Got error 131 during COMMIT |
646 | +SET innodb_fake_changes=0; |
647 | +CHECK TABLE t1; |
648 | +Table Op Msg_type Msg_text |
649 | +test.t1 check status OK |
650 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
651 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
652 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
653 | +SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
654 | +SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
655 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
656 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
657 | should_be_1 |
658 | 1 |
659 | -should_be_0 |
660 | -0 |
661 | -should_be_0 |
662 | -0 |
663 | -should_be_0 |
664 | -0 |
665 | -should_be_0 |
666 | -0 |
667 | -should_be_0 |
668 | -0 |
669 | -should_be_0 |
670 | -0 |
671 | -SET innodb_fake_changes=0; |
672 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
673 | +should_be_0 |
674 | +0 |
675 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
676 | +should_be_0 |
677 | +0 |
678 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
679 | +should_be_0 |
680 | +0 |
681 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
682 | +should_be_0 |
683 | +0 |
684 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
685 | +should_be_0 |
686 | +0 |
687 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
688 | +should_be_0 |
689 | +0 |
690 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
691 | +should_be_0 |
692 | +0 |
693 | +SHOW INDEXES IN t1; |
694 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
695 | +t1 0 PRIMARY 1 a A 2 NULL NULL BTREE |
696 | DROP TABLE t2; |
697 | CREATE TABLE t3 (a INT primary key, b text) ENGINE=InnoDB; |
698 | INSERT INTO t3 VALUES (1,''); |
699 | -COMMIT; |
700 | +SELECT @@global.userstat = 1 AS should_be_1; |
701 | +should_be_1 |
702 | +1 |
703 | +ANALYZE TABLE t3; |
704 | +Table Op Msg_type Msg_text |
705 | +test.t3 analyze status OK |
706 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
707 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
708 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
709 | +SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3'; |
710 | +SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3'; |
711 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3'; |
712 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3'; |
713 | +SHOW INDEXES IN t3; |
714 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
715 | +t3 0 PRIMARY 1 a A 1 NULL NULL BTREE |
716 | SET innodb_fake_changes=1; |
717 | +BEGIN; |
718 | UPDATE t3 set b=lpad('b',11000,'c') where a=1; |
719 | COMMIT; |
720 | ERROR HY000: Got error 131 during COMMIT |
721 | -SET innodb_fake_changes=default; |
722 | -# Verify that the fake changes to t3 did not leak through |
723 | +SET innodb_fake_changes=0; |
724 | CHECK TABLE t3; |
725 | Table Op Msg_type Msg_text |
726 | test.t3 check status OK |
727 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
728 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
729 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
730 | +SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3'; |
731 | +SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3'; |
732 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3'; |
733 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3'; |
734 | should_be_1 |
735 | 1 |
736 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
737 | +should_be_0 |
738 | +0 |
739 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
740 | +should_be_0 |
741 | +0 |
742 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
743 | +should_be_0 |
744 | +0 |
745 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
746 | +should_be_0 |
747 | +0 |
748 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
749 | +should_be_0 |
750 | +0 |
751 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
752 | +should_be_0 |
753 | +0 |
754 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
755 | +should_be_0 |
756 | +0 |
757 | +SHOW INDEXES IN t3; |
758 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
759 | +t3 0 PRIMARY 1 a A 1 NULL NULL BTREE |
760 | DROP TABLE t1, t3; |
761 | SET @@GLOBAL.userstat= default; |
762 | |
763 | === modified file 'Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_898306.result' |
764 | --- Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_898306.result 2012-10-17 11:30:19 +0000 |
765 | +++ Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_898306.result 2013-07-15 16:29:43 +0000 |
766 | @@ -1,7 +1,25 @@ |
767 | DROP TABLE IF EXISTS t1; |
768 | +SET @@GLOBAL.userstat=ON; |
769 | CREATE TABLE t1 (a INT primary key, b int, unique key (b)) ENGINE=InnoDB; |
770 | INSERT INTO t1 VALUES (1,1); |
771 | SET autocommit=1; |
772 | +SELECT @@global.userstat = 1 AS should_be_1; |
773 | +should_be_1 |
774 | +1 |
775 | +ANALYZE TABLE t1; |
776 | +Table Op Msg_type Msg_text |
777 | +test.t1 analyze status OK |
778 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
779 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
780 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
781 | +SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
782 | +SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
783 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
784 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
785 | +SHOW INDEXES IN t1; |
786 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
787 | +t1 0 PRIMARY 1 a A 1 NULL NULL BTREE |
788 | +t1 0 b 1 b A 1 NULL NULL YES BTREE |
789 | SET innodb_fake_changes=1; |
790 | # Confirm that duplicate key errors on REPLACE works |
791 | REPLACE INTO t1 VALUES (1,1); |
792 | @@ -34,10 +52,42 @@ |
793 | INSERT INTO t1 VALUES (1,2) ON DUPLICATE KEY UPDATE b=b+10; |
794 | ERROR HY000: Got error 131 during COMMIT |
795 | SET innodb_fake_changes=0; |
796 | -SELECT * from t1; |
797 | -a b |
798 | -1 1 |
799 | CHECK TABLE t1; |
800 | Table Op Msg_type Msg_text |
801 | test.t1 check status OK |
802 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
803 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
804 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
805 | +SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
806 | +SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
807 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
808 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
809 | +should_be_1 |
810 | +1 |
811 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
812 | +should_be_0 |
813 | +0 |
814 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
815 | +should_be_0 |
816 | +0 |
817 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
818 | +should_be_0 |
819 | +0 |
820 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
821 | +should_be_0 |
822 | +0 |
823 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
824 | +should_be_0 |
825 | +0 |
826 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
827 | +should_be_0 |
828 | +0 |
829 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
830 | +should_be_0 |
831 | +0 |
832 | +SHOW INDEXES IN t1; |
833 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
834 | +t1 0 PRIMARY 1 a A 1 NULL NULL BTREE |
835 | +t1 0 b 1 b A 1 NULL NULL YES BTREE |
836 | DROP TABLE t1; |
837 | +SET @@GLOBAL.userstat=default; |
838 | |
839 | === modified file 'Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_917942.result' |
840 | --- Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_917942.result 2012-10-16 11:18:45 +0000 |
841 | +++ Percona-Server/mysql-test/r/percona_innodb_fake_changes_bug_917942.result 2013-07-15 16:29:43 +0000 |
842 | @@ -1,7 +1,24 @@ |
843 | DROP TABLE IF EXISTS t1; |
844 | +SET @@GLOBAL.userstat=ON; |
845 | Test compressed |
846 | CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB KEY_BLOCK_SIZE=8; |
847 | INSERT INTO t1 VALUES(NULL, LPAD("v", 2, "b"), LPAD("a", 100, "b")); |
848 | +SELECT @@global.userstat = 1 AS should_be_1; |
849 | +should_be_1 |
850 | +1 |
851 | +ANALYZE TABLE t1; |
852 | +Table Op Msg_type Msg_text |
853 | +test.t1 analyze status OK |
854 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
855 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
856 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
857 | +SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
858 | +SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
859 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
860 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
861 | +SHOW INDEXES IN t1; |
862 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
863 | +t1 0 PRIMARY 1 id A 1 NULL NULL BTREE |
864 | SET innodb_fake_changes=1; |
865 | INSERT INTO t1 VALUES(1, "foo", LPAD("a", 4600, "b")) ON DUPLICATE KEY UPDATE T = VALUES(T); |
866 | ERROR HY000: Got error 131 during COMMIT |
867 | @@ -11,12 +28,59 @@ |
868 | CHECK TABLE t1; |
869 | Table Op Msg_type Msg_text |
870 | test.t1 check status OK |
871 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
872 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
873 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
874 | +SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
875 | +SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
876 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
877 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
878 | should_be_1 |
879 | 1 |
880 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
881 | +should_be_0 |
882 | +0 |
883 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
884 | +should_be_0 |
885 | +0 |
886 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
887 | +should_be_0 |
888 | +0 |
889 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
890 | +should_be_0 |
891 | +0 |
892 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
893 | +should_be_0 |
894 | +0 |
895 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
896 | +should_be_0 |
897 | +0 |
898 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
899 | +should_be_0 |
900 | +0 |
901 | +SHOW INDEXES IN t1; |
902 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
903 | +t1 0 PRIMARY 1 id A 1 NULL NULL BTREE |
904 | DROP TABLE t1; |
905 | Test for uncompressed |
906 | CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB; |
907 | INSERT INTO t1 VALUES(NULL, LPAD("v", 2, "b"), LPAD("a", 100, "b")); |
908 | +SELECT @@global.userstat = 1 AS should_be_1; |
909 | +should_be_1 |
910 | +1 |
911 | +ANALYZE TABLE t1; |
912 | +Table Op Msg_type Msg_text |
913 | +test.t1 analyze status OK |
914 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
915 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
916 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
917 | +SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
918 | +SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
919 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
920 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
921 | +SHOW INDEXES IN t1; |
922 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
923 | +t1 0 PRIMARY 1 id A 1 NULL NULL BTREE |
924 | SET innodb_fake_changes=1; |
925 | ERROR HY000: Got error 131 during COMMIT |
926 | ERROR HY000: Got error 131 during COMMIT |
927 | @@ -122,11 +186,58 @@ |
928 | CHECK TABLE t1; |
929 | Table Op Msg_type Msg_text |
930 | test.t1 check status OK |
931 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
932 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
933 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
934 | +SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
935 | +SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
936 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
937 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
938 | should_be_1 |
939 | 1 |
940 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
941 | +should_be_0 |
942 | +0 |
943 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
944 | +should_be_0 |
945 | +0 |
946 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
947 | +should_be_0 |
948 | +0 |
949 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
950 | +should_be_0 |
951 | +0 |
952 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
953 | +should_be_0 |
954 | +0 |
955 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
956 | +should_be_0 |
957 | +0 |
958 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
959 | +should_be_0 |
960 | +0 |
961 | +SHOW INDEXES IN t1; |
962 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
963 | +t1 0 PRIMARY 1 id A 1 NULL NULL BTREE |
964 | DROP TABLE t1; |
965 | CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB KEY_BLOCK_SIZE=8; |
966 | INSERT INTO t1 VALUES(2, LPAD("v", 2, "b"), LPAD("a", 200, "b")); |
967 | +SELECT @@global.userstat = 1 AS should_be_1; |
968 | +should_be_1 |
969 | +1 |
970 | +ANALYZE TABLE t1; |
971 | +Table Op Msg_type Msg_text |
972 | +test.t1 analyze status OK |
973 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
974 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted'; |
975 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated'; |
976 | +SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
977 | +SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
978 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
979 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
980 | +SHOW INDEXES IN t1; |
981 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
982 | +t1 0 PRIMARY 1 id A 1 NULL NULL BTREE |
983 | SET innodb_fake_changes=1; |
984 | INSERT INTO t1 VALUES (3, "foo", LPAD("a", 4600, "b")); |
985 | ERROR HY000: Got error 131 during COMMIT |
986 | @@ -134,8 +245,39 @@ |
987 | CHECK TABLE t1; |
988 | Table Op Msg_type Msg_text |
989 | test.t1 check status OK |
990 | +SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted'; |
991 | +SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'; |
992 | +SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'; |
993 | +SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
994 | +SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
995 | +SELECT ROWS_CHANGED_X_INDEXES INTO @table_rows_changed_x_indexes_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'; |
996 | +SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'; |
997 | should_be_1 |
998 | 1 |
999 | +SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0; |
1000 | +should_be_0 |
1001 | +0 |
1002 | +SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0; |
1003 | +should_be_0 |
1004 | +0 |
1005 | +SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0; |
1006 | +should_be_0 |
1007 | +0 |
1008 | +SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0; |
1009 | +should_be_0 |
1010 | +0 |
1011 | +SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0; |
1012 | +should_be_0 |
1013 | +0 |
1014 | +SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0; |
1015 | +should_be_0 |
1016 | +0 |
1017 | +SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0; |
1018 | +should_be_0 |
1019 | +0 |
1020 | +SHOW INDEXES IN t1; |
1021 | +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment |
1022 | +t1 0 PRIMARY 1 id A 1 NULL NULL BTREE |
1023 | DROP TABLE t1; |
1024 | CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB; |
1025 | INSERT INTO t1 VALUES(2, LPAD("v", 3, "b"), LPAD("a", 100, "b")); |
1026 | @@ -149,3 +291,4 @@ |
1027 | should_be_1 |
1028 | 1 |
1029 | DROP TABLE t1; |
1030 | +SET @@GLOBAL.userstat=default; |
1031 | |
1032 | === modified file 'Percona-Server/mysql-test/t/percona_innodb_fake_changes.test' |
1033 | --- Percona-Server/mysql-test/t/percona_innodb_fake_changes.test 2013-05-06 15:43:51 +0000 |
1034 | +++ Percona-Server/mysql-test/t/percona_innodb_fake_changes.test 2013-07-15 16:29:43 +0000 |
1035 | @@ -4,7 +4,6 @@ |
1036 | DROP TABLE IF EXISTS t1, t2, t3; |
1037 | --enable_warnings |
1038 | |
1039 | - |
1040 | --echo # Checking variables |
1041 | SHOW VARIABLES LIKE 'innodb_fake_changes'; |
1042 | SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes'; |
1043 | @@ -17,21 +16,13 @@ |
1044 | |
1045 | --echo # Explicit COMMIT should fail when innodb_fake_changes is enabled |
1046 | --echo # DML should be fine |
1047 | -SET @@GLOBAL.userstat= TRUE; |
1048 | +SET @@GLOBAL.userstat=TRUE; |
1049 | CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
1050 | INSERT INTO t1 VALUES (1); |
1051 | |
1052 | -let $t1_checksum_1= `CHECKSUM TABLE t1 EXTENDED`; |
1053 | -let $innodb_rows_inserted_1= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_inserted'`; |
1054 | -let $innodb_rows_deleted_1= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'`; |
1055 | -let $innodb_rows_updated_1= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'`; |
1056 | -let $table_rows_estimate_1= `SELECT NUM_ROWS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'`; |
1057 | -let $table_dml_counter_1= `SELECT MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'`; |
1058 | -let $table_rows_changed_1= `SELECT ROWS_CHANGED FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'`; |
1059 | -let $table_rows_changed_x_indexes_1= `SELECT ROWS_CHANGED_X_INDEXES FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'`; |
1060 | +--let $fake_changes_table=t1 |
1061 | +--source include/start_fake_changes.inc |
1062 | |
1063 | -SET autocommit=0; |
1064 | -SET innodb_fake_changes=1; |
1065 | BEGIN; |
1066 | INSERT INTO t1 VALUES (2); |
1067 | UPDATE t1 SET a=0; |
1068 | @@ -39,107 +30,340 @@ |
1069 | SELECT * FROM t1; |
1070 | --error 1180 |
1071 | COMMIT; |
1072 | -SET innodb_fake_changes=default; |
1073 | ---echo # Verify that the fake changes to t1 did not leak through |
1074 | -CHECK TABLE t1; |
1075 | -let $t1_checksum_2= `CHECKSUM TABLE t1 EXTENDED`; |
1076 | -let $innodb_rows_inserted_2= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_inserted'`; |
1077 | -let $innodb_rows_deleted_2= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'`; |
1078 | -let $innodb_rows_updated_2= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'`; |
1079 | -let $table_rows_estimate_2= `SELECT NUM_ROWS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'`; |
1080 | -let $table_dml_counter_2= `SELECT MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1'`; |
1081 | -let $table_rows_changed_2= `SELECT ROWS_CHANGED FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'`; |
1082 | -let $table_rows_changed_x_indexes_2= `SELECT ROWS_CHANGED_X_INDEXES FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1'`; |
1083 | ---disable_query_log |
1084 | -eval SELECT "$t1_checksum_1" LIKE "$t1_checksum_2" AS should_be_1; |
1085 | -eval SELECT "$innodb_rows_inserted_2" - "$innodb_rows_inserted_1" AS should_be_0; |
1086 | -eval SELECT "$innodb_rows_deleted_2" - "$innodb_rows_deleted_1" AS should_be_0; |
1087 | -eval SELECT "$innodb_rows_updated_2" - "$innodb_rows_updated_1" AS should_be_0; |
1088 | -eval SELECT "$table_rows_estimate_2" - "$table_rows_estimate_1" AS should_be_0; |
1089 | -eval SELECT "$table_dml_counter_2" - "$table_dml_counter_1" AS should_be_0; |
1090 | -eval SELECT "$table_rows_changed_2" - "$table_rows_changed_1" AS should_be_0; |
1091 | -eval SELECT "$table_rows_changed_x_indexes_2" - "$table_rows_changed_x_indexes_1" AS should_be_0; |
1092 | ---enable_query_log |
1093 | -DROP TABLE t1; |
1094 | + |
1095 | +--source include/stop_fake_changes.inc |
1096 | + |
1097 | +DROP TABLE t1; |
1098 | + |
1099 | +# |
1100 | +# Test primary and secondary index access |
1101 | +# |
1102 | +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, UNIQUE KEY (b)) ENGINE=InnoDB; |
1103 | +INSERT INTO t1 VALUES (1,1); |
1104 | + |
1105 | +--source include/start_fake_changes.inc |
1106 | + |
1107 | +# Test with autocommit |
1108 | +--error ER_ERROR_DURING_COMMIT |
1109 | +SELECT * FROM t1; |
1110 | +--error ER_ERROR_DURING_COMMIT |
1111 | +INSERT INTO t1 VALUES (2,2); |
1112 | +--error ER_DUP_ENTRY |
1113 | +UPDATE t1 SET a=0 where b=1; |
1114 | +--error ER_ERROR_DURING_COMMIT |
1115 | +UPDATE t1 SET b=0 where a=1; |
1116 | +--error ER_ERROR_DURING_COMMIT |
1117 | +UPDATE t1 SET b=0 where a=2; |
1118 | +--error ER_ERROR_DURING_COMMIT |
1119 | +DELETE FROM t1 where b=2; |
1120 | +--error ER_ERROR_DURING_COMMIT |
1121 | +DELETE FROM t1 where b=1; |
1122 | +--error ER_ERROR_DURING_COMMIT |
1123 | +DELETE FROM t1 where a=2; |
1124 | +--error ER_ERROR_DURING_COMMIT |
1125 | +DELETE FROM t1 where a=1; |
1126 | +--error ER_ERROR_DURING_COMMIT |
1127 | +REPLACE INTO t1 values (2,3); |
1128 | + |
1129 | +# Test with transactions |
1130 | +BEGIN; |
1131 | +SELECT * FROM t1; |
1132 | +--error ER_ERROR_DURING_COMMIT |
1133 | +COMMIT; |
1134 | + |
1135 | +BEGIN; |
1136 | +INSERT INTO t1 VALUES (2,2); |
1137 | +--error ER_ERROR_DURING_COMMIT |
1138 | +COMMIT; |
1139 | + |
1140 | +BEGIN; |
1141 | +--error ER_DUP_ENTRY |
1142 | +UPDATE t1 SET a=0 where b=1; |
1143 | +--error ER_ERROR_DURING_COMMIT |
1144 | +COMMIT; |
1145 | + |
1146 | +BEGIN; |
1147 | +UPDATE t1 SET b=0 where a=1; |
1148 | +--error ER_ERROR_DURING_COMMIT |
1149 | +COMMIT; |
1150 | + |
1151 | +BEGIN; |
1152 | +UPDATE t1 SET b=0 where a=2; |
1153 | +--error ER_ERROR_DURING_COMMIT |
1154 | +COMMIT; |
1155 | + |
1156 | +BEGIN; |
1157 | +DELETE FROM t1 where b=2; |
1158 | +--error ER_ERROR_DURING_COMMIT |
1159 | +COMMIT; |
1160 | + |
1161 | +BEGIN; |
1162 | +DELETE FROM t1 where b=1; |
1163 | +--error ER_ERROR_DURING_COMMIT |
1164 | +COMMIT; |
1165 | + |
1166 | +BEGIN; |
1167 | +DELETE FROM t1 where a=2; |
1168 | +--error ER_ERROR_DURING_COMMIT |
1169 | +COMMIT; |
1170 | + |
1171 | +BEGIN; |
1172 | +DELETE FROM t1 where a=1; |
1173 | +--error ER_ERROR_DURING_COMMIT |
1174 | +COMMIT; |
1175 | + |
1176 | +BEGIN; |
1177 | +REPLACE INTO t1 values (2,3); |
1178 | +--error ER_ERROR_DURING_COMMIT |
1179 | +COMMIT; |
1180 | + |
1181 | +--error ER_ERROR_DURING_COMMIT |
1182 | +INSERT INTO t1 VALUES (1,1) ON DUPLICATE KEY UPDATE b=2; |
1183 | +--error ER_ERROR_DURING_COMMIT |
1184 | +CREATE INDEX bx ON t1(b); |
1185 | + |
1186 | +--source include/stop_fake_changes.inc |
1187 | + |
1188 | +DROP TABLE t1; |
1189 | + |
1190 | +# |
1191 | +# Test all accesses through the primary index |
1192 | +# |
1193 | +CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; |
1194 | +INSERT INTO t2 VALUES (1, 1); |
1195 | + |
1196 | +--let $fake_changes_table=t2 |
1197 | +--source include/start_fake_changes.inc |
1198 | + |
1199 | +# Test with autocommit |
1200 | +--error ER_ERROR_DURING_COMMIT |
1201 | +SELECT * FROM t2; |
1202 | +--error ER_ERROR_DURING_COMMIT |
1203 | +INSERT INTO t2 VALUES (2,2); |
1204 | +--error ER_ERROR_DURING_COMMIT |
1205 | +UPDATE t2 SET b=0 where a=1; |
1206 | +--error ER_ERROR_DURING_COMMIT |
1207 | +UPDATE t2 SET b=0 where a=2; |
1208 | +--error ER_ERROR_DURING_COMMIT |
1209 | +DELETE FROM t2 where b=2; |
1210 | +--error ER_ERROR_DURING_COMMIT |
1211 | +DELETE FROM t2 where b=1; |
1212 | +--error ER_ERROR_DURING_COMMIT |
1213 | +DELETE FROM t2 where a=2; |
1214 | +--error ER_ERROR_DURING_COMMIT |
1215 | +DELETE FROM t2 where a=1; |
1216 | +--error ER_ERROR_DURING_COMMIT |
1217 | +REPLACE INTO t2 values (2,3); |
1218 | +--error ER_ERROR_DURING_COMMIT |
1219 | +REPLACE INTO t2 VALUES (1,1); |
1220 | +--error ER_ERROR_DURING_COMMIT |
1221 | +REPLACE INTO t2 VALUES (1,2); |
1222 | + |
1223 | +# Test with transactions |
1224 | +BEGIN; |
1225 | +SELECT * FROM t2; |
1226 | +--error ER_ERROR_DURING_COMMIT |
1227 | +COMMIT; |
1228 | + |
1229 | +BEGIN; |
1230 | +INSERT INTO t2 VALUES (2,2); |
1231 | +--error ER_ERROR_DURING_COMMIT |
1232 | +COMMIT; |
1233 | + |
1234 | +BEGIN; |
1235 | +UPDATE t2 SET b=0 where a=1; |
1236 | +--error ER_ERROR_DURING_COMMIT |
1237 | +COMMIT; |
1238 | + |
1239 | +BEGIN; |
1240 | +UPDATE t2 SET b=0 where a=2; |
1241 | +--error ER_ERROR_DURING_COMMIT |
1242 | +COMMIT; |
1243 | + |
1244 | +BEGIN; |
1245 | +DELETE FROM t2 where b=2; |
1246 | +--error ER_ERROR_DURING_COMMIT |
1247 | +COMMIT; |
1248 | + |
1249 | +BEGIN; |
1250 | +DELETE FROM t2 where b=1; |
1251 | +--error ER_ERROR_DURING_COMMIT |
1252 | +COMMIT; |
1253 | + |
1254 | +BEGIN; |
1255 | +DELETE FROM t2 where a=2; |
1256 | +--error ER_ERROR_DURING_COMMIT |
1257 | +COMMIT; |
1258 | + |
1259 | +BEGIN; |
1260 | +DELETE FROM t2 where a=1; |
1261 | +--error ER_ERROR_DURING_COMMIT |
1262 | +COMMIT; |
1263 | + |
1264 | +BEGIN; |
1265 | +REPLACE INTO t2 values (2,3); |
1266 | +--error ER_ERROR_DURING_COMMIT |
1267 | +COMMIT; |
1268 | + |
1269 | +BEGIN; |
1270 | +REPLACE INTO t2 VALUES (1,1); |
1271 | +--error ER_ERROR_DURING_COMMIT |
1272 | +COMMIT; |
1273 | + |
1274 | +BEGIN; |
1275 | +REPLACE INTO t2 VALUES (1,2); |
1276 | +--error ER_ERROR_DURING_COMMIT |
1277 | +COMMIT; |
1278 | + |
1279 | +# Confirm that duplicate key errors are OK |
1280 | +BEGIN; |
1281 | +REPLACE INTO t2 VALUES (1,2); |
1282 | +SELECT * from t2; |
1283 | +REPLACE INTO t2 VALUES (1,1); |
1284 | +SELECT * from t2; |
1285 | +ROLLBACK; |
1286 | + |
1287 | +BEGIN; |
1288 | +--error ER_DUP_ENTRY |
1289 | +INSERT INTO t2 VALUES (1,1); |
1290 | +--error ER_DUP_ENTRY |
1291 | +INSERT INTO t2 VALUES (1,2); |
1292 | +ROLLBACK; |
1293 | + |
1294 | +--error ER_ERROR_DURING_COMMIT |
1295 | +INSERT INTO t2 VALUES (1,1) ON DUPLICATE KEY UPDATE b=2; |
1296 | +--error ER_ERROR_DURING_COMMIT |
1297 | +INSERT INTO t2 VALUES (1,1) ON DUPLICATE KEY UPDATE b=b+10; |
1298 | +--error ER_ERROR_DURING_COMMIT |
1299 | +INSERT INTO t2 VALUES (1,2) ON DUPLICATE KEY UPDATE b=b+10; |
1300 | +--error ER_ERROR_DURING_COMMIT |
1301 | +CREATE INDEX bx ON t2(b); |
1302 | + |
1303 | +--source include/stop_fake_changes.inc |
1304 | + |
1305 | +DROP TABLE t2; |
1306 | + |
1307 | +# |
1308 | +# Test TEXT |
1309 | +# |
1310 | +CREATE TABLE t3 (a INT PRIMARY KEY, B TEXT) ENGINE=InnoDB; |
1311 | +INSERT INTO t3 VALUES (1, ''); |
1312 | + |
1313 | +--let $fake_changes_table=t3 |
1314 | +--source include/start_fake_changes.inc |
1315 | + |
1316 | +# Test with autocommit |
1317 | +--error ER_ERROR_DURING_COMMIT |
1318 | +SELECT * FROM t3; |
1319 | +--error ER_ERROR_DURING_COMMIT |
1320 | +INSERT INTO t3 VALUES (2,lpad('a',10000, 'b')); |
1321 | +--error ER_ERROR_DURING_COMMIT |
1322 | +UPDATE t3 SET a=0 where a=1; |
1323 | +--error ER_ERROR_DURING_COMMIT |
1324 | +DELETE FROM t3 where a=2; |
1325 | +--error ER_ERROR_DURING_COMMIT |
1326 | +DELETE FROM t3 where a=1; |
1327 | +--error ER_ERROR_DURING_COMMIT |
1328 | +REPLACE INTO t3 values (2,lpad('a',9000,'q')); |
1329 | +--error ER_ERROR_DURING_COMMIT |
1330 | +INSERT INTO t3 VALUES (1,1) ON DUPLICATE KEY UPDATE b=lpad('b',11000,'c'); |
1331 | + |
1332 | +# Test with transactions |
1333 | +BEGIN; |
1334 | +SELECT * FROM t3; |
1335 | +--error ER_ERROR_DURING_COMMIT |
1336 | +COMMIT; |
1337 | + |
1338 | +BEGIN; |
1339 | +INSERT INTO t3 VALUES (2,lpad('a',10000, 'b')); |
1340 | +--error ER_ERROR_DURING_COMMIT |
1341 | +COMMIT; |
1342 | + |
1343 | +BEGIN; |
1344 | +UPDATE t3 SET a=0 where a=1; |
1345 | +--error ER_ERROR_DURING_COMMIT |
1346 | +COMMIT; |
1347 | + |
1348 | +BEGIN; |
1349 | +DELETE FROM t3 where a=2; |
1350 | +--error ER_ERROR_DURING_COMMIT |
1351 | +COMMIT; |
1352 | + |
1353 | +BEGIN; |
1354 | +DELETE FROM t3 where a=1; |
1355 | +--error ER_ERROR_DURING_COMMIT |
1356 | +COMMIT; |
1357 | + |
1358 | +BEGIN; |
1359 | +REPLACE INTO t3 values (2,lpad('a',9000,'q')); |
1360 | +--error ER_ERROR_DURING_COMMIT |
1361 | +COMMIT; |
1362 | + |
1363 | +BEGIN; |
1364 | +INSERT INTO t3 VALUES (1,1) ON DUPLICATE KEY UPDATE b=lpad('b',11000,'c'); |
1365 | +--error ER_ERROR_DURING_COMMIT |
1366 | +COMMIT; |
1367 | + |
1368 | +--source include/stop_fake_changes.inc |
1369 | + |
1370 | +DROP TABLE t3; |
1371 | |
1372 | --echo # DDL must result in error |
1373 | CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
1374 | -SET autocommit=0; |
1375 | -SET innodb_fake_changes=1; |
1376 | + |
1377 | +--let $fake_changes_table=t1 |
1378 | +--source include/start_fake_changes.inc |
1379 | + |
1380 | BEGIN; |
1381 | --error ER_ILLEGAL_HA |
1382 | CREATE TABLE t2 (a INT) ENGINE=InnoDB; |
1383 | --error 1051 |
1384 | DROP TABLE t1; |
1385 | ---error 1180 |
1386 | +--error 1031 |
1387 | TRUNCATE TABLE t1; |
1388 | --error 1180 |
1389 | ALTER TABLE t1 ENGINE=MyISAM; |
1390 | ROLLBACK; |
1391 | |
1392 | +--source include/stop_fake_changes.inc |
1393 | + |
1394 | # Test stat counters foreign key constraints |
1395 | -SET innodb_fake_changes=0; |
1396 | INSERT INTO t1 VALUES (1), (2); |
1397 | -COMMIT; |
1398 | + |
1399 | CREATE TABLE t2 (a INT PRIMARY KEY, b INT, INDEX b_ind (b), |
1400 | FOREIGN KEY (b) REFERENCES t1(a) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB; |
1401 | INSERT INTO t2 VALUES (1, 1); |
1402 | INSERT INTO t2 VALUES (2, 2); |
1403 | COMMIT; |
1404 | |
1405 | -let $t2_checksum_1= `CHECKSUM TABLE t2 EXTENDED`; |
1406 | -let $innodb_rows_deleted_1= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'`; |
1407 | -let $innodb_rows_updated_1= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'`; |
1408 | -let $table_rows_estimate_1= `SELECT NUM_ROWS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2'`; |
1409 | -let $table_dml_counter_1= `SELECT MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2'`; |
1410 | -let $table_rows_changed_1= `SELECT ROWS_CHANGED FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't2'`; |
1411 | -let $table_rows_changed_x_indexes_1= `SELECT ROWS_CHANGED_X_INDEXES FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't2'`; |
1412 | +--let $fake_changes_table=t1 |
1413 | +--source include/start_fake_changes.inc |
1414 | |
1415 | -SET innodb_fake_changes=1; |
1416 | +BEGIN; |
1417 | DELETE FROM t1 WHERE a=1; |
1418 | UPDATE t1 SET a=3 WHERE a=2; |
1419 | --error 1180 |
1420 | COMMIT; |
1421 | |
1422 | -let $t2_checksum_2= `CHECKSUM TABLE t2 EXTENDED`; |
1423 | -let $innodb_rows_deleted_2= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted'`; |
1424 | -let $innodb_rows_updated_2= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated'`; |
1425 | -let $table_rows_estimate_2= `SELECT NUM_ROWS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2'`; |
1426 | -let $table_dml_counter_2= `SELECT MODIFIED_COUNTER FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2'`; |
1427 | -let $table_rows_changed_2= `SELECT ROWS_CHANGED FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't2'`; |
1428 | -let $table_rows_changed_x_indexes_2= `SELECT ROWS_CHANGED_X_INDEXES FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't2'`; |
1429 | - |
1430 | ---disable_query_log |
1431 | -eval SELECT "$t2_checksum_1" LIKE "$t2_checksum_2" AS should_be_1; |
1432 | -eval SELECT "$innodb_rows_deleted_2" - "$innodb_rows_deleted_1" AS should_be_0; |
1433 | -eval SELECT "$innodb_rows_updated_2" - "$innodb_rows_updated_1" AS should_be_0; |
1434 | -eval SELECT "$table_rows_estimate_2" - "$table_rows_estimate_1" AS should_be_0; |
1435 | -eval SELECT "$table_rows_estimate_2" - "$table_rows_estimate_1" AS should_be_0; |
1436 | -eval SELECT "$table_rows_changed_2" - "$table_rows_changed_1" AS should_be_0; |
1437 | -eval SELECT "$table_rows_changed_x_indexes_2" - "$table_rows_changed_x_indexes_1" AS should_be_0; |
1438 | ---enable_query_log |
1439 | - |
1440 | -SET innodb_fake_changes=0; |
1441 | +--source include/stop_fake_changes.inc |
1442 | + |
1443 | DROP TABLE t2; |
1444 | |
1445 | # Test for bug 890404: uninitialized value warning in btr_cur_pessimistic_update |
1446 | CREATE TABLE t3 (a INT primary key, b text) ENGINE=InnoDB; |
1447 | INSERT INTO t3 VALUES (1,''); |
1448 | -COMMIT; |
1449 | let $t3_checksum_1= `CHECKSUM TABLE t3 EXTENDED`; |
1450 | -SET innodb_fake_changes=1; |
1451 | - |
1452 | + |
1453 | +--let $fake_changes_table=t3 |
1454 | +--source include/start_fake_changes.inc |
1455 | + |
1456 | +BEGIN; |
1457 | UPDATE t3 set b=lpad('b',11000,'c') where a=1; |
1458 | --error ER_ERROR_DURING_COMMIT |
1459 | COMMIT; |
1460 | |
1461 | -SET innodb_fake_changes=default; |
1462 | ---echo # Verify that the fake changes to t3 did not leak through |
1463 | -CHECK TABLE t3; |
1464 | -let $t3_checksum_2= `CHECKSUM TABLE t3 EXTENDED`; |
1465 | ---disable_query_log |
1466 | -eval SELECT "$t3_checksum_1" LIKE "$t3_checksum_2" AS should_be_1; |
1467 | ---enable_query_log |
1468 | +--source include/stop_fake_changes.inc |
1469 | + |
1470 | DROP TABLE t1, t3; |
1471 | |
1472 | SET @@GLOBAL.userstat= default; |
1473 | |
1474 | === modified file 'Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_898306.test' |
1475 | --- Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_898306.test 2012-10-17 11:30:19 +0000 |
1476 | +++ Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_898306.test 2013-07-15 16:29:43 +0000 |
1477 | @@ -7,11 +7,15 @@ |
1478 | DROP TABLE IF EXISTS t1; |
1479 | --enable_warnings |
1480 | |
1481 | +SET @@GLOBAL.userstat=ON; |
1482 | + |
1483 | CREATE TABLE t1 (a INT primary key, b int, unique key (b)) ENGINE=InnoDB; |
1484 | INSERT INTO t1 VALUES (1,1); |
1485 | |
1486 | SET autocommit=1; |
1487 | -SET innodb_fake_changes=1; |
1488 | + |
1489 | +--let $fake_changes_table=t1 |
1490 | +--source include/start_fake_changes.inc |
1491 | |
1492 | --echo # Confirm that duplicate key errors on REPLACE works |
1493 | |
1494 | @@ -52,8 +56,8 @@ |
1495 | --error ER_ERROR_DURING_COMMIT |
1496 | INSERT INTO t1 VALUES (1,2) ON DUPLICATE KEY UPDATE b=b+10; |
1497 | |
1498 | -SET innodb_fake_changes=0; |
1499 | -SELECT * from t1; |
1500 | -CHECK TABLE t1; |
1501 | +--source include/stop_fake_changes.inc |
1502 | |
1503 | DROP TABLE t1; |
1504 | + |
1505 | +SET @@GLOBAL.userstat=default; |
1506 | |
1507 | === modified file 'Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942.test' |
1508 | --- Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942.test 2012-10-17 11:30:19 +0000 |
1509 | +++ Percona-Server/mysql-test/t/percona_innodb_fake_changes_bug_917942.test 2013-07-15 16:29:43 +0000 |
1510 | @@ -7,6 +7,8 @@ |
1511 | DROP TABLE IF EXISTS t1; |
1512 | --enable_warnings |
1513 | |
1514 | +SET @@GLOBAL.userstat=ON; |
1515 | + |
1516 | # |
1517 | # Confirm that cursor->tree_height is initialized when calling btr_cur_pessimistic_update |
1518 | # for transactions with innodb_fake_changes set |
1519 | @@ -16,30 +18,25 @@ |
1520 | CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB KEY_BLOCK_SIZE=8; |
1521 | |
1522 | INSERT INTO t1 VALUES(NULL, LPAD("v", 2, "b"), LPAD("a", 100, "b")); |
1523 | -let $t1_checksum_1= `CHECKSUM TABLE t1 EXTENDED`; |
1524 | |
1525 | -SET innodb_fake_changes=1; |
1526 | +--let $fake_changes_table=t1 |
1527 | +--source include/start_fake_changes.inc |
1528 | |
1529 | --error 1180 |
1530 | INSERT INTO t1 VALUES(1, "foo", LPAD("a", 4600, "b")) ON DUPLICATE KEY UPDATE T = VALUES(T); |
1531 | --error 1180 |
1532 | UPDATE t1 SET T = LPAD("A", 4600, "b"); |
1533 | |
1534 | -SET innodb_fake_changes=0; |
1535 | -CHECK TABLE t1; |
1536 | -let $t1_checksum_2= `CHECKSUM TABLE t1 EXTENDED`; |
1537 | ---disable_query_log |
1538 | -eval SELECT "$t1_checksum_1" LIKE "$t1_checksum_2" AS should_be_1; |
1539 | ---enable_query_log |
1540 | +--source include/stop_fake_changes.inc |
1541 | + |
1542 | DROP TABLE t1; |
1543 | |
1544 | --echo Test for uncompressed |
1545 | CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB; |
1546 | |
1547 | INSERT INTO t1 VALUES(NULL, LPAD("v", 2, "b"), LPAD("a", 100, "b")); |
1548 | -let $t1_checksum_1= `CHECKSUM TABLE t1 EXTENDED`; |
1549 | |
1550 | -SET innodb_fake_changes=1; |
1551 | +--source include/start_fake_changes.inc |
1552 | |
1553 | --disable_query_log |
1554 | let $x = 50; |
1555 | @@ -53,12 +50,8 @@ |
1556 | } |
1557 | --enable_query_log |
1558 | |
1559 | -SET innodb_fake_changes=0; |
1560 | -CHECK TABLE t1; |
1561 | -let $t1_checksum_2= `CHECKSUM TABLE t1 EXTENDED`; |
1562 | ---disable_query_log |
1563 | -eval SELECT "$t1_checksum_1" LIKE "$t1_checksum_2" AS should_be_1; |
1564 | ---enable_query_log |
1565 | +--source include/stop_fake_changes.inc |
1566 | + |
1567 | DROP TABLE t1; |
1568 | |
1569 | # |
1570 | @@ -69,19 +62,14 @@ |
1571 | CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB KEY_BLOCK_SIZE=8; |
1572 | |
1573 | INSERT INTO t1 VALUES(2, LPAD("v", 2, "b"), LPAD("a", 200, "b")); |
1574 | -let $t1_checksum_1= `CHECKSUM TABLE t1 EXTENDED`; |
1575 | |
1576 | -SET innodb_fake_changes=1; |
1577 | +--source include/start_fake_changes.inc |
1578 | |
1579 | --error 1180 |
1580 | INSERT INTO t1 VALUES (3, "foo", LPAD("a", 4600, "b")); |
1581 | |
1582 | -SET innodb_fake_changes=0; |
1583 | -CHECK TABLE t1; |
1584 | -let $t1_checksum_2= `CHECKSUM TABLE t1 EXTENDED`; |
1585 | ---disable_query_log |
1586 | -eval SELECT "$t1_checksum_1" LIKE "$t1_checksum_2" AS should_be_1; |
1587 | ---enable_query_log |
1588 | +--source include/stop_fake_changes.inc |
1589 | + |
1590 | DROP TABLE t1; |
1591 | |
1592 | CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT, v VARCHAR(200), t TEXT) ENGINE=INNODB; |
1593 | @@ -101,3 +89,5 @@ |
1594 | eval SELECT "$t1_checksum_1" LIKE "$t1_checksum_2" AS should_be_1; |
1595 | --enable_query_log |
1596 | DROP TABLE t1; |
1597 | + |
1598 | +SET @@GLOBAL.userstat=default; |
1599 | |
1600 | === modified file 'Percona-Server/mysql-test/t/percona_innodb_fake_changes_locks.test' |
1601 | --- Percona-Server/mysql-test/t/percona_innodb_fake_changes_locks.test 2012-10-11 14:18:34 +0000 |
1602 | +++ Percona-Server/mysql-test/t/percona_innodb_fake_changes_locks.test 2013-07-15 16:29:43 +0000 |
1603 | @@ -16,6 +16,7 @@ |
1604 | --connection conn1 |
1605 | --echo # Verifying that X_LOCK not acquired |
1606 | SET autocommit=0; |
1607 | +# Cannot use start_fake_changes.inc as conn2 issues real workload before reverting |
1608 | SET innodb_fake_changes=1; |
1609 | BEGIN; |
1610 | SELECT * FROM t1 FOR UPDATE; |
1611 | |
1612 | === modified file 'Percona-Server/sql/sql_insert.cc' |
1613 | --- Percona-Server/sql/sql_insert.cc 2013-06-25 13:13:06 +0000 |
1614 | +++ Percona-Server/sql/sql_insert.cc 2013-07-15 16:29:43 +0000 |
1615 | @@ -1860,7 +1860,7 @@ |
1616 | 2) do nothing on fake delete |
1617 | 3) goto #1 |
1618 | */ |
1619 | - if (table->file->is_fake_change_enabled(thd)) |
1620 | + if (unlikely(table->file->is_fake_change_enabled(thd))) |
1621 | goto ok_or_after_trg_err; |
1622 | /* Let us attempt do write_row() once more */ |
1623 | } |
1624 | |
1625 | === modified file 'Percona-Server/storage/innobase/btr/btr0cur.cc' |
1626 | --- Percona-Server/storage/innobase/btr/btr0cur.cc 2013-06-25 13:13:06 +0000 |
1627 | +++ Percona-Server/storage/innobase/btr/btr0cur.cc 2013-07-15 16:29:43 +0000 |
1628 | @@ -1251,7 +1251,7 @@ |
1629 | rec_t* rec; |
1630 | roll_ptr_t roll_ptr; |
1631 | |
1632 | - if (thr && thr_get_trx(thr)->fake_changes) { |
1633 | + if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) { |
1634 | /* skip LOCK, UNDO */ |
1635 | return(DB_SUCCESS); |
1636 | } |
1637 | @@ -1513,7 +1513,7 @@ |
1638 | goto fail_err; |
1639 | } |
1640 | |
1641 | - if (thr && thr_get_trx(thr)->fake_changes) { |
1642 | + if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) { |
1643 | /* skip CHANGE, LOG */ |
1644 | *big_rec = big_rec_vec; |
1645 | return(err); /* == DB_SUCCESS */ |
1646 | @@ -1718,7 +1718,7 @@ |
1647 | } |
1648 | } |
1649 | |
1650 | - if (thr && thr_get_trx(thr)->fake_changes) { |
1651 | + if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) { |
1652 | /* skip CHANGE, LOG */ |
1653 | if (n_reserved > 0) { |
1654 | fil_space_release_free_extents(index->space, |
1655 | @@ -1784,7 +1784,7 @@ |
1656 | |
1657 | ut_ad(thr || (flags & BTR_NO_LOCKING_FLAG)); |
1658 | |
1659 | - if (thr && thr_get_trx(thr)->fake_changes) { |
1660 | + if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) { |
1661 | /* skip LOCK, UNDO */ |
1662 | return(DB_SUCCESS); |
1663 | } |
1664 | @@ -2397,7 +2397,7 @@ |
1665 | goto func_exit; |
1666 | } |
1667 | |
1668 | - if (thr && thr_get_trx(thr)->fake_changes) { |
1669 | + if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) { |
1670 | /* skip CHANGE, LOG */ |
1671 | ut_ad(err == DB_SUCCESS); |
1672 | return(DB_SUCCESS); |
1673 | @@ -2724,7 +2724,7 @@ |
1674 | ut_ad(flags & BTR_KEEP_POS_FLAG); |
1675 | } |
1676 | |
1677 | - if (trx->fake_changes) { |
1678 | + if (UNIV_UNLIKELY(trx->fake_changes)) { |
1679 | /* skip CHANGE, LOG */ |
1680 | err = DB_SUCCESS; |
1681 | goto return_after_reservations; |
1682 | @@ -3056,9 +3056,9 @@ |
1683 | ut_ad(dict_index_is_clust(index)); |
1684 | ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets))); |
1685 | |
1686 | - if (thr && thr_get_trx(thr)->fake_changes) { |
1687 | - /* skip LOCK, UNDO, CHANGE, LOG */ |
1688 | - return(DB_SUCCESS); |
1689 | + if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) { |
1690 | + /* skip LOCK, UNDO, CHANGE, LOG */ |
1691 | + return(DB_SUCCESS); |
1692 | } |
1693 | |
1694 | err = lock_clust_rec_modify_check_and_lock(BTR_NO_LOCKING_FLAG, block, |
1695 | @@ -3199,7 +3199,7 @@ |
1696 | rec_t* rec; |
1697 | dberr_t err; |
1698 | |
1699 | - if (thr && thr_get_trx(thr)->fake_changes) { |
1700 | + if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) { |
1701 | /* skip LOCK, CHANGE, LOG */ |
1702 | return(DB_SUCCESS); |
1703 | } |
1704 | |
1705 | === modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc' |
1706 | --- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-07-15 16:29:41 +0000 |
1707 | +++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-07-15 16:29:43 +0000 |
1708 | @@ -3784,9 +3784,11 @@ |
1709 | trx_search_latch_release_if_reserved(trx); |
1710 | } |
1711 | |
1712 | - if (trx->fake_changes && |
1713 | + if (UNIV_UNLIKELY(trx->fake_changes && |
1714 | (commit_trx || |
1715 | - (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) { |
1716 | + (!thd_test_options(thd, |
1717 | + OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))))) { |
1718 | + |
1719 | /* rollback implicitly */ |
1720 | innobase_rollback(hton, thd, commit_trx); |
1721 | /* because debug assertion code complains, if something left */ |
1722 | @@ -9937,7 +9939,7 @@ |
1723 | |
1724 | trx = innobase_trx_allocate(thd); |
1725 | |
1726 | - if (trx->fake_changes) { |
1727 | + if (UNIV_UNLIKELY(trx->fake_changes)) { |
1728 | innobase_commit_low(trx); |
1729 | trx_free_for_mysql(trx); |
1730 | DBUG_RETURN(HA_ERR_WRONG_COMMAND); |
1731 | @@ -10309,7 +10311,7 @@ |
1732 | DBUG_RETURN(HA_ERR_CRASHED); |
1733 | } |
1734 | |
1735 | - if (prebuilt->trx->fake_changes) { |
1736 | + if (UNIV_UNLIKELY(prebuilt->trx->fake_changes)) { |
1737 | DBUG_RETURN(HA_ERR_WRONG_COMMAND); |
1738 | } |
1739 | |
1740 | @@ -10397,7 +10399,7 @@ |
1741 | |
1742 | trx = innobase_trx_allocate(thd); |
1743 | |
1744 | - if (trx->fake_changes) { |
1745 | + if (UNIV_UNLIKELY(trx->fake_changes)) { |
1746 | innobase_commit_low(trx); |
1747 | trx_free_for_mysql(trx); |
1748 | DBUG_RETURN(HA_ERR_WRONG_COMMAND); |
1749 | @@ -10527,7 +10529,7 @@ |
1750 | #endif |
1751 | trx = innobase_trx_allocate(thd); |
1752 | |
1753 | - if (trx->fake_changes) { |
1754 | + if (UNIV_UNLIKELY(trx->fake_changes)) { |
1755 | my_free(namebuf); |
1756 | innobase_commit_low(trx); |
1757 | trx_free_for_mysql(trx); |
1758 | @@ -10707,7 +10709,7 @@ |
1759 | trx_search_latch_release_if_reserved(parent_trx); |
1760 | |
1761 | trx = innobase_trx_allocate(thd); |
1762 | - if (trx->fake_changes) { |
1763 | + if (UNIV_UNLIKELY(trx->fake_changes)) { |
1764 | innobase_commit_low(trx); |
1765 | trx_free_for_mysql(trx); |
1766 | DBUG_RETURN(HA_ERR_WRONG_COMMAND); |
1767 | |
1768 | === modified file 'Percona-Server/storage/innobase/lock/lock0lock.cc' |
1769 | --- Percona-Server/storage/innobase/lock/lock0lock.cc 2013-06-25 13:13:06 +0000 |
1770 | +++ Percona-Server/storage/innobase/lock/lock0lock.cc 2013-07-15 16:29:43 +0000 |
1771 | @@ -4415,7 +4415,7 @@ |
1772 | |
1773 | trx = thr_get_trx(thr); |
1774 | |
1775 | - if (trx->fake_changes && mode == LOCK_IX) { |
1776 | + if (UNIV_UNLIKELY(trx->fake_changes && mode == LOCK_IX)) { |
1777 | mode = LOCK_IS; |
1778 | } |
1779 | |
1780 | @@ -5943,7 +5943,7 @@ |
1781 | |
1782 | trx = thr_get_trx(thr); |
1783 | |
1784 | - if (trx->fake_changes) { |
1785 | + if (UNIV_UNLIKELY(trx->fake_changes)) { |
1786 | return(DB_SUCCESS); |
1787 | } |
1788 | |
1789 | @@ -6159,7 +6159,7 @@ |
1790 | return(DB_SUCCESS); |
1791 | } |
1792 | |
1793 | - if (thr && thr_get_trx(thr)->fake_changes) { |
1794 | + if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) { |
1795 | return(DB_SUCCESS); |
1796 | } |
1797 | |
1798 | @@ -6225,7 +6225,7 @@ |
1799 | return(DB_SUCCESS); |
1800 | } |
1801 | |
1802 | - if (thr && thr_get_trx(thr)->fake_changes) { |
1803 | + if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) { |
1804 | return(DB_SUCCESS); |
1805 | } |
1806 | |
1807 | |
1808 | === modified file 'Percona-Server/storage/innobase/que/que0que.cc' |
1809 | --- Percona-Server/storage/innobase/que/que0que.cc 2013-05-10 09:39:17 +0000 |
1810 | +++ Percona-Server/storage/innobase/que/que0que.cc 2013-07-15 16:29:43 +0000 |
1811 | @@ -1273,7 +1273,7 @@ |
1812 | |
1813 | ut_a(trx->error_state == DB_SUCCESS); |
1814 | |
1815 | - if (trx->fake_changes) { |
1816 | + if (UNIV_UNLIKELY(trx->fake_changes)) { |
1817 | /* fake_changes should not access to system tables */ |
1818 | fprintf(stderr, "InnoDB: ERROR: innodb_fake_changes tried to access to system tables.\n"); |
1819 | return(DB_ERROR); |
1820 | |
1821 | === modified file 'Percona-Server/storage/innobase/row/row0upd.cc' |
1822 | --- Percona-Server/storage/innobase/row/row0upd.cc 2013-06-20 15:16:00 +0000 |
1823 | +++ Percona-Server/storage/innobase/row/row0upd.cc 2013-07-15 16:29:43 +0000 |
1824 | @@ -2015,7 +2015,7 @@ |
1825 | the previous invocation of this function. Mark the |
1826 | off-page columns in the entry inherited. */ |
1827 | |
1828 | - if (!(trx->fake_changes)) { |
1829 | + if (UNIV_LIKELY(!trx->fake_changes)) { |
1830 | change_ownership = row_upd_clust_rec_by_insert_inherit( |
1831 | NULL, NULL, entry, node->update); |
1832 | ut_a(change_ownership); |
Same comment as for the 5.5 MP.