summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-04-25 14:04:44 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-04-25 14:12:45 +0300
commit1cd31bc13248bef52f7b62a37c394bd302488b15 (patch)
treee5c8624ffdec3c3afb9560e2c8b4eed6876bfde2 /sql/ha_partition.cc
parent9e7bcb05d409faec0d4bac7578afad355796068a (diff)
downloadmariadb-git-1cd31bc13248bef52f7b62a37c394bd302488b15.tar.gz
Bug#28573894 ALTER PARTITIONED TABLE ADD AUTO_INCREMENT DIFF RESULT DEPENDING ON ALGORITHM
For partitioned table, ensure that the AUTO_INCREMENT values will be assigned from the same sequence. This is based on the following change in MySQL 5.6.44: commit aaba359c13d9200747a609730dafafc3b63cd4d6 Author: Rahul Malik <rahul.m.malik@oracle.com> Date: Mon Feb 4 13:31:41 2019 +0530 Bug#28573894 ALTER PARTITIONED TABLE ADD AUTO_INCREMENT DIFF RESULT DEPENDING ON ALGORITHM Problem: When a partition table is in-place altered to add an auto-increment column, then its values are starting over for each partition. Analysis: In the case of in-place alter, InnoDB is creating a new sequence object for each partition. It is default initialized. So auto-increment columns start over for each partition. Fix: Assign old sequence of the partition to the sequence of next partition so it won't start over. RB#21148 Reviewed by Bin Su <bin.x.su@oracle.com>
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 2167bea8d7c..80bf7ef17fe 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2005, 2017, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB
+ Copyright (c) 2005, 2019, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2019, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -8329,7 +8329,12 @@ bool ha_partition::inplace_alter_table(TABLE *altered_table,
for (index= 0; index < m_tot_parts && !error; index++)
{
- ha_alter_info->handler_ctx= part_inplace_ctx->handler_ctx_array[index];
+ if ((ha_alter_info->handler_ctx=
+ part_inplace_ctx->handler_ctx_array[index]) != NULL
+ && index != 0)
+ ha_alter_info->handler_ctx->set_shared_data
+ (*part_inplace_ctx->handler_ctx_array[index - 1]);
+
if (m_file[index]->ha_inplace_alter_table(altered_table,
ha_alter_info))
error= true;