1# Checking variables
2SHOW VARIABLES LIKE 'innodb_fake_changes';
3Variable_name	Value
4innodb_fake_changes	OFF
5SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
6VARIABLE_VALUE
7OFF
8SET innodb_fake_changes=1;
9SHOW VARIABLES LIKE 'innodb_fake_changes';
10Variable_name	Value
11innodb_fake_changes	ON
12SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
13VARIABLE_VALUE
14ON
15SET innodb_fake_changes=default;
16SHOW VARIABLES LIKE 'innodb_fake_changes';
17Variable_name	Value
18innodb_fake_changes	OFF
19SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_fake_changes';
20VARIABLE_VALUE
21OFF
22# Explicit COMMIT should fail when innodb_fake_changes is enabled
23# DML should be fine
24SET @saved_userstat=@@GLOBAL.userstat;
25SET @@GLOBAL.userstat=TRUE;
26SET @saved_innodb_stats_transient_sample_pages=@@GLOBAL.innodb_stats_transient_sample_pages;
27SET @@GLOBAL.innodb_stats_transient_sample_pages=30000;
28CREATE TABLE t1 (a INT) ENGINE=InnoDB;
29INSERT INTO t1 VALUES (1);
30SELECT @@global.userstat = 1 AS should_be_1;
31should_be_1
321
33SELECT @@global.innodb_stats_transient_sample_pages = 30000 AS should_be_1;
34should_be_1
351
36ANALYZE TABLE t1;
37Table	Op	Msg_type	Msg_text
38test.t1	analyze	status	OK
39SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
40SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted';
41SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated';
42SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
43SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1';
44SELECT 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';
45SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
46SHOW INDEXES IN t1;
47Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
48SET innodb_fake_changes=1;
49BEGIN;
50INSERT INTO t1 VALUES (2);
51UPDATE t1 SET a=0;
52DELETE FROM t1 LIMIT 1;
53SELECT * FROM t1;
54a
551
56COMMIT;
57ERROR HY000: Got error 131 during COMMIT
58SET innodb_fake_changes=0;
59CHECK TABLE t1;
60Table	Op	Msg_type	Msg_text
61test.t1	check	status	OK
62SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
63SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted';
64SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated';
65SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
66SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1';
67SELECT 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';
68SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
69should_be_1
701
71SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0;
72should_be_0
730
74SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0;
75should_be_0
760
77SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0;
78should_be_0
790
80SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0;
81should_be_0
820
83SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0;
84should_be_0
850
86SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0;
87should_be_0
880
89SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0;
90should_be_0
910
92SHOW INDEXES IN t1;
93Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
94DROP TABLE t1;
95CREATE TABLE t1 (a INT PRIMARY KEY, b INT, UNIQUE KEY (b)) ENGINE=InnoDB;
96INSERT INTO t1 VALUES (1,1);
97SELECT @@global.userstat = 1 AS should_be_1;
98should_be_1
991
100SELECT @@global.innodb_stats_transient_sample_pages = 30000 AS should_be_1;
101should_be_1
1021
103ANALYZE TABLE t1;
104Table	Op	Msg_type	Msg_text
105test.t1	analyze	status	OK
106SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
107SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted';
108SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated';
109SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
110SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1';
111SELECT 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';
112SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
113SHOW INDEXES IN t1;
114Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
115t1	0	PRIMARY	1	a	A	1	NULL	NULL		BTREE
116t1	0	b	1	b	A	1	NULL	NULL	YES	BTREE
117SET innodb_fake_changes=1;
118SELECT * FROM t1;
119a	b
1201	1
121INSERT INTO t1 VALUES (2,2);
122ERROR HY000: Got error 131 during COMMIT
123UPDATE t1 SET a=0 where b=1;
124ERROR 23000: Duplicate entry '1' for key 'b'
125UPDATE t1 SET b=0 where a=1;
126ERROR HY000: Got error 131 during COMMIT
127UPDATE t1 SET b=0 where a=2;
128ERROR HY000: Got error 131 during COMMIT
129DELETE FROM t1 where b=2;
130ERROR HY000: Got error 131 during COMMIT
131DELETE FROM t1 where b=1;
132ERROR HY000: Got error 131 during COMMIT
133DELETE FROM t1 where a=2;
134ERROR HY000: Got error 131 during COMMIT
135DELETE FROM t1 where a=1;
136ERROR HY000: Got error 131 during COMMIT
137REPLACE INTO t1 values (2,3);
138ERROR HY000: Got error 131 during COMMIT
139BEGIN;
140SELECT * FROM t1;
141a	b
1421	1
143COMMIT;
144ERROR HY000: Got error 131 during COMMIT
145BEGIN;
146INSERT INTO t1 VALUES (2,2);
147COMMIT;
148ERROR HY000: Got error 131 during COMMIT
149BEGIN;
150UPDATE t1 SET a=0 where b=1;
151ERROR 23000: Duplicate entry '1' for key 'b'
152COMMIT;
153ERROR HY000: Got error 131 during COMMIT
154BEGIN;
155UPDATE t1 SET b=0 where a=1;
156COMMIT;
157ERROR HY000: Got error 131 during COMMIT
158BEGIN;
159UPDATE t1 SET b=0 where a=2;
160COMMIT;
161ERROR HY000: Got error 131 during COMMIT
162BEGIN;
163DELETE FROM t1 where b=2;
164COMMIT;
165ERROR HY000: Got error 131 during COMMIT
166BEGIN;
167DELETE FROM t1 where b=1;
168COMMIT;
169ERROR HY000: Got error 131 during COMMIT
170BEGIN;
171DELETE FROM t1 where a=2;
172COMMIT;
173ERROR HY000: Got error 131 during COMMIT
174BEGIN;
175DELETE FROM t1 where a=1;
176COMMIT;
177ERROR HY000: Got error 131 during COMMIT
178BEGIN;
179REPLACE INTO t1 values (2,3);
180COMMIT;
181ERROR HY000: Got error 131 during COMMIT
182INSERT INTO t1 VALUES (1,1) ON DUPLICATE KEY UPDATE b=2;
183ERROR HY000: Got error 131 during COMMIT
184CREATE INDEX bx ON t1(b);
185ERROR HY000: Got error 131 during COMMIT
186SET innodb_fake_changes=0;
187CHECK TABLE t1;
188Table	Op	Msg_type	Msg_text
189test.t1	check	status	OK
190SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
191SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted';
192SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated';
193SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
194SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1';
195SELECT 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';
196SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
197should_be_1
1981
199SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0;
200should_be_0
2010
202SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0;
203should_be_0
2040
205SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0;
206should_be_0
2070
208SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0;
209should_be_0
2100
211SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0;
212should_be_0
2130
214SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0;
215should_be_0
2160
217SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0;
218should_be_0
2190
220SHOW INDEXES IN t1;
221Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
222t1	0	PRIMARY	1	a	A	1	NULL	NULL		BTREE
223t1	0	b	1	b	A	1	NULL	NULL	YES	BTREE
224DROP TABLE t1;
225CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
226INSERT INTO t2 VALUES (1, 1);
227SELECT @@global.userstat = 1 AS should_be_1;
228should_be_1
2291
230SELECT @@global.innodb_stats_transient_sample_pages = 30000 AS should_be_1;
231should_be_1
2321
233ANALYZE TABLE t2;
234Table	Op	Msg_type	Msg_text
235test.t2	analyze	status	OK
236SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
237SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted';
238SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated';
239SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2';
240SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't2';
241SELECT 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';
242SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2';
243SHOW INDEXES IN t2;
244Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
245t2	0	PRIMARY	1	a	A	1	NULL	NULL		BTREE
246SET innodb_fake_changes=1;
247SELECT * FROM t2;
248a	b
2491	1
250INSERT INTO t2 VALUES (2,2);
251ERROR HY000: Got error 131 during COMMIT
252UPDATE t2 SET b=0 where a=1;
253ERROR HY000: Got error 131 during COMMIT
254UPDATE t2 SET b=0 where a=2;
255ERROR HY000: Got error 131 during COMMIT
256DELETE FROM t2 where b=2;
257ERROR HY000: Got error 131 during COMMIT
258DELETE FROM t2 where b=1;
259ERROR HY000: Got error 131 during COMMIT
260DELETE FROM t2 where a=2;
261ERROR HY000: Got error 131 during COMMIT
262DELETE FROM t2 where a=1;
263ERROR HY000: Got error 131 during COMMIT
264REPLACE INTO t2 values (2,3);
265ERROR HY000: Got error 131 during COMMIT
266REPLACE INTO t2 VALUES (1,1);
267ERROR HY000: Got error 131 during COMMIT
268REPLACE INTO t2 VALUES (1,2);
269ERROR HY000: Got error 131 during COMMIT
270BEGIN;
271SELECT * FROM t2;
272a	b
2731	1
274COMMIT;
275ERROR HY000: Got error 131 during COMMIT
276BEGIN;
277INSERT INTO t2 VALUES (2,2);
278COMMIT;
279ERROR HY000: Got error 131 during COMMIT
280BEGIN;
281UPDATE t2 SET b=0 where a=1;
282COMMIT;
283ERROR HY000: Got error 131 during COMMIT
284BEGIN;
285UPDATE t2 SET b=0 where a=2;
286COMMIT;
287ERROR HY000: Got error 131 during COMMIT
288BEGIN;
289DELETE FROM t2 where b=2;
290COMMIT;
291ERROR HY000: Got error 131 during COMMIT
292BEGIN;
293DELETE FROM t2 where b=1;
294COMMIT;
295ERROR HY000: Got error 131 during COMMIT
296BEGIN;
297DELETE FROM t2 where a=2;
298COMMIT;
299ERROR HY000: Got error 131 during COMMIT
300BEGIN;
301DELETE FROM t2 where a=1;
302COMMIT;
303ERROR HY000: Got error 131 during COMMIT
304BEGIN;
305REPLACE INTO t2 values (2,3);
306COMMIT;
307ERROR HY000: Got error 131 during COMMIT
308BEGIN;
309REPLACE INTO t2 VALUES (1,1);
310COMMIT;
311ERROR HY000: Got error 131 during COMMIT
312BEGIN;
313REPLACE INTO t2 VALUES (1,2);
314COMMIT;
315ERROR HY000: Got error 131 during COMMIT
316BEGIN;
317REPLACE INTO t2 VALUES (1,2);
318SELECT * from t2;
319a	b
3201	1
321REPLACE INTO t2 VALUES (1,1);
322SELECT * from t2;
323a	b
3241	1
325ROLLBACK;
326BEGIN;
327INSERT INTO t2 VALUES (1,1);
328ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
329INSERT INTO t2 VALUES (1,2);
330ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
331ROLLBACK;
332INSERT INTO t2 VALUES (1,1) ON DUPLICATE KEY UPDATE b=2;
333ERROR HY000: Got error 131 during COMMIT
334INSERT INTO t2 VALUES (1,1) ON DUPLICATE KEY UPDATE b=b+10;
335ERROR HY000: Got error 131 during COMMIT
336INSERT INTO t2 VALUES (1,2) ON DUPLICATE KEY UPDATE b=b+10;
337ERROR HY000: Got error 131 during COMMIT
338CREATE INDEX bx ON t2(b);
339ERROR HY000: Got error 131 during COMMIT
340SET innodb_fake_changes=0;
341CHECK TABLE t2;
342Table	Op	Msg_type	Msg_text
343test.t2	check	status	OK
344SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
345SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted';
346SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated';
347SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2';
348SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't2';
349SELECT 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';
350SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t2';
351should_be_1
3521
353SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0;
354should_be_0
3550
356SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0;
357should_be_0
3580
359SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0;
360should_be_0
3610
362SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0;
363should_be_0
3640
365SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0;
366should_be_0
3670
368SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0;
369should_be_0
3700
371SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0;
372should_be_0
3730
374SHOW INDEXES IN t2;
375Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
376t2	0	PRIMARY	1	a	A	1	NULL	NULL		BTREE
377DROP TABLE t2;
378CREATE TABLE t3 (a INT PRIMARY KEY, B TEXT) ENGINE=InnoDB;
379INSERT INTO t3 VALUES (1, '');
380SELECT @@global.userstat = 1 AS should_be_1;
381should_be_1
3821
383SELECT @@global.innodb_stats_transient_sample_pages = 30000 AS should_be_1;
384should_be_1
3851
386ANALYZE TABLE t3;
387Table	Op	Msg_type	Msg_text
388test.t3	analyze	status	OK
389SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
390SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted';
391SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated';
392SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3';
393SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3';
394SELECT 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';
395SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3';
396SHOW INDEXES IN t3;
397Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
398t3	0	PRIMARY	1	a	A	1	NULL	NULL		BTREE
399SET innodb_fake_changes=1;
400SELECT * FROM t3;
401a	B
4021
403INSERT INTO t3 VALUES (2,lpad('a',10000, 'b'));
404ERROR HY000: Got error 131 during COMMIT
405UPDATE t3 SET a=0 where a=1;
406ERROR HY000: Got error 131 during COMMIT
407DELETE FROM t3 where a=2;
408ERROR HY000: Got error 131 during COMMIT
409DELETE FROM t3 where a=1;
410ERROR HY000: Got error 131 during COMMIT
411REPLACE INTO t3 values (2,lpad('a',9000,'q'));
412ERROR HY000: Got error 131 during COMMIT
413INSERT INTO t3 VALUES (1,1) ON DUPLICATE KEY UPDATE b=lpad('b',11000,'c');
414ERROR HY000: Got error 131 during COMMIT
415BEGIN;
416SELECT * FROM t3;
417a	B
4181
419COMMIT;
420ERROR HY000: Got error 131 during COMMIT
421BEGIN;
422INSERT INTO t3 VALUES (2,lpad('a',10000, 'b'));
423COMMIT;
424ERROR HY000: Got error 131 during COMMIT
425BEGIN;
426UPDATE t3 SET a=0 where a=1;
427COMMIT;
428ERROR HY000: Got error 131 during COMMIT
429BEGIN;
430DELETE FROM t3 where a=2;
431COMMIT;
432ERROR HY000: Got error 131 during COMMIT
433BEGIN;
434DELETE FROM t3 where a=1;
435COMMIT;
436ERROR HY000: Got error 131 during COMMIT
437BEGIN;
438REPLACE INTO t3 values (2,lpad('a',9000,'q'));
439COMMIT;
440ERROR HY000: Got error 131 during COMMIT
441BEGIN;
442INSERT INTO t3 VALUES (1,1) ON DUPLICATE KEY UPDATE b=lpad('b',11000,'c');
443COMMIT;
444ERROR HY000: Got error 131 during COMMIT
445SET innodb_fake_changes=0;
446CHECK TABLE t3;
447Table	Op	Msg_type	Msg_text
448test.t3	check	status	OK
449SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
450SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted';
451SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated';
452SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3';
453SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3';
454SELECT 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';
455SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3';
456should_be_1
4571
458SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0;
459should_be_0
4600
461SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0;
462should_be_0
4630
464SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0;
465should_be_0
4660
467SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0;
468should_be_0
4690
470SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0;
471should_be_0
4720
473SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0;
474should_be_0
4750
476SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0;
477should_be_0
4780
479SHOW INDEXES IN t3;
480Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
481t3	0	PRIMARY	1	a	A	1	NULL	NULL		BTREE
482DROP TABLE t3;
483# DDL must result in error
484CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
485SELECT @@global.userstat = 1 AS should_be_1;
486should_be_1
4871
488SELECT @@global.innodb_stats_transient_sample_pages = 30000 AS should_be_1;
489should_be_1
4901
491ANALYZE TABLE t1;
492Table	Op	Msg_type	Msg_text
493test.t1	analyze	status	OK
494SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
495SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted';
496SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated';
497SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
498SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1';
499SELECT 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';
500SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
501SHOW INDEXES IN t1;
502Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
503t1	0	PRIMARY	1	a	A	0	NULL	NULL		BTREE
504SET innodb_fake_changes=1;
505BEGIN;
506CREATE TABLE t2 (a INT) ENGINE=InnoDB;
507ERROR HY000: Table storage engine for 't2' doesn't have this option
508DROP TABLE t1;
509ERROR 42S02: Unknown table 'test.t1'
510TRUNCATE TABLE t1;
511ERROR HY000: Table storage engine for 't1' doesn't have this option
512ALTER TABLE t1 ENGINE=MyISAM;
513ERROR HY000: Got error 131 during COMMIT
514ROLLBACK;
515SET innodb_fake_changes=0;
516CHECK TABLE t1;
517Table	Op	Msg_type	Msg_text
518test.t1	check	status	OK
519SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
520SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted';
521SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated';
522SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
523SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1';
524SELECT 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';
525SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
526should_be_1
5271
528SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0;
529should_be_0
5300
531SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0;
532should_be_0
5330
534SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0;
535should_be_0
5360
537SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0;
538should_be_0
5390
540SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0;
541should_be_0
5420
543SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0;
544should_be_0
5450
546SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0;
547should_be_0
5480
549SHOW INDEXES IN t1;
550Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
551t1	0	PRIMARY	1	a	A	0	NULL	NULL		BTREE
552INSERT INTO t1 VALUES (1), (2);
553CREATE TABLE t2 (a INT PRIMARY KEY, b INT, INDEX b_ind (b),
554FOREIGN KEY (b) REFERENCES t1(a) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
555INSERT INTO t2 VALUES (1, 1);
556INSERT INTO t2 VALUES (2, 2);
557COMMIT;
558SELECT @@global.userstat = 1 AS should_be_1;
559should_be_1
5601
561SELECT @@global.innodb_stats_transient_sample_pages = 30000 AS should_be_1;
562should_be_1
5631
564ANALYZE TABLE t1;
565Table	Op	Msg_type	Msg_text
566test.t1	analyze	status	OK
567SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
568SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted';
569SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated';
570SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
571SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1';
572SELECT 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';
573SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
574SHOW INDEXES IN t1;
575Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
576t1	0	PRIMARY	1	a	A	2	NULL	NULL		BTREE
577SET innodb_fake_changes=1;
578BEGIN;
579DELETE FROM t1 WHERE a=1;
580UPDATE t1 SET a=3 WHERE a=2;
581COMMIT;
582ERROR HY000: Got error 131 during COMMIT
583SET innodb_fake_changes=0;
584CHECK TABLE t1;
585Table	Op	Msg_type	Msg_text
586test.t1	check	status	OK
587SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
588SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted';
589SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated';
590SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
591SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't1';
592SELECT 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';
593SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t1';
594should_be_1
5951
596SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0;
597should_be_0
5980
599SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0;
600should_be_0
6010
602SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0;
603should_be_0
6040
605SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0;
606should_be_0
6070
608SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0;
609should_be_0
6100
611SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0;
612should_be_0
6130
614SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0;
615should_be_0
6160
617SHOW INDEXES IN t1;
618Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
619t1	0	PRIMARY	1	a	A	2	NULL	NULL		BTREE
620DROP TABLE t2;
621CREATE TABLE t3 (a INT primary key, b text) ENGINE=InnoDB;
622INSERT INTO t3 VALUES (1,'');
623SELECT @@global.userstat = 1 AS should_be_1;
624should_be_1
6251
626SELECT @@global.innodb_stats_transient_sample_pages = 30000 AS should_be_1;
627should_be_1
6281
629ANALYZE TABLE t3;
630Table	Op	Msg_type	Msg_text
631test.t3	analyze	status	OK
632SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
633SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_deleted';
634SELECT VARIABLE_VALUE INTO @innodb_rows_updated_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_updated';
635SELECT NUM_ROWS INTO @table_rows_estimate_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3';
636SELECT ROWS_CHANGED INTO @table_rows_changed_1 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3';
637SELECT 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';
638SELECT MODIFIED_COUNTER INTO @table_dml_counter_1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3';
639SHOW INDEXES IN t3;
640Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
641t3	0	PRIMARY	1	a	A	1	NULL	NULL		BTREE
642SET innodb_fake_changes=1;
643BEGIN;
644UPDATE t3 set b=lpad('b',11000,'c') where a=1;
645COMMIT;
646ERROR HY000: Got error 131 during COMMIT
647SET innodb_fake_changes=0;
648CHECK TABLE t3;
649Table	Op	Msg_type	Msg_text
650test.t3	check	status	OK
651SELECT VARIABLE_VALUE INTO @innodb_rows_inserted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_rows_inserted';
652SELECT VARIABLE_VALUE INTO @innodb_rows_deleted_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_deleted';
653SELECT VARIABLE_VALUE INTO @innodb_rows_updated_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_rows_updated';
654SELECT NUM_ROWS INTO @table_rows_estimate_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3';
655SELECT ROWS_CHANGED INTO @table_rows_changed_2 FROM INFORMATION_SCHEMA.TABLE_STATISTICS WHERE TABLE_SCHEMA LIKE 'test' AND TABLE_NAME LIKE 't3';
656SELECT 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';
657SELECT MODIFIED_COUNTER INTO @table_dml_counter_2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE NAME LIKE 'test/t3';
658should_be_1
6591
660SELECT @innodb_rows_inserted_2 - @innodb_rows_inserted_1 AS should_be_0;
661should_be_0
6620
663SELECT @innodb_rows_deleted_2 - @innodb_rows_deleted_1 AS should_be_0;
664should_be_0
6650
666SELECT @innodb_rows_updated_2 - @innodb_rows_updated_1 AS should_be_0;
667should_be_0
6680
669SELECT @table_rows_estimate_2 - @table_rows_estimate_1 AS should_be_0;
670should_be_0
6710
672SELECT @table_rows_changed_2 - @table_rows_changed_1 AS should_be_0;
673should_be_0
6740
675SELECT @table_rows_changed_x_indexes_2 - @table_rows_changed_x_indexes_1 AS should_be_0;
676should_be_0
6770
678SELECT @table_dml_counter_2 - @table_dml_counter_1 AS should_be_0;
679should_be_0
6800
681SHOW INDEXES IN t3;
682Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
683t3	0	PRIMARY	1	a	A	1	NULL	NULL		BTREE
684DROP TABLE t1, t3;
685use test;
686create table t1 (i int, j blob, primary key pk(i)) engine=innodb;
687insert into t1 values (1, repeat('a', 8000));
688insert into t1 values (2, repeat('b', 8000));
689set session innodb_fake_changes = 1;
690insert into t1 values (3, repeat('c', 8000));
691ERROR HY000: Got error 131 during COMMIT
692set session innodb_fake_changes = 0;
693drop table t1;
694create table t1 (
695i int, j varchar(500), primary key pk(i), unique index sk(j)
696) engine=innodb;
697create procedure populate_t1()
698begin
699declare i int default 1;
700while (i <= 36) DO
701insert into t1 values (i, repeat(i, 250));
702set i = i + 1;
703end while;
704end|
705begin;
706call populate_t1();
707commit;
708set session innodb_fake_changes = 1;
709insert into t1 values (37, repeat(37, 250));
710ERROR HY000: Got error 131 during COMMIT
711set session innodb_fake_changes = 0;
712drop procedure populate_t1;
713drop table t1;
714use test;
715create table t1 (i int, key(i)) engine=innodb;
716set session innodb_fake_changes = 1;
717alter table t1 discard tablespace;
718ERROR HY000: Table storage engine for 't1' doesn't have this option
719alter table t1 add column b char;
720ERROR HY000: Got error 131 during COMMIT
721alter table t1 add column b char, algorithm=copy;
722ERROR HY000: Table storage engine for '#sql-temporary' doesn't have this option
723alter table t1 add column b char, algorithm=default;
724ERROR HY000: Got error 131 during COMMIT
725set session innodb_fake_changes = 0;
726drop table t1;
727use test;
728create table t1 (a int, primary key pk(a));
729alter table t1 add column b char;
730create index bx on t1(b);
731insert into t1 values (1, 0x41), (2, 0x41);
732set session innodb_fake_changes=1;
733update t1 set a = upper(a), b = lower(b);
734ERROR HY000: Got error 131 during COMMIT
735set session innodb_fake_changes=0;
736drop table t1;
737use test;
738create table t1 (c1 int);
739insert into t1 values (10);
740select * from t1;
741c1
74210
743set session innodb_fake_changes = 1;
744begin;
745insert into t1 values (10);
746select * from t1;
747c1
74810
749set session innodb_fake_changes = 0;
750replace into t1(c1) values (10);
751commit;
752ERROR HY000: Got error 131 during COMMIT
753select * from t1;
754c1
75510
756begin;
757insert into t1 values (11);
758insert into t1 values (12);
759set session innodb_fake_changes = 1;
760commit;
761set session innodb_fake_changes = 0;
762select * from t1;
763c1
76410
76511
76612
767begin;
768set session innodb_fake_changes = 1;
769insert into t1 values (11);
770insert into t1 values (12);
771commit;
772ERROR HY000: Got error 131 during COMMIT
773set session innodb_fake_changes = 0;
774drop table t1;
775use test;
776create table t1 (i int) engine=innodb;
777rename table t1 to t2;
778select * from t2;
779i
780set session innodb_fake_changes = 1;
781rename table t2 to t1;
782ERROR 42000: This version of MySQL doesn't yet support 'ALTER TABLE'
783set session innodb_fake_changes = 0;
784drop table t2;
785use test;
786create table t1 (i int, b blob, primary key pk(i)) engine=innodb;
787set session innodb_fake_changes=1;
788insert into t1 values (1, repeat('a', 20000));
789ERROR HY000: Got error 131 during COMMIT
790insert into t1 values (2, repeat('b', 20000));
791ERROR HY000: Got error 131 during COMMIT
792update t1 set b = repeat('c', 20000);
793ERROR HY000: Got error 131 during COMMIT
794set session innodb_fake_changes=0;
795drop table t1;
796create table t1 (i int) engine=innodb;
797insert into t1 values (1), (2);
798set session innodb_fake_changes = 1;
799select * from t1;
800i
8011
8022
803set @@session.default_storage_engine=innodb;
804create table t3 select * from t1;
805ERROR HY000: Table storage engine for 't3' doesn't have this option
806set @@session.default_storage_engine=myisam;
807create table t2 select * from t1;
808show create table t2;
809Table	Create Table
810t2	CREATE TABLE `t2` (
811  `i` int(11) DEFAULT NULL
812) ENGINE=MyISAM DEFAULT CHARSET=latin1
813select * from t2;
814i
8151
8162
817drop table t2;
818set session innodb_fake_changes = 0;
819set @@session.default_storage_engine=InnoDB;
820drop table t1;
821create table t1 (i int, j int) engine=innodb;
822insert into t1 values (1, 10), (2, 20), (3, 30);
823select * from t1;
824i	j
8251	10
8262	20
8273	30
828set session innodb_fake_changes = 1;
829select * from t1;
830i	j
8311	10
8322	20
8333	30
834begin;
835select * from t1;
836i	j
8371	10
8382	20
8393	30
840commit;
841ERROR HY000: Got error 131 during COMMIT
842insert into t1 select * from t1;
843ERROR HY000: Got error 131 during COMMIT
844select * from t1;
845i	j
8461	10
8472	20
8483	30
849set session innodb_fake_changes = 0;
850drop table t1;
851use test;
852create table t1 (i int, c char(100), fulltext fts(c)) engine=innodb;
853insert into t1 values (1, 'it is raining outside');
854insert into t1 values (2, 'good to see some rain during rainy season');
855select * from t1;
856i	c
8571	it is raining outside
8582	good to see some rain during rainy season
859set session innodb_fake_changes=1;
860insert into t1 values (3, 'climate has turned really rainy and humid too');
861ERROR HY000: Got error 131 during COMMIT
862select * from t1 where match(c) against ('rainy');
863i	c
8642	good to see some rain during rainy season
865update t1 set c='some test foobar' where match c against ('rain');
866ERROR HY000: Got error 131 during COMMIT
867delete from t1 where MATCH(c) AGAINST ("rainy");
868ERROR HY000: Got error 131 during COMMIT
869select * from t1;
870i	c
8711	it is raining outside
8722	good to see some rain during rainy season
873set session innodb_fake_changes=0;
874drop table t1;
875create table t1 (
876FTS_DOC_ID bigint unsigned key,
877title char(1),
878body text, fulltext(title,body)) engine=innodb;
879set session innodb_fake_changes=1;
880insert into t1 values(1,2,11),(1,2,7);
881ERROR HY000: Got error 131 during COMMIT
882set session innodb_fake_changes=0;
883drop table t1;
884SET @@GLOBAL.userstat= @saved_userstat;
885SET @@GLOBAL.innodb_stats_transient_sample_pages= @saved_innodb_stats_transient_sample_pages;
886