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