Commit d047fe77 authored by unknown's avatar unknown
Browse files

BUG#15408: Partitions: subpartition names are not unique

Also, moved some of the code out of handler.h and into partition specific files for better 
separation.
Also, moved some of the C funcs into partition_info as formal C++ methods


mysql-test/r/partition_mgm_err.result:
  result block for test of bug # 15408
mysql-test/t/partition_mgm_err.test:
  test for duplicate subpartition names
sql/Makefile.am:
  adding sql_partition.h, partition_info.cpp, partition_info.h, and partition_element.h to the makefile
sql/ha_partition.cc:
  using the new members of partition_info
sql/ha_partition.h:
  using the new members of partition_info
sql/handler.h:
  moved this code into sql_partition.h
sql/mysql_priv.h:
  including sql_partition.h also now
sql/opt_range.cc:
  using the new members of partition_info
sql/sql_partition.cc:
  moved some of the functions out and into the partition_info class
  using the new members of partition_info
sql/sql_show.cc:
  using the new members of partition_info
win/cmakefiles/sql:
  added partition_info.cpp to the sql cmake file
sql/partition_element.h:
  New BitKeeper file ``sql/partition_element.h''
sql/partition_info.h:
  New BitKeeper file ``sql/partition_info.h''
sql/sql_partition.h:
  New BitKeeper file ``sql/sql_partition.h''
parent 99526f2e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -142,3 +142,8 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
CREATE TABLE t1 (s1 int, s2 int) PARTITION BY LIST (s1)  (
PARTITION p1 VALUES IN (0) (SUBPARTITION p1b), 
PARTITION p2 VALUES IN (2) (SUBPARTITION p1b)
);
ERROR HY000: Duplicate partition name p1b
+9 −0
Original line number Diff line number Diff line
@@ -216,3 +216,12 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
ALTER TABLE t1 ADD PARTITION PARTITIONS 4;

#
#BUG 15408: Partitions: subpartition names are not unique
#
--error ER_SAME_NAME_PARTITION
CREATE TABLE t1 (s1 int, s2 int) PARTITION BY LIST (s1)  (
PARTITION p1 VALUES IN (0) (SUBPARTITION p1b), 
PARTITION p2 VALUES IN (2) (SUBPARTITION p1b)
);
+2 −2
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
			sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
			parse_file.h sql_view.h	sql_trigger.h \
			sql_array.h sql_cursor.h event.h event_priv.h \
			sql_plugin.h authors.h
			sql_plugin.h authors.h sql_partition.h partition_info.h partition_element.h
mysqld_SOURCES =	sql_lex.cc sql_handler.cc sql_partition.cc \
			item.cc item_sum.cc item_buff.cc item_func.cc \
			item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
@@ -101,7 +101,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
			sp_cache.cc parse_file.cc sql_trigger.cc \
                        event_executor.cc event.cc event_timed.cc \
			sql_plugin.cc sql_binlog.cc \
			handlerton.cc sql_tablespace.cc
			handlerton.cc sql_tablespace.cc partition_info.cpp
EXTRA_mysqld_SOURCES =	ha_innodb.cc ha_berkeley.cc ha_archive.cc \
			ha_innodb.h  ha_berkeley.h  ha_archive.h \
			ha_blackhole.cc ha_federated.cc ha_ndbcluster.cc \
+4 −4
Original line number Diff line number Diff line
@@ -186,7 +186,7 @@ ha_partition::ha_partition(TABLE_SHARE *share)
ha_partition::ha_partition(partition_info *part_info)
  :handler(&partition_hton, NULL), m_part_info(part_info),
   m_create_handler(TRUE),
   m_is_sub_partitioned(is_sub_partitioned(m_part_info))
   m_is_sub_partitioned(m_part_info->is_sub_partitioned())

{
  DBUG_ENTER("ha_partition::ha_partition(part_info)");
@@ -331,7 +331,7 @@ int ha_partition::ha_initialise()

  if (m_create_handler)
  {
    m_tot_parts= get_tot_partitions(m_part_info);
    m_tot_parts= m_part_info->get_tot_partitions();
    DBUG_ASSERT(m_tot_parts > 0);
    if (new_handlers_from_part_info())
      DBUG_RETURN(1);
@@ -1290,7 +1290,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
  DBUG_ENTER("ha_partition::change_partitions");

  m_reorged_parts= 0;
  if (!is_sub_partitioned(m_part_info))
  if (!m_part_info->is_sub_partitioned())
    no_subparts= 1;

  /*
@@ -1453,7 +1453,7 @@ int ha_partition::change_partitions(HA_CREATE_INFO *create_info,
      if (part_elem->part_state == PART_CHANGED ||
          (part_elem->part_state == PART_TO_BE_ADDED && temp_partitions))
        name_variant= TEMP_PART_NAME;
      if (is_sub_partitioned(m_part_info))
      if (m_part_info->is_sub_partitioned())
      {
        List_iterator<partition_element> sub_it(part_elem->subpartitions);
        uint j= 0, part;
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ class ha_partition :public handler
  virtual void set_part_info(partition_info *part_info)
  {
     m_part_info= part_info;
     m_is_sub_partitioned= is_sub_partitioned(part_info);
     m_is_sub_partitioned= part_info->is_sub_partitioned();
  }
  /*
    -------------------------------------------------------------------------
Loading