summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@oracle.com>2013-02-14 17:03:49 +0100
committerMattias Jonsson <mattias.jonsson@oracle.com>2013-02-14 17:03:49 +0100
commit89681f6dc65a9fe186e29493f73a97ecb34f6414 (patch)
treea15708b55ecdb842e6b0718e81f7ef56b4dbd8f0 /sql/partition_info.cc
parentc0333739cc2cfc17f22efa13015bcfba2abae509 (diff)
downloadmariadb-git-89681f6dc65a9fe186e29493f73a97ecb34f6414.tar.gz
Bug#16274455: CAN NOT ACESS PARTITIONED TABLES WHEN
DOWNGRADED FROM 5.6.11 TO 5.6.10 Problem was new syntax not accepted by previous version. Fixed by adding version comment of /*!50531 around the new syntax. Like this in the .frm file: 'PARTITION BY KEY /*!50611 ALGORITHM = 2 */ () PARTITIONS 3' and also changing the output from SHOW CREATE TABLE to: CREATE TABLE t1 (a INT) /*!50100 PARTITION BY KEY */ /*!50611 ALGORITHM = 1 */ /*!50100 () PARTITIONS 3 */ It will always add the ALGORITHM into the .frm for KEY [sub]partitioned tables, but for SHOW CREATE TABLE it will only add it in case it is the non default ALGORITHM = 1. Also notice that for 5.5, it will say /*!50531 instead of /*!50611, which will make upgrade from 5.5 > 5.5.31 to 5.6 < 5.6.11 fail! If one downgrades an fixed version to the same major version (5.5 or 5.6) the bug 14521864 will be visible again, but unless the .frm is updated, it will work again when upgrading again. Also fixed so that the .frm does not get updated version if a single partition check passes.
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r--sql/partition_info.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 5a7d0bf0c43..056676503dd 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -2302,6 +2302,16 @@ bool partition_info::has_same_partitioning(partition_info *new_part_info)
{
DBUG_ENTER("partition_info::has_same_partitioning");
+ DBUG_ASSERT(part_field_array && part_field_array[0]);
+
+ /*
+ Only consider pre 5.5.3 .frm's to have same partitioning as
+ a new one with KEY ALGORITHM = 1 ().
+ */
+
+ if (part_field_array[0]->table->s->mysql_version >= 50503)
+ DBUG_RETURN(false);
+
if (!new_part_info ||
part_type != new_part_info->part_type ||
num_parts != new_part_info->num_parts ||
@@ -2495,12 +2505,10 @@ bool partition_info::has_same_partitioning(partition_info *new_part_info)
/*
Only if key_algorithm was not specified before and it is now set,
- consider this as nothing was changed!
- But if already set, consider it as a change, and force rebuild!
+ consider this as nothing was changed, and allow change without rebuild!
*/
- DBUG_ASSERT(new_part_info->key_algorithm !=
- partition_info::KEY_ALGORITHM_NONE);
- if (key_algorithm != partition_info::KEY_ALGORITHM_NONE)
+ if (key_algorithm != partition_info::KEY_ALGORITHM_NONE ||
+ new_part_info->key_algorithm == partition_info::KEY_ALGORITHM_NONE)
DBUG_RETURN(false);
DBUG_RETURN(true);