summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2010-05-11 16:49:23 +0200
committerSergei Golubchik <sergii@pisem.net>2010-05-11 16:49:23 +0200
commita3e8ae12805fb85a0b175b3ccbce36da62f8fdc4 (patch)
treeb72575d93228cb5bf4caa6c25559b3abef8e0d71 /sql
parent8792d8a3acd58b9417ee991166d76ba17f517836 (diff)
downloadmariadb-git-a3e8ae12805fb85a0b175b3ccbce36da62f8fdc4.tar.gz
A temporary solution to make CREATE TABLE attributes
to work when a table is partitioned
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_partition.cc4
-rw-r--r--sql/ha_partition.h23
-rw-r--r--sql/handler.cc3
-rw-r--r--sql/handler.h4
-rw-r--r--sql/sql_table.cc2
-rw-r--r--sql/table.cc2
6 files changed, 30 insertions, 8 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index c065a35b8e3..31c010cbaa2 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1219,9 +1219,7 @@ int ha_partition::prepare_new_partition(TABLE *tbl,
DBUG_ENTER("prepare_new_partition");
if ((error= set_up_table_before_create(tbl, part_name, create_info,
- 0, p_elem)) ||
- parse_engine_table_options(ha_thd(), file->ht,
- file->table_share))
+ 0, p_elem)))
goto error_create;
if ((error= file->ha_create(part_name, tbl, create_info)))
{
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 98af55bc038..15744b36edb 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1113,4 +1113,27 @@ public:
-------------------------------------------------------------------------
virtual void append_create_info(String *packet)
*/
+
+ /*
+ the following heavily relies on the fact that all partitions
+ are in the same storage engine.
+
+ When this limitation is lifted, the following hack should go away,
+ and a proper interface for engines needs to be introduced:
+
+ an PARTITION_SHARE structure that has a pointer to the TABLE_SHARE.
+ is given to engines everywhere where TABLE_SHARE is used now
+ has members like option_struct, ha_data
+ perhaps TABLE needs to be split the same way too...
+
+ this can also be done before partition will support a mix of engines,
+ but preferably together with other incompatible API changes.
+ */
+ virtual handlerton *partition_ht() const
+ {
+ handlerton *h= m_file[0]->ht;
+ for (int i=1; i < m_tot_parts; i++)
+ DBUG_ASSERT(h == m_file[i]->ht);
+ return h;
+ }
};
diff --git a/sql/handler.cc b/sql/handler.cc
index 90884daaae4..19c615a289c 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -3720,9 +3720,6 @@ int ha_create_table(THD *thd, const char *path,
name= get_canonical_filename(table.file, share.path.str, name_buff);
- if (parse_engine_table_options(thd, table.file->ht, &share))
- goto err;
-
error= table.file->ha_create(name, &table, create_info);
VOID(closefrm(&table, 0));
diff --git a/sql/handler.h b/sql/handler.h
index 81e0eab141c..4b1954fc34f 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -2230,6 +2230,10 @@ private:
virtual int rename_partitions(const char *path)
{ return HA_ERR_WRONG_COMMAND; }
friend class ha_partition;
+public:
+ /* XXX to be removed, see ha_partition::partition_ht() */
+ virtual handlerton *partition_ht() const
+ { return ht; }
};
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 5f38a3432f3..5aede352708 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3445,7 +3445,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
if (parse_option_list(thd, &create_info->option_struct,
create_info->option_list,
- create_info->db_type->table_options, FALSE,
+ file->partition_ht()->table_options, FALSE,
thd->mem_root))
DBUG_RETURN(TRUE);
diff --git a/sql/table.cc b/sql/table.cc
index 2d73e15d5fb..ac026120964 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1636,7 +1636,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (engine_table_options_frm_read(options, options_len, share))
goto free_and_err;
}
- if (parse_engine_table_options(thd, handler_file->ht, share))
+ if (parse_engine_table_options(thd, handler_file->partition_ht(), share))
goto free_and_err;
my_free(buff, MYF(MY_ALLOW_ZERO_PTR));