|
244 | 244 | 6
|
245 | 245 | delete from t1 where x < 4;
|
246 | 246 | delete from t1;
|
| 247 | +Warnings: |
| 248 | +Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
| 249 | +# You see warning above ^ |
247 | 250 | select * from t1 partition (p0);
|
248 | 251 | x
|
249 | 252 | 1
|
|
255 | 258 | 5
|
256 | 259 | 6
|
257 | 260 | insert into t1 values (7), (8);
|
258 |
| -Warnings: |
259 |
| -Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
260 | 261 | ### warn about full partition
|
261 | 262 | delete from t1;
|
262 | 263 | Warnings:
|
263 | 264 | Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
|
| 265 | +# You see warning above ^ |
264 | 266 | select * from t1 partition (p1) order by x;
|
265 | 267 | x
|
266 | 268 | 4
|
|
320 | 322 | ### warn about full partition
|
321 | 323 | delete from t1 where x < 3;
|
322 | 324 | delete from t1;
|
| 325 | +Warnings: |
| 326 | +Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
| 327 | +# You see warning above ^ |
323 | 328 | delete from t1;
|
| 329 | +Warnings: |
| 330 | +Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
| 331 | +# You see warning above ^ (no matter if nothing was deleted) |
324 | 332 | select * from t1 partition (p0sp0);
|
325 | 333 | x
|
326 | 334 | 1
|
327 |
| -3 |
328 |
| -5 |
329 | 335 | select * from t1 partition (p0sp1);
|
330 | 336 | x
|
331 | 337 | 2
|
332 |
| -4 |
333 | 338 | select * from t1 partition (p1sp0);
|
334 | 339 | x
|
| 340 | +3 |
| 341 | +5 |
335 | 342 | select * from t1 partition (p1sp1);
|
336 | 343 | x
|
| 344 | +4 |
337 | 345 | create or replace table t1 (
|
338 | 346 | a bigint,
|
339 | 347 | row_start SYS_DATATYPE as row start invisible,
|
@@ -415,7 +423,13 @@ partition p1 history,
|
415 | 423 | partition p2 history,
|
416 | 424 | partition pn current);
|
417 | 425 | delete from t1 where x = 1;
|
| 426 | +Warnings: |
| 427 | +Warning 4114 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions |
| 428 | +# You see warning above ^ |
418 | 429 | delete from t1 where x = 2;
|
| 430 | +Warnings: |
| 431 | +Warning 4114 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions |
| 432 | +# You see warning above ^ |
419 | 433 | # MDEV-14923 Assertion upon INSERT into locked versioned partitioned table
|
420 | 434 | create or replace table t1 (x int) with system versioning
|
421 | 435 | partition by system_time (partition p1 history, partition pn current);
|
@@ -577,9 +591,13 @@ create or replace table t1 (x int) with system versioning partition by system_ti
|
577 | 591 | lock tables t1 write;
|
578 | 592 | insert into t1 values (0), (1), (2), (3);
|
579 | 593 | delete from t1 where x < 3;
|
| 594 | +Warnings: |
| 595 | +Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
| 596 | +# You see warning above ^ |
580 | 597 | delete from t1;
|
581 | 598 | Warnings:
|
582 | 599 | Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
|
| 600 | +# You see warning above ^ |
583 | 601 | unlock tables;
|
584 | 602 | #
|
585 | 603 | # MDEV-20336 Assertion bitmap_is_set(read_partitions) upon SELECT FOR UPDATE from versioned table
|
@@ -680,6 +698,9 @@ partition by system_time limit 1
|
680 | 698 | insert into t1 values (null);
|
681 | 699 | update t1 set f= 'foo';
|
682 | 700 | update t1 set f= 'bar';
|
| 701 | +Warnings: |
| 702 | +Warning 4114 Versioned table `test`.`t1`: partition `p2` is full, add more HISTORY partitions |
| 703 | +# You see warning above ^ |
683 | 704 | create or replace view v1 as select * from t1 for system_time all;
|
684 | 705 | update v1 set f= '';
|
685 | 706 | ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
|
@@ -846,23 +867,20 @@ create table t1 (x int) with system versioning
|
846 | 867 | partition by system_time limit 1 (
|
847 | 868 | partition p0 history,
|
848 | 869 | partition p1 history,
|
| 870 | +partition p2 history, # p2 just disables warning about p1 partition full |
849 | 871 | partition pn current);
|
850 | 872 | insert into t1 values (0);
|
851 | 873 | update t1 set x= x + 1;
|
852 | 874 | update t1 set x= x + 1;
|
853 |
| -update t1 set x= x + 1; |
854 |
| -update t1 set x= x + 1; |
855 | 875 | select * from t1 partition (p0);
|
856 | 876 | x
|
857 | 877 | 0
|
858 |
| -1 |
859 | 878 | select * from t1 partition (p1);
|
860 | 879 | x
|
861 |
| -2 |
862 |
| -3 |
| 880 | +1 |
863 | 881 | select * from t1 partition (pn);
|
864 | 882 | x
|
865 |
| -4 |
| 883 | +2 |
866 | 884 | # TRUNCATE TABLE deletes history and current data
|
867 | 885 | truncate table t1;
|
868 | 886 | select * from t1 partition (p0);
|
|
874 | 892 | insert into t1 values (0);
|
875 | 893 | update t1 set x= x + 1;
|
876 | 894 | update t1 set x= x + 1;
|
877 |
| -update t1 set x= x + 1; |
878 |
| -update t1 set x= x + 1; |
879 | 895 | # TRUNCATE PARTITION ALL does the same
|
880 | 896 | alter table t1 truncate partition all;
|
881 | 897 | select * from t1 partition (p0);
|
|
887 | 903 | insert into t1 values (0);
|
888 | 904 | update t1 set x= x + 1;
|
889 | 905 | update t1 set x= x + 1;
|
890 |
| -update t1 set x= x + 1; |
891 |
| -update t1 set x= x + 1; |
892 | 906 | # TRUNCATE PARTITION deletes data from HISTORY partition
|
893 | 907 | alter table t1 truncate partition p1;
|
894 | 908 | select * from t1 partition (p0);
|
895 | 909 | x
|
896 | 910 | 0
|
897 |
| -1 |
898 | 911 | select * from t1 partition (p1);
|
899 | 912 | x
|
900 | 913 | select * from t1 partition (pn);
|
901 | 914 | x
|
902 |
| -4 |
| 915 | +2 |
903 | 916 | # or from CURRENT partition
|
904 | 917 | alter table t1 truncate partition pn;
|
905 | 918 | select * from t1 partition (p0);
|
906 | 919 | x
|
907 | 920 | 0
|
908 |
| -1 |
909 | 921 | select * from t1 partition (p1);
|
910 | 922 | x
|
911 | 923 | select * from t1 partition (pn);
|
912 | 924 | x
|
913 | 925 | drop table t1;
|
| 926 | +# |
| 927 | +# MDEV-20077 Warning on full history partition is delayed until next DML statement |
| 928 | +# |
| 929 | +# DELETE |
| 930 | +create table t1 (x int) with system versioning |
| 931 | +partition by system_time limit 100 ( |
| 932 | +partition p0 history, |
| 933 | +partition p1 history, |
| 934 | +partition pn current); |
| 935 | +insert into t1 select seq from seq_0_to_200; |
| 936 | +# p0 is filled with 100 records (no warnings): |
| 937 | +delete from t1 where x <= 99; |
| 938 | +# p1 is filled with 1 + 100 records (warning is printed): |
| 939 | +delete from t1 where x <= 100; |
| 940 | +delete from t1; |
| 941 | +Warnings: |
| 942 | +Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
| 943 | +# You see warning above ^ |
| 944 | +select count(*) from t1 partition (p0); |
| 945 | +count(*) |
| 946 | +100 |
| 947 | +select count(*) from t1 partition (p1); |
| 948 | +count(*) |
| 949 | +101 |
| 950 | +drop table t1; |
| 951 | +# DELETE under LOCK TABLES |
| 952 | +create table t1 (x int) with system versioning |
| 953 | +partition by system_time limit 100 ( |
| 954 | +partition p0 history, |
| 955 | +partition p1 history, |
| 956 | +partition pn current); |
| 957 | +insert into t1 select seq from seq_0_to_200; |
| 958 | +lock tables t1 write; |
| 959 | +# (LOCK TABLES) p0 is filled with 100 records (no warnings): |
| 960 | +delete from t1 where x <= 99; |
| 961 | +# (LOCK TABLES) p1 is filled with 1 + 100 records (warning is printed): |
| 962 | +delete from t1 where x <= 100; |
| 963 | +delete from t1; |
| 964 | +Warnings: |
| 965 | +Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
| 966 | +# You see warning above ^ |
| 967 | +unlock tables; |
| 968 | +select count(*) from t1 partition (p0); |
| 969 | +count(*) |
| 970 | +100 |
| 971 | +select count(*) from t1 partition (p1); |
| 972 | +count(*) |
| 973 | +101 |
| 974 | +drop table t1; |
| 975 | +# DELETE multitable |
| 976 | +create table t1 (x int) with system versioning |
| 977 | +partition by system_time limit 100 ( |
| 978 | +partition p0 history, |
| 979 | +partition p1 history, |
| 980 | +partition pn current); |
| 981 | +create table t2 (y int); |
| 982 | +insert into t1 select seq from seq_0_to_200; |
| 983 | +insert into t2 select seq from seq_0_to_3; |
| 984 | +delete t1, t2 from t1 join t2 where x < 50 and y = 0; |
| 985 | +delete t1, t2 from t1 join t2 where x < 100 and y = 1; |
| 986 | +delete t1, t2 from t1 join t2 where x < 150 and y = 2; |
| 987 | +delete t1, t2 from t1 join t2; |
| 988 | +Warnings: |
| 989 | +Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
| 990 | +# You see warning above ^ |
| 991 | +select count(*) from t1 partition (p0); |
| 992 | +count(*) |
| 993 | +100 |
| 994 | +select count(*) from t1 partition (p1); |
| 995 | +count(*) |
| 996 | +101 |
| 997 | +drop table t1; |
| 998 | +# UDPATE |
| 999 | +create table t1 (x int) with system versioning |
| 1000 | +partition by system_time limit 100 ( |
| 1001 | +partition p0 history, |
| 1002 | +partition p1 history, |
| 1003 | +partition pn current); |
| 1004 | +insert into t1 select seq from seq_0_to_49; |
| 1005 | +update t1 set x= x + 1; |
| 1006 | +update t1 set x= x + 1; |
| 1007 | +update t1 set x= x + 1; |
| 1008 | +update t1 set x= x + 1; |
| 1009 | +Warnings: |
| 1010 | +Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
| 1011 | +# You see warning above ^ |
| 1012 | +select count(*) from t1 partition (p0); |
| 1013 | +count(*) |
| 1014 | +100 |
| 1015 | +select count(*) from t1 partition (p1); |
| 1016 | +count(*) |
| 1017 | +100 |
| 1018 | +drop tables t1, t2; |
| 1019 | +# UPDATE multitable |
| 1020 | +create table t1 (x int) with system versioning |
| 1021 | +partition by system_time limit 100 ( |
| 1022 | +partition p0 history, |
| 1023 | +partition p1 history, |
| 1024 | +partition pn current); |
| 1025 | +create table t2 (y int); |
| 1026 | +insert into t1 select seq from seq_0_to_49; |
| 1027 | +insert into t2 values (5); |
| 1028 | +update t1, t2 set x= x + 1; |
| 1029 | +update t1, t2 set x= x + 1; |
| 1030 | +update t1, t2 set x= x + 1; |
| 1031 | +update t1, t2 set x= x + 1; |
| 1032 | +Warnings: |
| 1033 | +Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
| 1034 | +# You see warning above ^ |
| 1035 | +select count(*) from t1 partition (p0); |
| 1036 | +count(*) |
| 1037 | +100 |
| 1038 | +select count(*) from t1 partition (p1); |
| 1039 | +count(*) |
| 1040 | +100 |
| 1041 | +drop tables t1, t2; |
| 1042 | +# INSERT .. ON DUPLICATE KEY UPDATE (ODKU) |
| 1043 | +create table t1 (x int primary key) with system versioning |
| 1044 | +partition by system_time limit 100 ( |
| 1045 | +partition p0 history, |
| 1046 | +partition p1 history, |
| 1047 | +partition pn current); |
| 1048 | +insert into t1 select seq from seq_0_to_100; |
| 1049 | +delete from t1 where x <= 99; |
| 1050 | +insert into t1 values (100) on duplicate key update x= 400; |
| 1051 | +select count(*) from t1 partition (p0); |
| 1052 | +count(*) |
| 1053 | +100 |
| 1054 | +select count(*) from t1 partition (p1); |
| 1055 | +count(*) |
| 1056 | +1 |
| 1057 | +drop table t1; |
| 1058 | +# INSERT .. SELECT .. ON DUPLICATE KEY UPDATE (ODKU) |
| 1059 | +create table t1 (x int primary key) with system versioning |
| 1060 | +partition by system_time limit 100 ( |
| 1061 | +partition p0 history, |
| 1062 | +partition p1 history, |
| 1063 | +partition pn current); |
| 1064 | +create table t2 (y int); |
| 1065 | +insert into t2 values (100); |
| 1066 | +insert into t1 select seq from seq_0_to_100; |
| 1067 | +delete from t1 where x <= 99; |
| 1068 | +insert into t1 select * from t2 on duplicate key update x= 500; |
| 1069 | +select count(*) from t1 partition (p0); |
| 1070 | +count(*) |
| 1071 | +100 |
| 1072 | +select count(*) from t1 partition (p1); |
| 1073 | +count(*) |
| 1074 | +1 |
| 1075 | +drop tables t1, t2; |
| 1076 | +# REPLACE |
| 1077 | +create table t1 (x int primary key) with system versioning |
| 1078 | +partition by system_time limit 100 ( |
| 1079 | +partition p0 history, |
| 1080 | +partition p1 history, |
| 1081 | +partition pn current); |
| 1082 | +insert into t1 select seq from seq_0_to_100; |
| 1083 | +delete from t1 where x < 99; |
| 1084 | +replace t1 values (100); |
| 1085 | +replace t1 values (100); |
| 1086 | +select count(*) from t1 partition (p0); |
| 1087 | +count(*) |
| 1088 | +100 |
| 1089 | +select count(*) from t1 partition (p1); |
| 1090 | +count(*) |
| 1091 | +1 |
| 1092 | +drop table t1; |
| 1093 | +# LOAD DATA .. REPLACE |
| 1094 | +create table t1 (x int primary key) with system versioning |
| 1095 | +partition by system_time limit 100 ( |
| 1096 | +partition p0 history, |
| 1097 | +partition p1 history, |
| 1098 | +partition pn current); |
| 1099 | +insert into t1 select seq from seq_0_to_49; |
| 1100 | +select x into outfile 'MDEV-20077.data' from t1; |
| 1101 | +load data infile 'MDEV-20077.data' replace into table t1 (x); |
| 1102 | +load data infile 'MDEV-20077.data' replace into table t1 (x); |
| 1103 | +load data infile 'MDEV-20077.data' replace into table t1 (x); |
| 1104 | +load data infile 'MDEV-20077.data' replace into table t1 (x); |
| 1105 | +Warnings: |
| 1106 | +Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
| 1107 | +# You see warning above ^ |
| 1108 | +select count(*) from t1 partition (p0); |
| 1109 | +count(*) |
| 1110 | +100 |
| 1111 | +select count(*) from t1 partition (p1); |
| 1112 | +count(*) |
| 1113 | +100 |
| 1114 | +drop table t1; |
| 1115 | +# REPLACE .. SELECT |
| 1116 | +create table t1 (x int primary key) with system versioning |
| 1117 | +partition by system_time limit 100 ( |
| 1118 | +partition p0 history, |
| 1119 | +partition p1 history, |
| 1120 | +partition pn current); |
| 1121 | +insert into t1 select seq from seq_0_to_49; |
| 1122 | +replace t1 select * from t1; |
| 1123 | +replace t1 select * from t1; |
| 1124 | +replace t1 select * from t1; |
| 1125 | +replace t1 select * from t1; |
| 1126 | +Warnings: |
| 1127 | +Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions |
| 1128 | +# You see warning above ^ |
| 1129 | +select count(*) from t1 partition (p0); |
| 1130 | +count(*) |
| 1131 | +100 |
| 1132 | +select count(*) from t1 partition (p1); |
| 1133 | +count(*) |
| 1134 | +100 |
| 1135 | +drop table t1; |
914 | 1136 | # End of 10.3 tests
|
915 | 1137 | set global innodb_stats_persistent= @save_persistent;
|
0 commit comments