~cbjchen/ubuntu/trusty/mysql-5.6/fix-for-1500684

« back to all changes in this revision

Viewing changes to mysql-test/t/partition_innodb.test

  • Committer: liang.chen at canonical
  • Date: 2015-10-09 13:32:49 UTC
  • Revision ID: liang.chen@canonical.com-20151009133249-v5b8dc80a7jgjpig
Update to 5.6.26

Update to 5.6.26 to pick up security fixes.

local changes:
1. mysql-5.6.26-fix-build.patch is to fix a build dependency issue
2. change -fno-exception to -fexceptions in rules to allow catching
   exception

[cbjchen,r=]

Show diffs side-by-side

added added

removed removed

Lines of Context:
400
400
#
401
401
create table t1 (a int) engine=innodb partition by hash(a) ;
402
402
# Avg_row_length (col 6) and Data_length (col 7) vary depending
403
 
# on the page size.  Data_free for InnoDB tablespace varies
404
 
# depending on which tests have been run before this one.
405
 
--replace_column 6 # 7 # 10 #
 
403
# on the page size.  Data_free for InnoDB tablespace varies depending on which
 
404
# tests have been run before this one.  create_time(col 12) varies with time
 
405
--replace_column 6 # 7 # 10 # 12 #
406
406
show table status like 't1';
407
407
drop table t1;
408
408
 
413
413
engine = innodb
414
414
partition by key (a);
415
415
# Avg_row_length (col 6) and Data_length (col 7) vary depending
416
 
# on the page size.  Data_free for InnoDB tablespace varies
417
 
# depending on which tests have been run before this one.
418
 
--replace_column 6 # 7 # 10 #
 
416
# on the page size.  Data_free for InnoDB tablespace varies depending on which
 
417
# tests have been run before this one. create_time(col 12) varies with time
 
418
--replace_column 6 # 7 # 10 # 12 #
419
419
show table status;
420
420
insert into t1 values (0), (1), (2), (3);
421
421
analyze table t1;
422
422
# Avg_row_length (col 6) and Data_length (col 7) vary depending
423
 
# on the page size.  Data_free for InnoDB tablespace varies
424
 
# depending on which tests have been run before this one.
425
 
--replace_column 6 # 7 # 10 #
 
423
# on the page size.  Data_free for InnoDB tablespace varies depending on which
 
424
# tests have been run before this one.  create_time(col 12) varies with time
 
425
--replace_column 6 # 7 # 10 # 12 #
426
426
show table status;
427
427
drop table t1;
428
428
 
430
430
engine = innodb
431
431
partition by key (a);
432
432
# Avg_row_length (col 6) and Data_length (col 7) vary depending
433
 
# on the page size.  Data_free for InnoDB tablespace varies
434
 
# depending on which tests have been run before this one.
435
 
--replace_column 6 # 7 # 10 #
436
 
show table status;
437
 
insert into t1 values (NULL), (NULL), (NULL), (NULL);
438
 
analyze table t1;
439
 
# Avg_row_length (col 6) and Data_length (col 7) vary depending
440
 
# on the page size.  Data_free for InnoDB tablespace varies
441
 
# depending on which tests have been run before this one.
442
 
--replace_column 6 # 7 # 10 #
443
 
show table status;
444
 
insert into t1 values (NULL), (NULL), (NULL), (NULL);
445
 
analyze table t1;
446
 
# Avg_row_length (col 6) and Data_length (col 7) vary depending
447
 
# on the page size.  Data_free for InnoDB tablespace varies
448
 
# depending on which tests have been run before this one.
449
 
--replace_column 6 # 7 # 10 #
 
433
# on the page size.  Data_free for InnoDB tablespace varies depending on which
 
434
# tests have been run before this one.create_time(col 12) varies with time
 
435
--replace_column 6 # 7 # 10 # 12 #
 
436
show table status;
 
437
insert into t1 values (NULL), (NULL), (NULL), (NULL);
 
438
analyze table t1;
 
439
# Avg_row_length (col 6) and Data_length (col 7) vary depending
 
440
# on the page size.  Data_free for InnoDB tablespace varies depending on which
 
441
# tests have been run before this one.create_time(col 12) varies with time
 
442
--replace_column 6 # 7 # 10 # 12 #
 
443
show table status;
 
444
insert into t1 values (NULL), (NULL), (NULL), (NULL);
 
445
analyze table t1;
 
446
# Avg_row_length (col 6) and Data_length (col 7) vary depending
 
447
# on the page size.  Data_free for InnoDB tablespace varies depending on which
 
448
# tests have been run before this one.create_time(col 12) varies with time
 
449
--replace_column 6 # 7 # 10 # 12 #
450
450
show table status;
451
451
drop table t1;
452
452
 
703
703
ALTER TABLE t1 IMPORT TABLESPACE;
704
704
DROP TABLE t1;
705
705
USE test;
 
706
 
 
707
--echo #
 
708
--echo # Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
 
709
--echo # Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE
 
710
--echo #
 
711
CREATE TABLE t1
 
712
(a INT,
 
713
 b INT,
 
714
 PRIMARY KEY (a))
 
715
 ENGINE = InnoDB
 
716
 PARTITION BY HASH (a) PARTITIONS 3;
 
717
 START TRANSACTION WITH CONSISTENT SNAPSHOT;
 
718
 --connect (con1, localhost, root,,)
 
719
 --echo # con1
 
720
 ALTER TABLE t1 ADD INDEX idx1 (b);
 
721
 --connection default
 
722
 --echo # con default
 
723
 --error ER_TABLE_DEF_CHANGED
 
724
 SELECT b FROM t1 WHERE b = 0;
 
725
 --error ER_TABLE_DEF_CHANGED
 
726
 SELECT b FROM t1 WHERE b = 0;
 
727
 --disconnect con1
 
728
 DROP TABLE t1;
 
729
 
 
730
--echo # Same test without partitioning
 
731
CREATE TABLE t1
 
732
(a INT,
 
733
 b INT,
 
734
 PRIMARY KEY (a))
 
735
 ENGINE = InnoDB;
 
736
START TRANSACTION WITH CONSISTENT SNAPSHOT;
 
737
--echo # con1
 
738
--connect (con1, localhost, root,,)
 
739
ALTER TABLE t1 ADD INDEX idx1 (b);
 
740
--connection default
 
741
--echo # con default
 
742
--error ER_TABLE_DEF_CHANGED
 
743
SELECT b FROM t1 WHERE b = 0;
 
744
--error ER_TABLE_DEF_CHANGED
 
745
SELECT b FROM t1 WHERE b = 0;
 
746
--disconnect con1
 
747
DROP TABLE t1;
 
748
 
 
749
--echo Bug 17896265      PARTITIONED TABLE HAS MISPLACED ROWS, AFTER INPLACE ALTER
 
750
 
 
751
#Check basic Interchange
 
752
CREATE TABLE t1 (
 
753
f1 INT(11) NOT NULL,
 
754
f2 INT(11) NOT NULL
 
755
)
 
756
ENGINE=InnoDB
 
757
PARTITION BY KEY (f1,f2) PARTITIONS 2;
 
758
INSERT INTO t1 VALUES (9585,5);
 
759
--error ER_ALTER_OPERATION_NOT_SUPPORTED
 
760
ALTER TABLE t1 CHANGE f1 f1 INT AFTER f2, ALGORITHM=INPLACE;
 
761
 
 
762
# Check when interchanging columns do not change the order
 
763
CREATE TABLE t2 (
 
764
f1 INT(11) NOT NULL,
 
765
f2 INT(11) NOT NULL,
 
766
f3 INT(11) NOT NULL,
 
767
f4 INT(11) NOT NULL
 
768
)
 
769
ENGINE=InnoDB
 
770
PARTITION BY KEY (f2,f3) PARTITIONS 2;
 
771
INSERT INTO t2 VALUES (10,9585,5,20);
 
772
 
 
773
ALTER TABLE t2 CHANGE f3 f3 INT AFTER f4, ALGORITHM=INPLACE;
 
774
# Check if row is in the wrong partition!
 
775
CHECK TABLE t2;
 
776
 
 
777
--error ER_ALTER_OPERATION_NOT_SUPPORTED
 
778
ALTER TABLE t2 CHANGE f3 f3 INT AFTER f1, ALGORITHM=INPLACE;
 
779
 
 
780
#Bring back to original position
 
781
ALTER TABLE t2 CHANGE f4 f4 INT AFTER f3, ALGORITHM=INPLACE;
 
782
CHECK TABLE t2;
 
783
 
 
784
#Change the column order of field which are not part of KEY
 
785
ALTER TABLE t2 CHANGE f1 f1 INT AFTER f4, ALGORITHM=INPLACE;
 
786
CHECK TABLE t2;
 
787
 
 
788
#now order is f2,f3,f4,f1
 
789
ALTER TABLE t2 CHANGE f1 f1 INT AFTER f2, ALGORITHM=INPLACE;
 
790
CHECK TABLE t2;
 
791
 
 
792
#now order is f2,f1,f3,f4
 
793
--error ER_ALTER_OPERATION_NOT_SUPPORTED
 
794
ALTER TABLE t2 CHANGE f2 f2 INT AFTER f4, ALGORITHM=INPLACE;
 
795
 
 
796
#check if Range partition is effected
 
797
CREATE TABLE t3 (f1 INT,f2 INT) ENGINE=INNODB
 
798
PARTITION BY RANGE(f1) (
 
799
PARTITION p0 VALUES LESS THAN (100),
 
800
PARTITION p1 VALUES LESS THAN (200),
 
801
PARTITION p2 VALUES LESS THAN (600),
 
802
PARTITION p3 VALUES LESS THAN MAXVALUE
 
803
);
 
804
insert into t3 values (90,120);
 
805
insert into t3 values (120,300);
 
806
ALTER TABLE t3 CHANGE f1 f1 int AFTER f2, ALGORITHM=INPLACE;
 
807
CHECK TABLE t3;
 
808
 
 
809
#check with hash partitions
 
810
CREATE TABLE t4 (
 
811
f1 INT(11) NOT NULL,
 
812
f2 INT(11) NOT NULL
 
813
)
 
814
ENGINE=InnoDB
 
815
PARTITION BY HASH (MOD(f1,f2)) PARTITIONS 2;
 
816
INSERT INTO t4 VALUES (9585,5);
 
817
ALTER TABLE t4 CHANGE f1 f1 INT AFTER f2, ALGORITHM=INPLACE;
 
818
CHECK TABLE t4;
 
819
 
 
820
#Check with column partitioning
 
821
CREATE TABLE t5 (
 
822
    f1 INT,
 
823
    f2 INT
 
824
)
 
825
ENGINE=InnoDB
 
826
PARTITION BY RANGE COLUMNS(f1,f2) (
 
827
    PARTITION p0 VALUES LESS THAN (10000,12),
 
828
    PARTITION p1 VALUES LESS THAN (MAXVALUE, MAXVALUE)
 
829
);
 
830
 
 
831
INSERT INTO t5 VALUES (1,20000);
 
832
ALTER TABLE t5 CHANGE f1 f1 INT AFTER f2, ALGORITHM=INPLACE;
 
833
CHECK TABLE t5;
 
834
 
 
835
#Check with column partitioning and subpartition
 
836
CREATE TABLE t6 (
 
837
    a INT,
 
838
    b INT
 
839
)
 
840
ENGINE=InnoDB
 
841
PARTITION BY RANGE COLUMNS(a,b)
 
842
SUBPARTITION BY KEY(a,b)
 
843
SUBPARTITIONS 2 (
 
844
    PARTITION p0 VALUES LESS THAN (10000,12),
 
845
    PARTITION p1 VALUES LESS THAN (MAXVALUE, MAXVALUE)
 
846
);
 
847
INSERT INTO t6 VALUES (9585,5);
 
848
 
 
849
--error ER_ALTER_OPERATION_NOT_SUPPORTED
 
850
ALTER TABLE t6 CHANGE a a INT AFTER b, ALGORITHM=INPLACE;
 
851
 
 
852
#check when the columns are not adjacent
 
853
CREATE TABLE t7 (
 
854
f1 INT(11) NOT NULL,
 
855
f2 INT(11) NOT NULL,
 
856
f3 INT(11) NOT NULL,
 
857
f4 INT(11) NOT NULL,
 
858
f5 INT(11) NOT NULL
 
859
 
 
860
)
 
861
ENGINE=InnoDB
 
862
PARTITION BY KEY (f1,f5) PARTITIONS 2;
 
863
INSERT INTO t7 VALUES (9585,10,20,10,5);
 
864
 
 
865
ALTER TABLE t7 CHANGE f5 f5 INT AFTER f3, ALGORITHM=INPLACE;
 
866
CHECK TABLE t7;
 
867
 
 
868
ALTER TABLE t7 CHANGE f5 f5 INT AFTER f2, ALGORITHM=INPLACE;
 
869
CHECK TABLE t7;
 
870
 
 
871
--error ER_ALTER_OPERATION_NOT_SUPPORTED
 
872
ALTER TABLE t7 CHANGE f1 f1 INT AFTER f4, ALGORITHM=INPLACE;
 
873
 
 
874
DROP TABLE t1,t2,t3,t4,t5,t6,t7;
 
875
 
 
876
--echo #
 
877
--echo # Bug #17299181  CREATE_TIME AND UPDATE_TIME ARE
 
878
--echo #                WRONG FOR PARTITIONED TABLES
 
879
--echo #
 
880
 
 
881
CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB
 
882
PARTITION BY HASH (a) PARTITIONS 2;
 
883
 
 
884
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE
 
885
CREATE_TIME IS NOT NULL AND TABLE_NAME='t1';
 
886
 
 
887
DROP TABLE t1;