~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/innodb.test

pandora-build v0.71. Added check for avahi.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
#                                                                     #
12
12
#######################################################################
13
13
 
14
 
SET @orig_lock_wait_timeout= @@innodb_lock_wait_timeout; 
15
 
SET GLOBAL innodb_lock_wait_timeout=2;
16
 
 
 
14
-- source include/have_innodb.inc
17
15
 
18
16
#
19
17
# Small basic test with ignore
69
67
explain select level,id,parent_id from t1 where level=1;
70
68
select level,id from t1 where level=1;
71
69
select level,id,parent_id from t1 where level=1;
72
 
alter table t1 ENGINE=innodb;
 
70
optimize table t1;
73
71
--replace_column 7 #
74
72
show keys from t1;
75
73
drop table t1;
96
94
 
97
95
create table t1 (a int) engine=innodb;
98
96
insert into t1 values (1), (2);
99
 
alter table t1 engine=innodb;
 
97
optimize table t1;
100
98
delete from t1 where a = 1;
101
99
select * from t1;
102
100
check table t1;
156
154
select n from t1;
157
155
savepoint savept3;
158
156
rollback to savepoint savept2;
159
 
--error ER_SP_DOES_NOT_EXIST
 
157
--error 1305
160
158
rollback to savepoint savept3;
161
159
rollback to savepoint savept2;
162
160
release savepoint `my_savepoint`;
163
161
select n from t1;
164
 
--error 1305
 
162
-- error 1305
165
163
rollback to savepoint `my_savepoint`;
 
164
--error 1305
166
165
rollback to savepoint savept2;
167
166
insert into t1 values (8);
168
167
savepoint sv;
183
182
flush tables with read lock;
184
183
#
185
184
# Current code can't handle a read lock in middle of transaction
186
 
#--error ER_CANT_UPDATE_WITH_READLOCK
 
185
#--error 1223;
187
186
commit;
188
187
unlock tables;
189
188
commit;
304
303
select * from t1;
305
304
update t1 set col2='7' where col1='4';
306
305
select * from t1;
307
 
ALTER TABLE t1 ADD co3 INT DEFAULT 42 NOT NULL;
 
306
alter table t1 add co3 int not null;
308
307
select * from t1;
309
308
update t1 set col2='9' where col1='2';
310
309
select * from t1;
431
430
create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb;
432
431
insert into t1 values("hello",1),("world",2);
433
432
select * from t1 order by b desc;
434
 
alter table t1 engine=innodb;
 
433
optimize table t1;
435
434
--replace_column 7 #
436
435
show keys from t1;
437
436
drop table t1;
534
533
insert into mysqltest.t1 values(1);
535
534
create TEMPORARY table mysqltest.t2 (a int not null) engine= myisam;
536
535
insert into mysqltest.t2 values(1);
537
 
create temporary table mysqltest.t3 (a int not null) engine= MEMORY;
 
536
create temporary table mysqltest.t3 (a int not null) engine= heap;
538
537
insert into mysqltest.t3 values(1);
539
538
commit;
540
539
drop database mysqltest;
541
540
# Don't check error message
542
 
--error ER_BAD_DB_ERROR
 
541
--error 1049
543
542
show tables from mysqltest;
544
543
 
545
544
#
836
835
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
837
836
insert t2 select * from t1;
838
837
insert t3 select * from t1;
839
 
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
 
838
checksum table t1, t2, t3, t4 quick;
 
839
checksum table t1, t2, t3, t4;
 
840
checksum table t1, t2, t3, t4 extended;
 
841
#show table status;
840
842
drop table t1,t2,t3;
841
843
 
842
844
#
868
870
create index id2 on t2 (id);
869
871
show create table t2;
870
872
drop index id2 on t2;
871
 
--error ER_ERROR_ON_RENAME, ER_ERROR_ON_RENAME
 
873
--error 1025,1025
872
874
drop index id on t2;
873
875
show create table t2;
874
876
drop table t2;
905
907
# Test error handling
906
908
 
907
909
# Embedded server doesn't chdir to data directory
908
 
--replace_result $DRIZZLETEST_VARDIR . master-data/ ''
 
910
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
909
911
--error ER_WRONG_FK_DEF
910
912
create table t2 (id int not null, id2 int not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
911
913
 
922
924
#
923
925
# Bug #6126: Duplicate columns in keys gives misleading error message
924
926
#
925
 
--error ER_DUP_FIELDNAME
 
927
--error 1060
926
928
create table t1 (c char(10), index (c,c)) engine=innodb;
927
 
--error ER_DUP_FIELDNAME
 
929
--error 1060
928
930
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
929
 
--error ER_DUP_FIELDNAME
 
931
--error 1060
930
932
create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
931
 
--error ER_DUP_FIELDNAME
 
933
--error 1060
932
934
create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
933
935
create table t1 (c1 char(10), c2 char(10)) engine=innodb;
934
 
--error ER_DUP_FIELDNAME
 
936
--error 1060
935
937
alter table t1 add key (c1,c1);
936
 
--error ER_DUP_FIELDNAME
 
938
--error 1060
937
939
alter table t1 add key (c2,c1,c1);
938
 
--error ER_DUP_FIELDNAME
 
940
--error 1060
939
941
alter table t1 add key (c1,c2,c1);
940
 
--error ER_DUP_FIELDNAME
 
942
--error 1060
941
943
alter table t1 add key (c1,c1,c2);
942
944
drop table t1;
943
945
 
1027
1029
## Not deterministic.
1028
1030
# Test for testable InnoDB status variables. This test
1029
1031
# uses previous ones(pages_created, rows_deleted, ...).
1030
 
--replace_column 2 #
1031
 
show status like "Innodb_buffer_pool_pages_total";
1032
 
--replace_column 2 #
1033
 
show status like "Innodb_page_size";
1034
 
--replace_column 2 #
1035
 
show status like "Innodb_rows_deleted";
1036
 
--replace_column 2 #
1037
 
show status like "Innodb_rows_inserted";
1038
 
--replace_column 2 #
1039
 
show status like "Innodb_rows_updated";
 
1032
#show status like "Innodb_buffer_pool_pages_total";
 
1033
#show status like "Innodb_page_size";
 
1034
#show status like "Innodb_rows_deleted";
 
1035
#show status like "Innodb_rows_inserted";
 
1036
#show status like "Innodb_rows_updated";
1040
1037
 
1041
1038
## Test for row locks InnoDB status variables.
1042
 
--replace_column 2 #
1043
 
show status like "Innodb_row_lock_waits";
1044
 
--replace_column 2 #
1045
 
show status like "Innodb_row_lock_current_waits";
1046
 
--replace_column 2 #
1047
 
show status like "Innodb_row_lock_time";
1048
 
--replace_column 2 #
1049
 
show status like "Innodb_row_lock_time_max";
1050
 
--replace_column 2 #
1051
 
show status like "Innodb_row_lock_time_avg";
 
1039
#show status like "Innodb_row_lock_waits";
 
1040
#show status like "Innodb_row_lock_current_waits";
 
1041
#show status like "Innodb_row_lock_time";
 
1042
#show status like "Innodb_row_lock_time_max";
 
1043
#show status like "Innodb_row_lock_time_avg";
1052
1044
 
1053
1045
# Test for innodb_sync_spin_loops variable
1054
1046
show variables like "innodb_sync_spin_loops";
1099
1091
#
1100
1092
 
1101
1093
# Embedded server doesn't chdir to data directory
1102
 
--replace_result $DRIZZLETEST_VARDIR . master-data/ ''
 
1094
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
1103
1095
create table t1 (v varchar(16383), key(v));
1104
1096
drop table t1;
1105
1097
create table t1 (v varchar(16383));
1151
1143
drop table t1;
1152
1144
 
1153
1145
#
 
1146
# Test that update does not change internal auto-increment value
 
1147
#
 
1148
 
 
1149
create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
 
1150
insert into t1 (val) values (1);
 
1151
update t1 set a=2 where a=1;
 
1152
# We should get the following error because InnoDB does not update the counter
 
1153
--error ER_DUP_ENTRY
 
1154
insert into t1 (val) values (1);
 
1155
select * from t1;
 
1156
drop table t1;
 
1157
#
1154
1158
# Bug #10465
1155
1159
#
1156
1160
 
1196
1200
 id INT PRIMARY KEY
1197
1201
) ENGINE=InnoDB;
1198
1202
 
1199
 
--error ER_CANT_CREATE_TABLE, ER_CANT_CREATE_TABLE
 
1203
--error 1005,1005
1200
1204
CREATE TEMPORARY TABLE t2
1201
1205
(
1202
1206
 id INT NOT NULL PRIMARY KEY,
1250
1254
drop table t1, t2, t3, t4;
1251
1255
 
1252
1256
# these should be refused
1253
 
--error ER_TOO_LONG_KEY
 
1257
--error 1071
1254
1258
create table t1 (col1 varchar(768) primary key)
1255
1259
 engine = innodb;
1256
 
--error ER_TOO_LONG_KEY
1257
 
create table t2 (col1 varbinary(1024) primary key)
 
1260
--error 1071
 
1261
create table t2 (col1 varbinary(768) primary key)
1258
1262
 engine = innodb;
1259
 
--error ER_TOO_LONG_KEY
 
1263
--error 1071
1260
1264
create table t3 (col1 text, primary key(col1(768)))
1261
1265
 engine = innodb;
1262
 
--error ER_TOO_LONG_KEY
1263
 
create table t4 (col1 blob, primary key(col1(1024)))
 
1266
--error 1071
 
1267
create table t4 (col1 blob, primary key(col1(768)))
1264
1268
 engine = innodb;
1265
1269
 
1266
1270
#
1278
1282
 CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
1279
1283
) ENGINE=InnoDB;
1280
1284
 
1281
 
--error ER_NO_REFERENCED_ROW_2
 
1285
--error 1452
1282
1286
INSERT INTO t2 VALUES(2);
1283
1287
 
1284
1288
INSERT INTO t1 VALUES(1);
1285
1289
INSERT INTO t2 VALUES(1);
1286
1290
 
1287
 
--error ER_ROW_IS_REFERENCED_2
 
1291
--error 1451
1288
1292
DELETE FROM t1 WHERE id = 1;
1289
1293
 
1290
 
--error ER_ROW_IS_REFERENCED
 
1294
--error 1217
1291
1295
DROP TABLE t1;
1292
1296
 
1293
1297
SET FOREIGN_KEY_CHECKS=0;
1294
1298
DROP TABLE t1;
1295
1299
SET FOREIGN_KEY_CHECKS=1;
1296
1300
 
1297
 
--error ER_NO_REFERENCED_ROW_2
 
1301
--error 1452
1298
1302
INSERT INTO t2 VALUES(3);
1299
1303
 
1300
1304
DROP TABLE t2;
 
1305
#
 
1306
# Test that checksum table uses a consistent read Bug #12669
 
1307
#
 
1308
connect (a,localhost,root,,);
 
1309
connect (b,localhost,root,,);
 
1310
connection a;
 
1311
create table t1(a int not null) engine=innodb;
 
1312
insert into t1 values (1),(2);
 
1313
set autocommit=0;
 
1314
checksum table t1;
 
1315
connection b;
 
1316
insert into t1 values(3);
 
1317
connection a;
 
1318
#
 
1319
# Here checksum should not see insert
 
1320
#
 
1321
checksum table t1;
 
1322
connection a;
 
1323
commit;
 
1324
checksum table t1;
 
1325
commit;
 
1326
drop table t1;
 
1327
#
 
1328
# autocommit = 1
 
1329
#
 
1330
connection a;
 
1331
create table t1(a int not null) engine=innodb;
 
1332
insert into t1 values (1),(2);
 
1333
set autocommit=1;
 
1334
checksum table t1;
 
1335
connection b;
 
1336
set autocommit=1;
 
1337
insert into t1 values(3);
 
1338
connection a;
 
1339
#
 
1340
# Here checksum sees insert
 
1341
#
 
1342
checksum table t1;
 
1343
drop table t1;
 
1344
 
 
1345
connection default;
 
1346
disconnect a;
 
1347
disconnect b;
1301
1348
 
1302
1349
# tests for bugs #9802 and #13778
1303
1350
 
1306
1353
set foreign_key_checks=0;
1307
1354
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
1308
1355
# Embedded server doesn't chdir to data directory
1309
 
--replace_result $DRIZZLETEST_VARDIR . master-data/ ''
 
1356
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
1310
1357
-- error 1005
1311
1358
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
1312
1359
set foreign_key_checks=1;
1364
1411
                 b varchar(255),
1365
1412
                 c varchar(255),
1366
1413
                 d varchar(255),
1367
 
                 key (a(200),b(200),c(200),d(200))) engine=innodb;
 
1414
                 key (a,b,c,d)) engine=innodb;
1368
1415
drop table t1;
1369
1416
--error ER_TOO_LONG_KEY
1370
1417
create table t1 (a varchar(255),
1579
1626
#
1580
1627
# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update
1581
1628
#
1582
 
--error ER_LOCK_WAIT_TIMEOUT
 
1629
--error 1205
1583
1630
select * from t1 where a = 2 and b = 2 for update;
1584
1631
#
1585
1632
# X-lock to record (1,1),(3,1),(5,1) should not be released in a update
1586
1633
#
1587
 
--error ER_LOCK_WAIT_TIMEOUT
 
1634
--error 1205
1588
1635
connection a;
1589
1636
commit;
1590
1637
connection b;
1714
1761
create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
1715
1762
 
1716
1763
connection b;
1717
 
--error ER_LOCK_WAIT_TIMEOUT
 
1764
--error 1205
1718
1765
reap;
1719
1766
 
1720
1767
connection c;
1721
 
--error ER_LOCK_WAIT_TIMEOUT
 
1768
--error 1205
1722
1769
reap;
1723
1770
 
1724
1771
connection d;
1725
 
--error ER_LOCK_WAIT_TIMEOUT
 
1772
--error 1205
1726
1773
reap;
1727
1774
 
1728
1775
connection e;
1729
 
--error ER_LOCK_WAIT_TIMEOUT
 
1776
--error 1205
1730
1777
reap;
1731
1778
 
1732
1779
connection f;
1733
 
--error ER_LOCK_WAIT_TIMEOUT
 
1780
--error 1205
1734
1781
reap;
1735
1782
 
1736
1783
connection g;
1737
 
--error ER_LOCK_WAIT_TIMEOUT
 
1784
--error 1205
1738
1785
reap;
1739
1786
 
1740
1787
connection h;
1741
 
--error ER_LOCK_WAIT_TIMEOUT
 
1788
--error 1205
1742
1789
reap;
1743
1790
 
1744
1791
connection i;
1745
 
--error ER_LOCK_WAIT_TIMEOUT
 
1792
--error 1205
1746
1793
reap;
1747
1794
 
1748
1795
connection j;
1749
 
--error ER_LOCK_WAIT_TIMEOUT
 
1796
--error 1205
1750
1797
reap;
1751
1798
 
1752
1799
connection a;
1766
1813
drop table t1, t2, t3, t5, t6, t8, t9;
1767
1814
 
1768
1815
# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
1769
 
--error ER_CANT_CREATE_TABLE,1166
 
1816
--error 1005
1770
1817
CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
1771
1818
 
1772
1819
#
1810
1857
CREATE TABLE t1 ( a int ) ENGINE=innodb;
1811
1858
BEGIN;
1812
1859
INSERT INTO t1 VALUES (1);
1813
 
ALTER TABLE t1 ENGINE=innodb;
 
1860
OPTIMIZE TABLE t1;
1814
1861
DROP TABLE t1;
1815
1862
 
1816
1863
#
1842
1889
# mysqltest first does replace_regex, then replace_result
1843
1890
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
1844
1891
# Embedded server doesn't chdir to data directory
1845
 
--replace_result $DRIZZLETEST_VARDIR . master-data/ ''
1846
 
--error ER_ERROR_ON_RENAME
 
1892
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
 
1893
--error 1025
1847
1894
ALTER TABLE t2 MODIFY a INT NOT NULL;
1848
1895
DELETE FROM t1;
1849
1896
DROP TABLE t2,t1;
1899
1946
SELECT * FROM t1;
1900
1947
DROP TABLE t1;
1901
1948
 
1902
 
SET GLOBAL innodb_lock_wait_timeout=@orig_lock_wait_timeout ;
1903
 
 
1904
 
 
1905
1949
#######################################################################
1906
1950
#                                                                     #
1907
1951
# Please, DO NOT TOUCH this file as well as the innodb.result file.   #