Skip to content

Commit c740f76

Browse files
author
Ioannis Mytilinis
committed
WL#16268: Support for InnoDB Partitions Phase 2 -- Postfix [noclose]
Bug#36679859 revealed some flaws in the algorithm that updates the partition metadata both in DD and in GS. Issue: The algorithm that marks the per partition secondary_load flag in DD based on CREATE_INFO faces the following problems: i) A partition inherits its secondary_load value from the corresponding partition in CREATE_INFO based on its name. However, in case repartitioning has happened, the name does not guarantee any logical mapping between the new and the old partition (e.g., HASH partitioning) ii) New partitions that occur either from ADD PARTITION or repartitioning are marked with secondary_load = 0. In case the DDL triggers a full table reload, these partitions stay with the flag equal to zero leading to an inconsistency: the partitions are loaded but DD has the impression that they are not Fix: We change the corresponding algorithm in dd_table.cc to the following: If there is not an existing partitioning on the table: All partitions that are produced by this DDL will have a secondary_load flag with value equal to the table's secondary_load value Else: If (i) the partitioning type has changed OR (ii) it is HASH partitioning OR (iii) the partitioning attributes have changed: If there exists at least one partition loaded: Mark all partitions with secondary_load=1 (Full reload) Else: Mark all partitions with secondary_load=0 Else: // In this case, we have RANGE partitioning where type/attrs have // not changed, hence we can use the existing algorithm Similarly, we also modify the algorithm for subpartitions. Other changes: - Use the std::ranges API in the algorithm - Re-record tests that have broken on PB2 Change-Id: I550e40c12dc67b6cb6dc1c1e1246b9f7f2a0c522
1 parent da83a6c commit c740f76

File tree

6 files changed

+242
-77
lines changed

6 files changed

+242
-77
lines changed

mysql-test/suite/funcs_1/r/is_columns_is_ci.result

+20-18
Original file line numberDiff line numberDiff line change
@@ -193,24 +193,25 @@ def information_schema PARTITIONS PARTITION_NAME 4 NULL YES varchar 64 192 NULL
193193
def information_schema PARTITIONS SUBPARTITION_NAME 5 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(64) select NULL
194194
def information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES int NULL NULL 10 0 NULL NULL NULL int unsigned select NULL
195195
def information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES int NULL NULL 10 0 NULL NULL NULL int unsigned select NULL
196-
def information_schema PARTITIONS PARTITION_METHOD 8 NULL YES varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) select NULL
197-
def information_schema PARTITIONS SUBPARTITION_METHOD 9 NULL YES varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) select NULL
198-
def information_schema PARTITIONS PARTITION_EXPRESSION 10 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(2048) select NULL
199-
def information_schema PARTITIONS SUBPARTITION_EXPRESSION 11 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(2048) select NULL
200-
def information_schema PARTITIONS PARTITION_DESCRIPTION 12 NULL YES text 65535 65535 NULL NULL NULL utf8mb3 utf8mb3_bin text select NULL
201-
def information_schema PARTITIONS TABLE_ROWS 13 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
202-
def information_schema PARTITIONS AVG_ROW_LENGTH 14 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
203-
def information_schema PARTITIONS DATA_LENGTH 15 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
204-
def information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
205-
def information_schema PARTITIONS INDEX_LENGTH 17 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
206-
def information_schema PARTITIONS DATA_FREE 18 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
207-
def information_schema PARTITIONS CREATE_TIME 19 NULL NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp select NULL
208-
def information_schema PARTITIONS UPDATE_TIME 20 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NULL
209-
def information_schema PARTITIONS CHECK_TIME 21 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NULL
210-
def information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint select NULL
211-
def information_schema PARTITIONS PARTITION_COMMENT 23 NULL NO text 65535 65535 NULL NULL NULL utf8mb3 utf8mb3_bin text select NULL
212-
def information_schema PARTITIONS NODEGROUP 24 NULL YES varchar 256 768 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(256) select NULL
213-
def information_schema PARTITIONS TABLESPACE_NAME 25 NULL YES varchar 268 804 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(268) select NULL
196+
def information_schema PARTITIONS SECONDARY_LOAD 8 NULL YES varchar 1 3 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(1) select NULL
197+
def information_schema PARTITIONS PARTITION_METHOD 9 NULL YES varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) select NULL
198+
def information_schema PARTITIONS SUBPARTITION_METHOD 10 NULL YES varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) select NULL
199+
def information_schema PARTITIONS PARTITION_EXPRESSION 11 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(2048) select NULL
200+
def information_schema PARTITIONS SUBPARTITION_EXPRESSION 12 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(2048) select NULL
201+
def information_schema PARTITIONS PARTITION_DESCRIPTION 13 NULL YES text 65535 65535 NULL NULL NULL utf8mb3 utf8mb3_bin text select NULL
202+
def information_schema PARTITIONS TABLE_ROWS 14 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
203+
def information_schema PARTITIONS AVG_ROW_LENGTH 15 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
204+
def information_schema PARTITIONS DATA_LENGTH 16 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
205+
def information_schema PARTITIONS MAX_DATA_LENGTH 17 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
206+
def information_schema PARTITIONS INDEX_LENGTH 18 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
207+
def information_schema PARTITIONS DATA_FREE 19 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
208+
def information_schema PARTITIONS CREATE_TIME 20 NULL NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp select NULL
209+
def information_schema PARTITIONS UPDATE_TIME 21 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NULL
210+
def information_schema PARTITIONS CHECK_TIME 22 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NULL
211+
def information_schema PARTITIONS CHECKSUM 23 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint select NULL
212+
def information_schema PARTITIONS PARTITION_COMMENT 24 NULL NO text 65535 65535 NULL NULL NULL utf8mb3 utf8mb3_bin text select NULL
213+
def information_schema PARTITIONS NODEGROUP 25 NULL YES varchar 256 768 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(256) select NULL
214+
def information_schema PARTITIONS TABLESPACE_NAME 26 NULL YES varchar 268 804 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(268) select NULL
214215
def information_schema PLUGINS PLUGIN_NAME 1 NO varchar 21 64 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NULL
215216
def information_schema PLUGINS PLUGIN_VERSION 2 NO varchar 6 20 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NULL
216217
def information_schema PLUGINS PLUGIN_STATUS 3 NO varchar 3 10 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) select NULL
@@ -727,6 +728,7 @@ NULL information_schema PARAMETERS DATETIME_PRECISION int NULL NULL NULL NULL in
727728
3.0000 information_schema PARTITIONS SUBPARTITION_NAME varchar 64 192 utf8mb3 utf8mb3_bin varchar(64)
728729
NULL information_schema PARTITIONS PARTITION_ORDINAL_POSITION int NULL NULL NULL NULL int unsigned
729730
NULL information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION int NULL NULL NULL NULL int unsigned
731+
3.0000 information_schema PARTITIONS SECONDARY_LOAD varchar 1 3 utf8mb3 utf8mb3_bin varchar(1)
730732
3.0000 information_schema PARTITIONS PARTITION_METHOD varchar 13 39 utf8mb3 utf8mb3_general_ci varchar(13)
731733
3.0000 information_schema PARTITIONS SUBPARTITION_METHOD varchar 13 39 utf8mb3 utf8mb3_general_ci varchar(13)
732734
3.0000 information_schema PARTITIONS PARTITION_EXPRESSION varchar 2048 6144 utf8mb3 utf8mb3_bin varchar(2048)

mysql-test/suite/funcs_1/r/is_columns_is_cs.result

+20-18
Original file line numberDiff line numberDiff line change
@@ -193,24 +193,25 @@ def information_schema PARTITIONS PARTITION_NAME 4 NULL YES varchar 64 192 NULL
193193
def information_schema PARTITIONS SUBPARTITION_NAME 5 NULL YES varchar 64 192 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(64) select NULL
194194
def information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES int NULL NULL 10 0 NULL NULL NULL int unsigned select NULL
195195
def information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES int NULL NULL 10 0 NULL NULL NULL int unsigned select NULL
196-
def information_schema PARTITIONS PARTITION_METHOD 8 NULL YES varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) select NULL
197-
def information_schema PARTITIONS SUBPARTITION_METHOD 9 NULL YES varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) select NULL
198-
def information_schema PARTITIONS PARTITION_EXPRESSION 10 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(2048) select NULL
199-
def information_schema PARTITIONS SUBPARTITION_EXPRESSION 11 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(2048) select NULL
200-
def information_schema PARTITIONS PARTITION_DESCRIPTION 12 NULL YES text 65535 65535 NULL NULL NULL utf8mb3 utf8mb3_bin text select NULL
201-
def information_schema PARTITIONS TABLE_ROWS 13 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
202-
def information_schema PARTITIONS AVG_ROW_LENGTH 14 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
203-
def information_schema PARTITIONS DATA_LENGTH 15 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
204-
def information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
205-
def information_schema PARTITIONS INDEX_LENGTH 17 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
206-
def information_schema PARTITIONS DATA_FREE 18 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
207-
def information_schema PARTITIONS CREATE_TIME 19 NULL NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp select NULL
208-
def information_schema PARTITIONS UPDATE_TIME 20 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NULL
209-
def information_schema PARTITIONS CHECK_TIME 21 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NULL
210-
def information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint select NULL
211-
def information_schema PARTITIONS PARTITION_COMMENT 23 NULL NO text 65535 65535 NULL NULL NULL utf8mb3 utf8mb3_bin text select NULL
212-
def information_schema PARTITIONS NODEGROUP 24 NULL YES varchar 256 768 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(256) select NULL
213-
def information_schema PARTITIONS TABLESPACE_NAME 25 NULL YES varchar 268 804 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(268) select NULL
196+
def information_schema PARTITIONS SECONDARY_LOAD 8 NULL YES varchar 1 3 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(1) select NULL
197+
def information_schema PARTITIONS PARTITION_METHOD 9 NULL YES varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) select NULL
198+
def information_schema PARTITIONS SUBPARTITION_METHOD 10 NULL YES varchar 13 39 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(13) select NULL
199+
def information_schema PARTITIONS PARTITION_EXPRESSION 11 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(2048) select NULL
200+
def information_schema PARTITIONS SUBPARTITION_EXPRESSION 12 NULL YES varchar 2048 6144 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(2048) select NULL
201+
def information_schema PARTITIONS PARTITION_DESCRIPTION 13 NULL YES text 65535 65535 NULL NULL NULL utf8mb3 utf8mb3_bin text select NULL
202+
def information_schema PARTITIONS TABLE_ROWS 14 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
203+
def information_schema PARTITIONS AVG_ROW_LENGTH 15 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
204+
def information_schema PARTITIONS DATA_LENGTH 16 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
205+
def information_schema PARTITIONS MAX_DATA_LENGTH 17 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
206+
def information_schema PARTITIONS INDEX_LENGTH 18 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
207+
def information_schema PARTITIONS DATA_FREE 19 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint unsigned select NULL
208+
def information_schema PARTITIONS CREATE_TIME 20 NULL NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp select NULL
209+
def information_schema PARTITIONS UPDATE_TIME 21 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NULL
210+
def information_schema PARTITIONS CHECK_TIME 22 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select NULL
211+
def information_schema PARTITIONS CHECKSUM 23 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint select NULL
212+
def information_schema PARTITIONS PARTITION_COMMENT 24 NULL NO text 65535 65535 NULL NULL NULL utf8mb3 utf8mb3_bin text select NULL
213+
def information_schema PARTITIONS NODEGROUP 25 NULL YES varchar 256 768 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(256) select NULL
214+
def information_schema PARTITIONS TABLESPACE_NAME 26 NULL YES varchar 268 804 NULL NULL NULL utf8mb3 utf8mb3_bin varchar(268) select NULL
214215
def information_schema PLUGINS PLUGIN_NAME 1 NO varchar 21 64 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(64) select NULL
215216
def information_schema PLUGINS PLUGIN_VERSION 2 NO varchar 6 20 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(20) select NULL
216217
def information_schema PLUGINS PLUGIN_STATUS 3 NO varchar 3 10 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(10) select NULL
@@ -727,6 +728,7 @@ NULL information_schema PARAMETERS DATETIME_PRECISION int NULL NULL NULL NULL in
727728
3.0000 information_schema PARTITIONS SUBPARTITION_NAME varchar 64 192 utf8mb3 utf8mb3_bin varchar(64)
728729
NULL information_schema PARTITIONS PARTITION_ORDINAL_POSITION int NULL NULL NULL NULL int unsigned
729730
NULL information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION int NULL NULL NULL NULL int unsigned
731+
3.0000 information_schema PARTITIONS SECONDARY_LOAD varchar 1 3 utf8mb3 utf8mb3_bin varchar(1)
730732
3.0000 information_schema PARTITIONS PARTITION_METHOD varchar 13 39 utf8mb3 utf8mb3_general_ci varchar(13)
731733
3.0000 information_schema PARTITIONS SUBPARTITION_METHOD varchar 13 39 utf8mb3 utf8mb3_general_ci varchar(13)
732734
3.0000 information_schema PARTITIONS PARTITION_EXPRESSION varchar 2048 6144 utf8mb3 utf8mb3_bin varchar(2048)

0 commit comments

Comments
 (0)