| Bug #96943 | Subpartitioning not reflected in SDI | ||
|---|---|---|---|
| Submitted: | 19 Sep 2019 9:15 | Modified: | 4 Oct 2019 13:31 | 
| Reporter: | Sivert Sørumgård | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Data Dictionary | Severity: | S3 (Non-critical) | 
| Version: | 8.0.17 | OS: | Any | 
| Assigned to: | CPU Architecture: | Any | |
   [4 Oct 2019 13:31]
   Daniel Price        
  Posted by developer: Fixed as of the upcoming 8.0.19 release, and here's the changelog entry: The list of subpartitions in partition objects was not serialized and therefore not included in serialized dictionary information (SDI). To address this issue, support was added for serialization and deserialization of subpartition dictionary information. The patch for this bug also includes minor SDI code refactoring and format changes. Due to the format changes, the SDI version number was incremented.

Description: A sub-partitioned table does not have sub-partitioning reflected in the SDI. How to repeat: CREATE TABLE `ts` ( `id` int(11) DEFAULT NULL, `purchased` date DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci PARTITION BY RANGE (year(`purchased`)) SUBPARTITION BY HASH (to_days(`purchased`)) SUBPARTITIONS 2 (PARTITION p0 VALUES LESS THAN (1990) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (2000) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN MAXVALUE ENGINE = InnoDB); SDI contains an array of partitions, but sub-partitions are left out. Suggested fix: diff --git a/sql/dd/impl/types/partition_impl.cc b/sql/dd/impl/types/partition_impl.cc index 37b21a3f5a3..b7b811f203b 100644 --- a/sql/dd/impl/types/partition_impl.cc +++ b/sql/dd/impl/types/partition_impl.cc @@ -268,6 +268,7 @@ void Partition_impl::serialize(Sdi_wcontext *wctx, Sdi_writer *w) const { write_properties(w, m_se_private_data, STRING_WITH_LEN("se_private_data")); serialize_each(wctx, w, m_values, STRING_WITH_LEN("values")); serialize_each(wctx, w, m_indexes, STRING_WITH_LEN("indexes")); + serialize_each(wctx, w, m_sub_partitions, STRING_WITH_LEN("sub_partitions")); serialize_tablespace_ref(wctx, w, m_tablespace_id, STRING_WITH_LEN("tablespace_ref")); w->EndObject(); @@ -289,6 +290,8 @@ bool Partition_impl::deserialize(Sdi_rcontext *rctx, const RJ_Value &val) { rctx, [this]() { return add_value(); }, val, "values"); deserialize_each( rctx, [this]() { return add_index(nullptr); }, val, "indexes"); + deserialize_each( + rctx, [this]() { return add_sub_partition(); }, val, "sub_partition"); return deserialize_tablespace_ref(rctx, &m_tablespace_id, val, "tablespace_ref");