Commit d5268a61 authored by Monty's avatar Monty

MDEV-7700 Spiral patch 002_mariadb-10.0.15.spider.diff, part 2

Allow partition engines to access table->s->connect_string for engines
that uses HTON_CAN_READ_CONNECT_STRING_IN_PARTITION
Don't reset table->s->connect_string in ha_partition::open
parent 7abe1149
...@@ -10,7 +10,8 @@ create table federated.t1_1 (s1 int primary key) engine=myisam; ...@@ -10,7 +10,8 @@ create table federated.t1_1 (s1 int primary key) engine=myisam;
create table federated.t1_2 (s1 int primary key) engine=innodb; create table federated.t1_2 (s1 int primary key) engine=innodb;
connection master; connection master;
create table t1 (s1 int primary key) engine=federated create table t1 (s1 int primary key) engine=federated
partition by list (s1) CONNECTION="remember_this"
partition by list (s1)
(partition p1 values in (1,3) (partition p1 values in (1,3)
connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1', connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1',
partition p2 values in (2,4) partition p2 values in (2,4)
...@@ -20,7 +21,7 @@ Table Create Table ...@@ -20,7 +21,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`s1` int(11) NOT NULL, `s1` int(11) NOT NULL,
PRIMARY KEY (`s1`) PRIMARY KEY (`s1`)
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='remember_this'
PARTITION BY LIST (`s1`) PARTITION BY LIST (`s1`)
(PARTITION `p1` VALUES IN (1,3) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1' ENGINE = FEDERATED, (PARTITION `p1` VALUES IN (1,3) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_1' ENGINE = FEDERATED,
PARTITION `p2` VALUES IN (2,4) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED) PARTITION `p2` VALUES IN (2,4) CONNECTION = 'mysql://root@127.0.0.1:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED)
......
...@@ -25,6 +25,7 @@ create table federated.t1_2 (s1 int primary key) engine=innodb; ...@@ -25,6 +25,7 @@ create table federated.t1_2 (s1 int primary key) engine=innodb;
connection master; connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table t1 (s1 int primary key) engine=federated eval create table t1 (s1 int primary key) engine=federated
CONNECTION="remember_this"
partition by list (s1) partition by list (s1)
(partition p1 values in (1,3) (partition p1 values in (1,3)
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1_1', connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1_1',
......
...@@ -1536,7 +1536,8 @@ int ha_partition::prepare_new_partition(TABLE *tbl, ...@@ -1536,7 +1536,8 @@ int ha_partition::prepare_new_partition(TABLE *tbl,
if ((error= set_up_table_before_create(tbl, part_name, create_info, p_elem))) if ((error= set_up_table_before_create(tbl, part_name, create_info, p_elem)))
goto error_create; goto error_create;
tbl->s->connect_string = p_elem->connect_string; if (!(file->ht->flags & HTON_CAN_READ_CONNECT_STRING_IN_PARTITION))
tbl->s->connect_string= p_elem->connect_string;
if ((error= file->ha_create(part_name, tbl, create_info))) if ((error= file->ha_create(part_name, tbl, create_info)))
{ {
/* /*
...@@ -2113,7 +2114,8 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info) ...@@ -2113,7 +2114,8 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info)
my_bool from_alter = (create_info->data_file_name == (const char*) -1); my_bool from_alter = (create_info->data_file_name == (const char*) -1);
create_info->data_file_name= create_info->index_file_name = NULL; create_info->data_file_name= create_info->index_file_name = NULL;
create_info->connect_string= null_clex_str; if (!(m_file[0]->ht->flags & HTON_CAN_READ_CONNECT_STRING_IN_PARTITION))
create_info->connect_string= null_clex_str;
/* /*
We do not need to update the individual partition DATA DIRECTORY settings We do not need to update the individual partition DATA DIRECTORY settings
...@@ -3522,14 +3524,17 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) ...@@ -3522,14 +3524,17 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
file= m_file; file= m_file;
do do
{ {
LEX_CSTRING save_connect_string= table->s->connect_string;
if ((error= create_partition_name(name_buff, sizeof(name_buff), name, if ((error= create_partition_name(name_buff, sizeof(name_buff), name,
name_buffer_ptr, NORMAL_PART_NAME, FALSE))) name_buffer_ptr, NORMAL_PART_NAME, FALSE)))
goto err_handler; goto err_handler;
table->s->connect_string = m_connect_string[(uint)(file-m_file)]; if (!((*file)->ht->flags & HTON_CAN_READ_CONNECT_STRING_IN_PARTITION))
if ((error= (*file)->ha_open(table, name_buff, mode, table->s->connect_string= m_connect_string[(uint)(file-m_file)];
test_if_locked | HA_OPEN_NO_PSI_CALL))) error= (*file)->ha_open(table, name_buff, mode,
test_if_locked | HA_OPEN_NO_PSI_CALL);
table->s->connect_string= save_connect_string;
if (error)
goto err_handler; goto err_handler;
bzero(&table->s->connect_string, sizeof(LEX_STRING));
if (m_file == file) if (m_file == file)
m_num_locks= (*file)->lock_count(); m_num_locks= (*file)->lock_count();
DBUG_ASSERT(m_num_locks == (*file)->lock_count()); DBUG_ASSERT(m_num_locks == (*file)->lock_count());
......
...@@ -1417,6 +1417,8 @@ handlerton *ha_default_tmp_handlerton(THD *thd); ...@@ -1417,6 +1417,8 @@ handlerton *ha_default_tmp_handlerton(THD *thd);
#define HTON_SUPPORT_LOG_TABLES (1 << 7) //Engine supports log tables #define HTON_SUPPORT_LOG_TABLES (1 << 7) //Engine supports log tables
#define HTON_NO_PARTITION (1 << 8) //Not partition of these tables #define HTON_NO_PARTITION (1 << 8) //Not partition of these tables
#define HTON_CAN_MULTISTEP_MERGE (1 << 9) //You can merge mearged tables #define HTON_CAN_MULTISTEP_MERGE (1 << 9) //You can merge mearged tables
// Engine needs to access the main connect string in partitions
#define HTON_CAN_READ_CONNECT_STRING_IN_PARTITION (1 << 10)
/* /*
This flag should be set when deciding that the engine does not allow This flag should be set when deciding that the engine does not allow
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment