~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/myisam.test

  • Committer: Stewart Smith
  • Date: 2009-06-16 03:02:59 UTC
  • mto: This revision was merged to the branch mainline in revision 1065.
  • Revision ID: stewart@flamingspork.com-20090616030259-tn2thqrajk6cappd
ER_NISAMCHK is unused, mark it as so. Thanks to Paul DuBois for researching this for MySQL.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
enable_query_log;
47
47
check table t1;
48
48
repair table t1;
49
 
delete from t1 where (a & 1);
 
49
 
 
50
# @TODO Because there are no notes on what the heck this
 
51
# is actually testing (which bug?), it's difficult to tell
 
52
# what the below DELETE statement is doing.  Since we don't
 
53
# support bitwise operators, I am replacing the delete statement
 
54
# with a version we support.
 
55
#delete from t1 where (a & 1);
 
56
delete from t1 where (a mod 2) = 1;
50
57
check table t1;
51
58
repair table t1;
52
59
check table t1;
81
88
drop table t1;
82
89
 
83
90
#
84
 
# Test of OPTIMIZE of locked and modified tables
85
 
#
86
 
CREATE TABLE t1 (a INT);
87
 
INSERT INTO  t1 VALUES (1), (2), (3);
88
 
LOCK TABLES t1 WRITE;
89
 
INSERT INTO  t1 VALUES (1), (2), (3);
90
 
OPTIMIZE TABLE t1;
91
 
DROP TABLE t1;
92
 
 
93
 
#
94
91
# Test of optimize, when only mi_sort_index (but not mi_repair*) is done
95
92
# in ha_myisam::repair, and index size is changed (decreased).
96
93
#
257
254
int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
258
255
int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
259
256
int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
260
 
int, i999 int, i1000 int, b blob) row_format=dynamic;
 
257
int, i999 int, i1000 int, b blob) engine=myisam row_format=dynamic;
261
258
insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
262
259
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
263
260
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
309
306
# Test of REPAIR that once failed
310
307
#
311
308
CREATE TABLE `t1` (
312
 
  `post_id` mediumint(8) NOT NULL auto_increment,
313
 
  `topic_id` mediumint(8) NOT NULL default '0',
314
 
  `post_time` datetime NOT NULL default '0000-00-00 00:00:00',
 
309
  `post_id` int NOT NULL auto_increment,
 
310
  `topic_id` int NOT NULL default '0',
 
311
  `post_time` datetime,
315
312
  `post_text` text NOT NULL,
316
313
  `icon_url` varchar(10) NOT NULL default '',
317
 
  `sign` int(1) NOT NULL default '0',
 
314
  `sign` int NOT NULL default '0',
318
315
  `post_edit` varchar(150) NOT NULL default '',
319
316
  `poster_login` varchar(35) NOT NULL default '',
320
317
  `ip` varchar(15) NOT NULL default '',
322
319
  KEY `post_time` (`post_time`),
323
320
  KEY `ip` (`ip`),
324
321
  KEY `poster_login` (`poster_login`),
325
 
  KEY `topic_id` (`topic_id`),
326
 
  FULLTEXT KEY `post_text` (`post_text`)
 
322
  KEY `topic_id` (`topic_id`)
 
323
#  FULLTEXT KEY `post_text` (`post_text`)
327
324
) ENGINE=MyISAM;
328
325
 
329
326
INSERT INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test');
330
327
 
331
 
REPAIR TABLE t1;
 
328
# @TODO The REPAIR TABLE statement crashes server.
 
329
# Bug#309802: https://bugs.launchpad.net/drizzle/+bug/309802
 
330
# Commenting it out for now to proceed in testing. - JRP
 
331
# REPAIR TABLE t1;
332
332
CHECK TABLE t1;
333
333
drop table t1;
334
334
 
337
337
#
338
338
 
339
339
--error 1071
340
 
CREATE TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300), KEY t1 (a, b, c, d, e));
341
 
CREATE TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300));
 
340
CREATE 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;
 
341
CREATE TABLE t1 (a varchar(300), b varchar(300), c varchar(300), d varchar(300), e varchar(300)) ENGINE=MyISAM;
342
342
--error 1071
343
343
ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
344
344
DROP TABLE t1;
347
347
# Test of cardinality of keys with NULL
348
348
#
349
349
 
350
 
CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a));
 
350
CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)) ENGINE=MyISAM;
351
351
INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4);
352
352
create table t2 (a int not null, b int, c int, key(b), key(c), key(a));
353
353
INSERT into t2 values (1,1,1), (2,2,2);
371
371
create table t1 (a int not null auto_increment primary key, b varchar(255));
372
372
insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100));
373
373
update t1 set b=repeat(left(b,1),200) where a=1;
374
 
delete from t1 where (a & 1)= 0;
 
374
 
 
375
# @TODO Because there are no notes on what the heck this
 
376
# is actually testing (which bug?), it's difficult to tell
 
377
# what the below DELETE statement is doing.  Since we don't
 
378
# support bitwise operators, I am replacing the delete statement
 
379
# with a version we support.
 
380
#delete from t1 where (a & 1)= 0;
 
381
delete from t1 where (a mod 2) = 0;
375
382
update t1 set b=repeat('e',200) where a=1;
376
383
flush tables;
377
384
check table t1;
384
391
let $1 = 100;
385
392
while ($1)
386
393
{
387
 
  eval insert into t1 (b) values (repeat(char(($1 & 32)+65), $1));
 
394
  eval insert into t1 (b) values (repeat(char
 
395
    (
 
396
      if($1 < 32, 0, 
 
397
        if($1 >= 64 and $1 <= 95, 0, 32)
 
398
      )
 
399
    +65), $1));
388
400
  dec $1;
389
401
}
390
402
enable_query_log;
426
438
# space-stripping in _mi_prefix_search: BUG#5284
427
439
#
428
440
DROP TABLE IF EXISTS t1;
429
 
CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a)); 
 
441
CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a)) ENGINE=MyISAM; 
430
442
INSERT t1 VALUES ("can \tcan"); 
431
443
INSERT t1 VALUES ("can   can"); 
432
444
INSERT t1 VALUES ("can"); 
488
500
select c1 from t1 order by c1 limit 1;
489
501
drop table t1;
490
502
 
491
 
#
492
 
# Bug #14400  Join could miss concurrently inserted row
493
 
#
494
 
# Partial key.
495
 
create table t1 (a int not null, primary key(a));
496
 
create table t2 (a int not null, b int not null, primary key(a,b));
497
 
insert into t1 values (1),(2),(3),(4),(5),(6);
498
 
insert into t2 values (1,1),(2,1);
499
 
lock tables t1 read local, t2 read local;
500
 
select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
501
 
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
502
 
insert into t2 values(2,0);
503
 
disconnect root;
504
 
connection default;
505
 
select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
506
 
unlock tables;
507
 
drop table t1,t2;
508
 
#
509
 
# Full key.
510
 
CREATE TABLE t1 (c1 varchar(250) NOT NULL);
511
 
CREATE TABLE t2 (c1 varchar(250) NOT NULL, PRIMARY KEY (c1));
512
 
INSERT INTO t1 VALUES ('test000001'), ('test000002'), ('test000003');
513
 
INSERT INTO t2 VALUES ('test000002'), ('test000003'), ('test000004');
514
 
LOCK TABLES t1 READ LOCAL, t2 READ LOCAL;
515
 
SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
516
 
  WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
517
 
connect (con1,localhost,root,,);
518
 
connection con1;
519
 
INSERT INTO t2 VALUES ('test000001'), ('test000005');
520
 
disconnect con1;
521
 
connection default;
522
 
SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
523
 
  WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
524
 
UNLOCK TABLES;
525
 
DROP TABLE t1,t2;
526
 
 
527
503
# End of 4.0 tests
528
504
 
529
 
#
530
 
# Test RTREE index
531
 
#
532
 
--error 1235, 1289
533
 
CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM;
534
 
# INSERT INTO t1 VALUES (1,1),(1,1);
535
 
# DELETE FROM rt WHERE a<1;
536
 
# DROP TABLE IF EXISTS t1;
537
 
 
538
505
create table t1 (a int, b varchar(200), c text not null) checksum=1;
539
506
create table t2 (a int, b varchar(200), c text not null) checksum=0;
540
507
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
545
512
#show table status;
546
513
drop table t1,t2;
547
514
 
548
 
create table t1 (a int, key (a));
549
 
show keys from t1;
550
 
alter table t1 disable keys;
551
 
show keys from t1;
552
 
create table t2 (a int);
553
 
let $i=1000;
554
 
set @@rand_seed1=31415926,@@rand_seed2=2718281828;
555
 
--disable_query_log
556
 
while ($i)
557
 
{
558
 
  dec $i;
559
 
  insert t2 values (rand()*100000);
560
 
}
561
 
--enable_query_log
562
 
insert t1 select * from t2;
563
 
show keys from t1;
564
 
alter table t1 enable keys;
565
 
show keys from t1;
566
 
alter table t1 engine=heap;
567
 
alter table t1 disable keys;
568
 
show keys from t1;
569
 
drop table t1,t2;
 
515
#@TODO Figure out what the heck the below is testing.
 
516
#      It bombs the test with unknown system variables...
 
517
#
 
518
#create table t1 (a int, key (a));
 
519
#show keys from t1;
 
520
#alter table t1 disable keys;
 
521
#show keys from t1;
 
522
#create table t2 (a int);
 
523
#let $i=1000;
 
524
#set @@rand_seed1=31415926,@@rand_seed2=2718281828;
 
525
#--disable_query_log
 
526
#while ($i)
 
527
#{
 
528
#  dec $i;
 
529
#  insert t2 values (rand()*100000);
 
530
#}
 
531
#--enable_query_log
 
532
#insert t1 select * from t2;
 
533
#show keys from t1;
 
534
#alter table t1 enable keys;
 
535
#show keys from t1;
 
536
#alter table t1 engine=heap;
 
537
#alter table t1 disable keys;
 
538
#show keys from t1;
 
539
#drop table t1,t2;
570
540
 
571
541
#
572
542
# index search for NULL in blob. Bug #4816
581
551
# bug9188 - Corruption Can't open file: 'table.MYI' (errno: 145)
582
552
#
583
553
create table t1 (c1 int, c2 varchar(4) not null default '',
584
 
                 key(c2(3))) default charset=utf8;
 
554
                 key(c2(3)));
585
555
insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
586
556
update t1 set c2='A  B' where c1=2;
587
557
check table t1;
606
576
#
607
577
# BUG#12232: New myisam_stats_method variable.
608
578
#
609
 
 
610
 
show variables like 'myisam_stats_method';
611
 
 
612
 
create table t1 (a int, key(a));
613
 
insert into t1 values (0),(1),(2),(3),(4);
614
 
insert into t1 select NULL from t1;
 
579
# @TODO The following segfaults. Disabling for now - JRP
 
580
#
 
581
#show variables like 'myisam_stats_method';
 
582
#
 
583
#create table t1 (a int, key(a));
 
584
#insert into t1 values (0),(1),(2),(3),(4);
 
585
#insert into t1 select NULL from t1;
615
586
 
616
587
# default: NULLs considered inequal
617
 
analyze table t1; 
618
 
show index from t1;
619
 
insert into t1 values (11);
620
 
delete from t1 where a=11;
621
 
check table t1;
622
 
show index from t1;
 
588
#analyze table t1; 
 
589
#show index from t1;
 
590
#insert into t1 values (11);
 
591
#delete from t1 where a=11;
 
592
#check table t1;
 
593
#show index from t1;
623
594
 
624
595
# Set nulls to be equal:
625
 
set myisam_stats_method=nulls_equal;
626
 
show variables like 'myisam_stats_method';
627
 
insert into t1 values (11);
628
 
delete from t1 where a=11;
629
 
 
630
 
analyze table t1; 
631
 
show index from t1;
632
 
 
633
 
insert into t1 values (11);
634
 
delete from t1 where a=11;
635
 
 
636
 
check table t1;
637
 
show index from t1;
638
 
 
 
596
#set myisam_stats_method=nulls_equal;
 
597
#show variables like 'myisam_stats_method';
 
598
#insert into t1 values (11);
 
599
#delete from t1 where a=11;
 
600
 
 
601
#analyze table t1; 
 
602
#show index from t1;
 
603
#
 
604
#insert into t1 values (11);
 
605
#delete from t1 where a=11;
 
606
#
 
607
#check table t1;
 
608
#show index from t1;
 
609
#
639
610
# Set nulls back to be equal 
640
 
set myisam_stats_method=DEFAULT;
641
 
show variables like 'myisam_stats_method';
642
 
insert into t1 values (11);
643
 
delete from t1 where a=11;
644
 
 
645
 
analyze table t1; 
646
 
show index from t1;
647
 
 
648
 
insert into t1 values (11);
649
 
delete from t1 where a=11;
650
 
 
651
 
check table t1;
652
 
show index from t1;
653
 
 
654
 
drop table t1;
 
611
#set myisam_stats_method=DEFAULT;
 
612
#show variables like 'myisam_stats_method';
 
613
#insert into t1 values (11);
 
614
#delete from t1 where a=11;
 
615
#
 
616
#analyze table t1; 
 
617
#show index from t1;
 
618
#
 
619
#insert into t1 values (11);
 
620
#delete from t1 where a=11;
 
621
#
 
622
#check table t1;
 
623
#show index from t1;
 
624
#
 
625
#drop table t1;
655
626
 
656
627
# WL#2609, CSC#XXXX: MyISAM 
657
 
set myisam_stats_method=nulls_ignored;
658
 
show variables like 'myisam_stats_method';
659
 
 
660
 
create table t1 (
661
 
  a char(3), b char(4), c char(5), d char(6),
662
 
  key(a,b,c,d)
663
 
);
664
 
insert into t1 values ('bcd','def1', NULL, 'zz');
665
 
insert into t1 values ('bcd','def2', NULL, 'zz');
666
 
insert into t1 values ('bce','def1', 'yuu', NULL);
667
 
insert into t1 values ('bce','def2', NULL, 'quux');
668
 
analyze table t1;
669
 
show index from t1;
670
 
delete from t1;
671
 
analyze table t1;
672
 
show index from t1;
673
 
 
674
 
set myisam_stats_method=DEFAULT;
675
 
drop table t1;
 
628
#set myisam_stats_method=nulls_ignored;
 
629
#show variables like 'myisam_stats_method';
 
630
#
 
631
#create table t1 (
 
632
#  a char(3), b char(4), c char(5), d char(6),
 
633
#  key(a,b,c,d)
 
634
#);
 
635
#insert into t1 values ('bcd','def1', NULL, 'zz');
 
636
#insert into t1 values ('bcd','def2', NULL, 'zz');
 
637
#insert into t1 values ('bce','def1', 'yuu', NULL);
 
638
#insert into t1 values ('bce','def2', NULL, 'quux');
 
639
#analyze table t1;
 
640
#show index from t1;
 
641
#delete from t1;
 
642
#analyze table t1;
 
643
#show index from t1;
 
644
#
 
645
#set myisam_stats_method=DEFAULT;
 
646
#drop table t1;
676
647
 
677
648
# BUG#13814 - key value packed incorrectly for TINYBLOBs
678
649
 
679
650
create table t1(
680
651
  cip INT NOT NULL,
681
 
  time TIME NOT NULL,
682
652
  score INT NOT NULL DEFAULT 0,
683
653
  bob TINYBLOB
684
654
);
685
655
 
686
 
insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03');
687
 
insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'), 
688
 
                                       (6, 'c', '00:06');
 
656
insert into t1 (cip) VALUES (1), (2), (3);
 
657
insert into t1 (cip, bob) VALUES (4, 'a' ), (5, 'b'), 
 
658
                                       (6, 'c');
689
659
select * from t1 where bob is null and cip=1;
690
 
create index bug on t1 (bob(22), cip, time);
 
660
create index bug on t1 (bob(22), cip);
691
661
select * from t1 where bob is null and cip=1;
692
662
drop table t1;
693
663
 
733
703
#
734
704
# Bug#8283 - OPTIMIZE TABLE causes data loss
735
705
#
736
 
SET @@myisam_repair_threads=2;
 
706
SET GLOBAL myisam_repair_threads=2;
737
707
SHOW VARIABLES LIKE 'myisam_repair%';
738
708
#
739
709
# Test OPTIMIZE. This creates a new data file.
740
710
CREATE TABLE t1 (
741
 
  `_id` int(11) NOT NULL default '0',
 
711
  `_id` int NOT NULL default '0',
742
712
  `url` text,
743
713
  `email` text,
744
714
  `description` text,
745
 
  `loverlap` int(11) default NULL,
746
 
  `roverlap` int(11) default NULL,
747
 
  `lneighbor_id` int(11) default NULL,
748
 
  `rneighbor_id` int(11) default NULL,
749
 
  `length_` int(11) default NULL,
750
 
  `sequence` mediumtext,
 
715
  `loverlap` int default NULL,
 
716
  `roverlap` int default NULL,
 
717
  `lneighbor_id` int default NULL,
 
718
  `rneighbor_id` int default NULL,
 
719
  `length_` int default NULL,
 
720
  `sequence` text,
751
721
  `name` text,
752
722
  `_obj_class` text NOT NULL,
753
723
  PRIMARY KEY  (`_id`),
754
724
  UNIQUE KEY `sequence_name_index` (`name`(50)),
755
725
  KEY (`length_`)
756
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
757
 
#
 
726
) ENGINE=MyISAM;
 
727
 
758
728
INSERT INTO t1 VALUES
759
729
  (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
760
730
  (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
780
750
#
781
751
# Test REPAIR QUICK. This retains the old data file.
782
752
CREATE TABLE t1 (
783
 
  `_id` int(11) NOT NULL default '0',
 
753
  `_id` int NOT NULL default '0',
784
754
  `url` text,
785
755
  `email` text,
786
756
  `description` text,
787
 
  `loverlap` int(11) default NULL,
788
 
  `roverlap` int(11) default NULL,
789
 
  `lneighbor_id` int(11) default NULL,
790
 
  `rneighbor_id` int(11) default NULL,
791
 
  `length_` int(11) default NULL,
792
 
  `sequence` mediumtext,
 
757
  `loverlap` int default NULL,
 
758
  `roverlap` int default NULL,
 
759
  `lneighbor_id` int default NULL,
 
760
  `rneighbor_id` int default NULL,
 
761
  `length_` int default NULL,
 
762
  `sequence` text,
793
763
  `name` text,
794
764
  `_obj_class` text NOT NULL,
795
765
  PRIMARY KEY  (`_id`),
796
766
  UNIQUE KEY `sequence_name_index` (`name`(50)),
797
767
  KEY (`length_`)
798
 
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
799
 
#
 
768
) ENGINE=MyISAM;
 
769
 
800
770
INSERT INTO t1 VALUES
801
771
  (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
802
772
  (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
820
790
SELECT _id FROM t1;
821
791
DROP TABLE t1;
822
792
#
823
 
SET @@myisam_repair_threads=1;
 
793
SET GLOBAL myisam_repair_threads=1;
824
794
SHOW VARIABLES LIKE 'myisam_repair%';
825
795
 
826
796
#
829
799
#
830
800
 
831
801
# A simplified test case that reflect crashed table issue.
832
 
CREATE TABLE t1(a VARCHAR(16));
 
802
CREATE TABLE t1(a VARCHAR(16)) ENGINE=MyISAM;
833
803
INSERT INTO t1 VALUES('aaaaaaaa'),(NULL);
834
804
UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa';
835
805
SELECT * FROM t1;
836
806
DROP TABLE t1;
837
807
 
838
808
# A test case that reflect wrong result set.
839
 
CREATE TABLE t1(a INT);
 
809
CREATE TABLE t1(a INT) ENGINE=MyISAM;
840
810
INSERT INTO t1 VALUES(1),(2);
841
811
UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1;
842
812
SELECT * FROM t1 ORDER BY a;
845
815
#
846
816
# Bug#24607 - MyISAM pointer size determined incorrectly
847
817
#
848
 
CREATE TABLE t1 (c1 TEXT) AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
 
818
CREATE TABLE t1 (c1 TEXT) ENGINE=MyISAM AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
849
819
--replace_column 5 X 6 X 7 X 9 X 10 X 11 X 12 X 13 X 14 X 16 X
850
820
SHOW TABLE STATUS LIKE 't1';
851
821
DROP TABLE t1;
1008
978
# Some errors/warnings on create
1009
979
#
1010
980
 
 
981
--error 1074
1011
982
create table t1 (v varchar(65530), key(v));
1012
 
drop table if exists t1;
 
983
--error 1074
1013
984
create table t1 (v varchar(65536));
1014
 
show create table t1;
1015
 
drop table t1;
1016
 
create table t1 (v varchar(65530) character set utf8);
1017
 
show create table t1;
1018
 
drop table t1;
 
985
--error 1074
 
986
create table t1 (v varchar(65530));
1019
987
 
1020
988
# MyISAM specific varchar tests
1021
 
--error 1118
 
989
--error 1074
1022
990
create table t1 (v varchar(65535));
1023
991
 
1024
992
eval set storage_engine=$default;
1025
993
 
1026
 
#
1027
 
# Test concurrent insert
1028
 
# First with static record length
1029
 
#
1030
 
set @save_concurrent_insert=@@concurrent_insert;
1031
 
set global concurrent_insert=1;
1032
 
create table t1 (a int);
1033
 
insert into t1 values (1),(2),(3),(4),(5);
1034
 
lock table t1 read local;
1035
 
connect (con1,localhost,root,,);
1036
 
connection con1;
1037
 
# Insert in table without hole
1038
 
insert into t1 values(6),(7);
1039
 
connection default;
1040
 
unlock tables;
1041
 
delete from t1 where a>=3 and a<=4;
1042
 
lock table t1 read local;
1043
 
connection con1;
1044
 
set global concurrent_insert=2;
1045
 
# Insert in table with hole -> Should insert at end
1046
 
insert into t1 values (8),(9);
1047
 
connection default;
1048
 
unlock tables;
1049
 
# Insert into hole
1050
 
insert into t1 values (10),(11),(12);
1051
 
select * from t1;
1052
 
check table t1;
1053
 
drop table t1;
1054
 
disconnect con1;
1055
 
 
1056
 
# Same test with dynamic record length
1057
 
create table t1 (a int, b varchar(30) default "hello");
1058
 
insert into t1 (a) values (1),(2),(3),(4),(5);
1059
 
lock table t1 read local;
1060
 
connect (con1,localhost,root,,);
1061
 
connection con1;
1062
 
# Insert in table without hole
1063
 
insert into t1 (a) values(6),(7);
1064
 
connection default;
1065
 
unlock tables;
1066
 
delete from t1 where a>=3 and a<=4;
1067
 
lock table t1 read local;
1068
 
connection con1;
1069
 
set global concurrent_insert=2;
1070
 
# Insert in table with hole -> Should insert at end
1071
 
insert into t1 (a) values (8),(9);
1072
 
connection default;
1073
 
unlock tables;
1074
 
# Insert into hole
1075
 
insert into t1 (a) values (10),(11),(12);
1076
 
select a from t1;
1077
 
check table t1;
1078
 
drop table t1;
1079
 
disconnect con1;
1080
 
set global concurrent_insert=@save_concurrent_insert;
1081
 
 
1082
994
 
1083
995
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
1084
996
# different statistics on the same table with NULL values.
1147
1059
#--exec myisamchk -dvv var/master-data/test/t1.MYI
1148
1060
#--exec myisamchk -iev var/master-data/test/t1.MYI
1149
1061
--echo # Enable keys with parallel repair
1150
 
SET @@myisam_repair_threads=2;
 
1062
SET GLOBAL myisam_repair_threads=2;
1151
1063
ALTER TABLE t1 DISABLE KEYS;
1152
1064
ALTER TABLE t1 ENABLE KEYS;
1153
 
SET @@myisam_repair_threads=1;
 
1065
SET GLOBAL myisam_repair_threads=1;
1154
1066
CHECK TABLE t1 EXTENDED;
1155
1067
DROP TABLE t1;
1156
1068
 
1178
1090
# Test of key_block_size
1179
1091
#
1180
1092
 
1181
 
create table t1 (a int not null, key `a` (a) key_block_size=1024);
1182
 
show create table t1;
1183
 
drop table t1;
1184
 
 
1185
 
create table t1 (a int not null, key `a` (a) key_block_size=2048);
1186
 
show create table t1;
1187
 
drop table t1;
1188
 
 
1189
 
create table t1 (a varchar(2048), key `a` (a));
1190
 
show create table t1;
1191
 
drop table t1;
1192
 
 
1193
 
create table t1 (a varchar(2048), key `a` (a) key_block_size=1024);
1194
 
show create table t1;
1195
 
drop table t1;
1196
 
 
1197
 
create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024;
 
1093
create table t1 (a int not null, key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
1094
show create table t1;
 
1095
drop table t1;
 
1096
 
 
1097
create table t1 (a int not null, key `a` (a) key_block_size=2048) ENGINE=MyISAM;
 
1098
show create table t1;
 
1099
drop table t1;
 
1100
 
 
1101
create table t1 (a varchar(2048), key `a` (a)) ENGINE=MyISAM;
 
1102
show create table t1;
 
1103
drop table t1;
 
1104
 
 
1105
create table t1 (a varchar(2048), key `a` (a) key_block_size=1024) ENGINE=MyISAM;
 
1106
show create table t1;
 
1107
drop table t1;
 
1108
 
 
1109
create table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=1024;
1198
1110
show create table t1;
1199
1111
alter table t1 key_block_size=2048;
1200
1112
show create table t1;
1205
1117
show create table t1;
1206
1118
drop table t1;
1207
1119
 
1208
 
create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192;
1209
 
show create table t1;
1210
 
drop table t1;
1211
 
 
1212
 
create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192;
1213
 
show create table t1;
1214
 
drop table t1;
1215
 
 
1216
 
create table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) key_block_size=16384;
 
1120
create table t1 (a int not null, b varchar(2048), key (a), key(b)) ENGINE=MyISAM key_block_size=8192;
 
1121
show create table t1;
 
1122
drop table t1;
 
1123
 
 
1124
create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) ENGINE=MyISAM key_block_size=8192;
 
1125
show create table t1;
 
1126
drop table t1;
 
1127
 
 
1128
create 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;
1217
1129
show create table t1;
1218
1130
drop table t1;
1219
1131
 
1220
1132
 
1221
1133
# Test limits and errors of key_block_size
1222
1134
 
1223
 
create table t1 (a int not null, key `a` (a) key_block_size=512);
1224
 
show create table t1;
1225
 
drop table t1;
1226
 
 
1227
 
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000);
1228
 
show create table t1;
1229
 
drop table t1;
1230
 
 
1231
 
create table t1 (a int not null, key `a` (a) key_block_size=1025);
1232
 
show create table t1;
1233
 
drop table t1;
1234
 
 
1235
 
--error 1064
1236
 
create table t1 (a int not null, key key_block_size=1024 (a));
1237
 
--error 1064
1238
 
create table t1 (a int not null, key `a` key_block_size=1024 (a));
 
1135
create table t1 (a int not null, key `a` (a) key_block_size=512) ENGINE=MyISAM;
 
1136
show create table t1;
 
1137
drop table t1;
 
1138
 
 
1139
create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000) ENGINE=MyISAM;
 
1140
show create table t1;
 
1141
drop table t1;
 
1142
 
 
1143
create table t1 (a int not null, key `a` (a) key_block_size=1025) ENGINE=MyISAM;
 
1144
show create table t1;
 
1145
drop table t1;
 
1146
 
 
1147
--error 1064
 
1148
create table t1 (a int not null, key key_block_size=1024 (a)) ENGINE=MyISAM;
 
1149
--error 1064
 
1150
create table t1 (a int not null, key `a` key_block_size=1024 (a)) ENGINE=MyISAM;
1239
1151
 
1240
1152
#
1241
1153
# Bug#22119 - Changing MI_KEY_BLOCK_LENGTH makes a wrong myisamchk
1245
1157
  c2 VARCHAR(300),
1246
1158
  KEY (c1) KEY_BLOCK_SIZE 1024,
1247
1159
  KEY (c2) KEY_BLOCK_SIZE 8192
1248
 
  );
 
1160
  ) ENGINE=MyISAM;
1249
1161
INSERT INTO t1 VALUES (10, REPEAT('a', CEIL(RAND(10) * 300))),
1250
1162
  (11, REPEAT('b', CEIL(RAND() * 300))),
1251
1163
  (12, REPEAT('c', CEIL(RAND() * 300))),
1371
1283
CREATE TABLE t1 (
1372
1284
  c1 CHAR(50),
1373
1285
  c2 VARCHAR(1)
1374
 
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
 
1286
) ENGINE=MyISAM;
1375
1287
# Using Tamil Letter A, Unicode U+0B85
1376
 
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
 
1288
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
1377
1289
SELECT COUNT(*) FROM t1;
1378
1290
CHECK TABLE t1;
1379
1291
REPAIR TABLE t1;
1387
1299
CREATE TABLE t1 (
1388
1300
  c1 CHAR(50),
1389
1301
  c2 VARCHAR(1)
1390
 
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
 
1302
) ENGINE=MyISAM;
1391
1303
# Using Tamil Letter A, Unicode U+0B85
1392
 
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
 
1304
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
1393
1305
SELECT COUNT(*) FROM t1;
1394
1306
CHECK TABLE t1 EXTENDED;
1395
1307
REPAIR TABLE t1 EXTENDED;
1403
1315
CREATE TABLE t1 (
1404
1316
  c1 CHAR(50),
1405
1317
  c2 VARCHAR(1)
1406
 
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
 
1318
) ENGINE=MyISAM;
1407
1319
# Using Tamil Letter A, Unicode U+0B85
1408
 
INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
 
1320
INSERT INTO t1 VALUES(REPEAT( x'e0ae85',43), 'b');
1409
1321
# Insert more rows and delete one in the middle to force optimize.
1410
1322
INSERT INTO t1 VALUES('b', 'b');
1411
1323
INSERT INTO t1 VALUES('c', 'b');
1423
1335
  c1 CHAR(50),
1424
1336
  c2 VARCHAR(1),
1425
1337
  KEY (c1)
1426
 
) ENGINE=MyISAM DEFAULT CHARSET UTF8;
 
1338
) ENGINE=MyISAM;
1427
1339
#
1428
1340
# Insert 100 rows. This turns bulk insert on during the copy phase of
1429
1341
# ALTER TABLE. Bulk insert disables keys before the insert and re-enables
1440
1352
#
1441
1353
# Change most of the rows into long character values with > 42 characters.
1442
1354
# Using Tamil Letter A, Unicode U+0B85
1443
 
UPDATE t1 SET c1=REPEAT(_utf8 x'e0ae85',43) LIMIT 90;
 
1355
UPDATE t1 SET c1=REPEAT( x'e0ae85',43) LIMIT 90;
1444
1356
SELECT COUNT(*) FROM t1;
1445
1357
ALTER TABLE t1 ENGINE=MyISAM;
1446
1358
#
1453
1365
#
1454
1366
# Bug#29182 - MyISAMCHK reports wrong character set
1455
1367
#
1456
 
CREATE TABLE t1 (
1457
 
  c1 VARCHAR(10) NOT NULL,
1458
 
  c2 CHAR(10) DEFAULT NULL,
1459
 
  c3 VARCHAR(10) NOT NULL,
1460
 
  KEY (c1),
1461
 
  KEY (c2)
1462
 
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;
1463
 
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1464
 
--exec $MYISAMCHK -d $MYSQLTEST_VARDIR/master-data/test/t1
1465
 
DROP TABLE t1;
1466
 
 
 
1368
#@TODO Disabling the below, as no myisamcheck program
 
1369
#CREATE TABLE t1 (
 
1370
#  c1 VARCHAR(10) NOT NULL,
 
1371
#  c2 CHAR(10) DEFAULT NULL,
 
1372
#  c3 VARCHAR(10) NOT NULL,
 
1373
#  KEY (c1),
 
1374
#  KEY (c2)
 
1375
#) ENGINE=MyISAM PACK_KEYS=0;
 
1376
#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
1377
#--exec $DRIZZLECHK -d $MYSQLTEST_VARDIR/master-data/test/t1
 
1378
#DROP TABLE t1;
 
1379
#
1467
1380
--echo End of 5.1 tests
1468
1381