~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/myisam.test

* Fixes drizzled's atomics:

- fetch_and_add() was actually add_and_fetch() - fixed to have both methods correct
- compare_and_swap() was incorrect for all traits classes.  Fixed to return a bool
true only when the supplied value is actually swapped
- fixes increment() and decrement() methods and operator+=() in outer atomics class
template to call proper add_and_fetch() methods on traits classes
- Now that above are fixed, removed the hacks in Query_id and TransactionLog to
have query ID and the new transactoin ID start properly at 1.

* Transaction messages sent over replication stream now use
a real transaction ID, managed by drizzled::TransactionServices.  Previously, 
the Query_id was being used, resulting in SELECT statements incrementing the
transaction ID.

* Added a test case to ensure that DDL ops are given a transaction ID and SELECT
ops do not increment the transaction ID.

The transaction ID will be paired with a channel ID to become the global
transaction identifier.  ReplicationServices will manage the pairing of
channel and transaction ID and understand how far a particular subscriber
node has applied.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
# Test problem with rows that are 65517-65520 bytes long
31
31
#
32
32
 
33
 
create temporary table t1 (a int not null auto_increment, b blob not null, primary key (a)) engine=myisam;
 
33
create table t1 (a int not null auto_increment, b blob not null, primary key (a));
34
34
 
35
35
let $1=100;
36
36
disable_query_log;
329
329
# Test of creating table with too long key
330
330
#
331
331
 
332
 
--error ER_TOO_LONG_KEY
 
332
--error 1071
333
333
CREATE TEMPORARY TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300), KEY t1 (a, b, c, d, e)) ENGINE=MyISAM;
334
334
CREATE TEMPORARY TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300)) ENGINE=MyISAM;
335
 
--error ER_TOO_LONG_KEY
 
335
--error 1071
336
336
ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
337
337
DROP TABLE t1;
338
338
 
342
342
 
343
343
CREATE TEMPORARY TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)) ENGINE=MyISAM;
344
344
INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4);
345
 
create temporary table t2 (a int not null, b int, c int, key(b), key(c), key(a)) engine=myisam;
 
345
create table t2 (a int not null, b int, c int, key(b), key(c), key(a));
346
346
INSERT into t2 values (1,1,1), (2,2,2);
347
347
alter table t1 ENGINE=MYISAM;
348
348
show index from t1;
361
361
# Test bug when updating a split dynamic row where keys are not changed
362
362
#
363
363
 
364
 
create temporary table t1 (a int not null auto_increment primary key, b varchar(255)) engine=myisam;
 
364
create table t1 (a int not null auto_increment primary key, b varchar(255));
365
365
insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100));
366
366
update t1 set b=repeat(left(b,1),200) where a=1;
367
367
 
441
441
#
442
442
# Verify blob handling
443
443
#
444
 
create temporary table t1 (a blob) engine=myisam;
 
444
create table t1 (a blob);
445
445
insert into t1 values('a '),('a');
446
446
select concat(a,'.') from t1 where a='a';
447
447
select concat(a,'.') from t1 where a='a ';
453
453
#
454
454
# Test text and unique
455
455
#
456
 
create temporary table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20))) engine=myisam;
 
456
create table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20)));
457
457
insert into t1 (b) values ('a'),('b'),('c');
458
458
select concat(b,'.') from t1;
459
459
update t1 set b='b ' where a=2;
469
469
#
470
470
# Test keys with 0 segments. (Bug #3203)
471
471
#
472
 
create temporary table t1 (a int not null) engine=myisam;
473
 
create temporary table t2 (a int not null, primary key (a)) engine=myisam;
 
472
create table t1 (a int not null);
 
473
create table t2 (a int not null, primary key (a));
474
474
insert into t1 values (1);
475
475
insert into t2 values (1),(2);
476
476
select sql_big_result distinct t1.a from t1,t2 order by t2.a;
494
494
 
495
495
# End of 4.0 tests
496
496
 
497
 
create temporary table t1 (a int, b varchar(200), c text not null) engine=myisam;
498
 
create temporary table t2 (a int, b varchar(200), c text not null) engine=myisam;
 
497
create table t1 (a int, b varchar(200), c text not null);
 
498
create table t2 (a int, b varchar(200), c text not null);
499
499
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
500
500
insert t2 select * from t1;
 
501
checksum table t1, t2, t3;
 
502
checksum table t1, t2, t3;
 
503
checksum table t1, t2, t3;
501
504
--replace_column 1 #  6 # 7 # 8 # 9 # 10 #
502
505
show table status;
503
506
drop table t1,t2;
531
534
#
532
535
# index search for NULL in blob. Bug #4816
533
536
#
534
 
create temporary table t1 ( a tinytext, b char(1), index idx (a(1),b) ) engine=myisam;
 
537
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
535
538
insert into t1 values (null,''), (null,'');
536
539
explain select count(*) from t1 where a is null;
537
540
select count(*) from t1 where a is null;
540
543
#
541
544
# bug9188 - Corruption Can't open file: 'table.MYI' (errno: 145)
542
545
#
543
 
create temporary table t1 (c1 int, c2 varchar(4) not null default '',
544
 
                 key(c2(3))) engine=myisam;
 
546
create table t1 (c1 int, c2 varchar(4) not null default '',
 
547
                 key(c2(3)));
545
548
insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
546
549
update t1 set c2='A  B' where c1=2;
547
550
check table t1;
548
551
drop table t1;
549
552
 
 
553
 
 
554
#
 
555
# Bug#12296 - CHECKSUM TABLE reports 0 for the table
 
556
# This happened if the first record was marked as deleted.
 
557
#
 
558
create table t1 (c1 int);
 
559
insert into t1 values (1),(2),(3),(4);
 
560
checksum table t1;
 
561
delete from t1 where c1 = 1;
 
562
create table t2 as select * from t1;
 
563
# The following returns 0 with the bug in place.
 
564
checksum table t1;
 
565
# The above should give the same number as the following.
 
566
checksum table t2;
 
567
drop table t1, t2;
 
568
 
550
569
# BUG#13814 - key value packed incorrectly for TINYBLOBs
551
570
 
552
 
create temporary table t1(
 
571
create table t1(
553
572
  cip INT NOT NULL,
554
573
  score INT NOT NULL DEFAULT 0,
555
574
  bob TINYBLOB
556
 
) engine=myisam;
 
575
);
557
576
 
558
577
insert into t1 (cip) VALUES (1), (2), (3);
559
578
insert into t1 (cip, bob) VALUES (4, 'a' ), (5, 'b'), 
596
615
#
597
616
# Bug#8283 - OPTIMIZE TABLE causes data loss
598
617
#
 
618
SET GLOBAL myisam_repair_threads=2;
 
619
SHOW VARIABLES LIKE 'myisam_repair%';
 
620
#
599
621
# Test OPTIMIZE. This creates a new data file.
600
622
CREATE TEMPORARY TABLE t1 (
601
623
  `_id` int NOT NULL default '0',
637
659
show table status LIKE 't1';
638
660
SELECT _id FROM t1;
639
661
DROP TABLE t1;
 
662
#
 
663
SET GLOBAL myisam_repair_threads=1;
 
664
SHOW VARIABLES LIKE 'myisam_repair%';
640
665
 
641
666
#
642
667
# Bug#24607 - MyISAM pointer size determined incorrectly
805
830
# Some errors/warnings on create
806
831
#
807
832
 
808
 
--error ER_TOO_BIG_FIELDLENGTH
 
833
--error 1074
809
834
create temporary table t1 (v varchar(65530), key(v));
810
 
--error ER_TOO_BIG_FIELDLENGTH
 
835
--error 1074
811
836
create temporary table t1 (v varchar(65536));
812
 
--error ER_TOO_BIG_FIELDLENGTH
 
837
--error 1074
813
838
create temporary table t1 (v varchar(65530));
814
839
 
815
840
# MyISAM specific varchar tests
816
 
--error ER_TOO_BIG_FIELDLENGTH
 
841
--error 1074
817
842
create temporary table t1 (v varchar(65535));
818
843
 
819
844
eval set storage_engine=$default;
821
846
 
822
847
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
823
848
# different statistics on the same table with NULL values.
824
 
create temporary table t1 (a int, key(a)) engine=myisam;
 
849
create table t1 (a int, key(a));
825
850
 
826
851
insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
827
852
analyze table t1;
875
900
#--exec myisamchk -dvv var/master-data/test/t1.MYI
876
901
#--exec myisamchk -iev var/master-data/test/t1.MYI
877
902
--echo # Enable keys with parallel repair
 
903
SET GLOBAL myisam_repair_threads=2;
878
904
ALTER TABLE t1 DISABLE KEYS;
879
905
ALTER TABLE t1 ENABLE KEYS;
 
906
SET GLOBAL myisam_repair_threads=1;
880
907
CHECK TABLE t1;
881
908
DROP TABLE t1;
882
909
 
899
926
 
900
927
 
901
928
#
 
929
# Test of key_block_size
 
930
#
 
931
 
 
932
create temporary table t1 (a int not null, key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
933
show create table t1;
 
934
drop table t1;
 
935
 
 
936
create temporary table t1 (a int not null, key `a` (a) key_block_size=2048) ENGINE=MyISAM;
 
937
show create table t1;
 
938
drop table t1;
 
939
 
 
940
create temporary table t1 (a varchar(2048), key `a` (a)) ENGINE=MyISAM;
 
941
show create table t1;
 
942
drop table t1;
 
943
 
 
944
create temporary table t1 (a varchar(2048), key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
945
show create table t1;
 
946
drop table t1;
 
947
 
 
948
create temporary table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=1024;
 
949
show create table t1;
 
950
alter table t1 key_block_size=2048;
 
951
show create table t1;
 
952
alter table t1 add c int, add key (c);
 
953
show create table t1;
 
954
alter table t1 key_block_size=0;
 
955
alter table t1 add d int, add key (d);
 
956
show create table t1;
 
957
drop table t1;
 
958
 
 
959
create temporary table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=8192;
 
960
show create table t1;
 
961
drop table t1;
 
962
 
 
963
create temporary table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) ENGINE=MyISAM key_block_size=8192;
 
964
show create table t1;
 
965
drop table t1;
 
966
 
 
967
create temporary table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) ENGINE=MyISAM key_block_size=16384;
 
968
show create table t1;
 
969
drop table t1;
 
970
 
 
971
 
 
972
# Test limits and errors of key_block_size
 
973
 
 
974
create temporary table t1 (a int not null, key `a` (a) key_block_size=512) ENGINE=MyISAM;
 
975
show create table t1;
 
976
drop table t1;
 
977
 
 
978
create temporary table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000) ENGINE=MyISAM;
 
979
show create table t1;
 
980
drop table t1;
 
981
 
 
982
create temporary table t1 (a int not null, key `a` (a) key_block_size=1025) ENGINE=MyISAM;
 
983
show create table t1;
 
984
drop table t1;
 
985
 
 
986
--error 1064
 
987
create temporary table t1 (a int not null, key key_block_size=1024 (a)) ENGINE=MyISAM;
 
988
--error 1064
 
989
create temporary table t1 (a int not null, key `a` key_block_size=1024 (a)) ENGINE=MyISAM;
 
990
 
 
991
#
902
992
# Bug#22119 - Changing MI_KEY_BLOCK_LENGTH makes a wrong myisamchk
903
993
#
904
994
CREATE temporary TABLE t1 (