[MDEV-7700] Spiral patch 002_mariadb-10.0.15.spider.diff Created: 2015-03-11  Updated: 2017-12-03  Resolved: 2016-12-12

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Fix Version/s: N/A

Type: Task Priority: Major
Reporter: Sergey Vojtovich Assignee: Kentoku Shiba (Inactive)
Resolution: Fixed Votes: 0
Labels: spiral_p02

Attachments: File 002_mariadb-10.0.15.spider.diff    
Epic Link: Spiral patches

 Description   

Description:
enable table "connection" string with table partitioning feature.
support extra information "HA_EXTRA_WRITE_CAN_REPLACE" and
"HA_EXTRA_WRITE_CANNOT_REPLACE" for table partitioning feature.
support NULL for string variable with PLUGIN_VAR_MEMALLOC.
Effect:
All storage engine can use table "connection" string with table
partitioning feature by using this patch. Currently table "connection"
string is ignored by overwriting partition "connection" string. It is
for federatedx storage engine. But it should be implemented using
another way, because current implementation causes confusion for
users.
All storage engine can get extra information
"HA_EXTRA_WRITE_CAN_REPLACE" and "HA_EXTRA_WRITE_CANNOT_REPLACE" threw
table partitioning feature by using this patch.
Avoid to call my_free() using null pointer when string variable is
changed from null by using this patch.



 Comments   
Comment by Michael Widenius [ 2016-11-21 ]

diff -Narup ./001_mariadb-10.1.8-partition_cond_push/sql/ha_partition.cc ./002_mariadb-10.1.8-spider/sql/ha_partition.cc
— ./001_mariadb-10.1.8-partition_cond_push/sql/ha_partition.cc 2015-10-14 01:48:30.223665318 +0900
+++ ./002_mariadb-10.1.8-spider/sql/ha_partition.cc 2015-10-14 01:48:53.392665313 +0900
@@ -327,7 +327,9 @@ void ha_partition::init_handler_variable
m_file_buffer= NULL;
m_name_buffer_ptr= NULL;
m_engine_array= NULL;
+/*
m_connect_string= NULL;
+*/
m_file= NULL;
m_file_tot_parts= 0;
m_reorged_file= NULL;
@@ -1516,4 +1518,6 @@ int ha_partition::prepare_new_partition(
if ((error= set_up_table_before_create(tbl, part_name, create_info, p_elem)))
goto error_create;

+/*
tbl->s->connect_string = p_elem->connect_string;
+*/

I don't think it will work removing the usage of p_elem->connect_string

This is because each partition may have a different connect string.

Here is an example from fedarated_partion.test:

eval create table t1 (s1 int primary key) engine=federated
partition by list (s1)
(partition p1 values in (1,3)
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1_1',
partition p2 values in (2,4)
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1_2');

The above works in mariadb 10.2 but not in your spider tree.

From this patch I will, for now, only take the code related to

HA_EXTRA_WRITE_CAN_REPLACE
HA_EXTRA_WRITE_CANNOT_REPLACE

— ./001_mariadb-10.1.8-partition_cond_push/sql/sql_plugin.cc 2015-10-13 23:49:10.188129839 +0900
+++ ./002_mariadb-10.1.8-spider/sql/sql_plugin.cc 2015-10-14 01:48:54.296665317 +0900
@@ -2757,6 +2757,7 @@ static void update_func_str(THD *thd, st
(char*) tgt= my_strdup(value, MYF(0));
else
(char*) tgt= 0;

  • my_free(old);
    + if (old)
    + my_free(old);

As my_free is safe to call with NULL, the above is not needed

diff -Narup ./001_mariadb-10.1.8-partition_cond_push/sql/sql_priv.h ./002_mariadb-10.1.8-spider/sql/sql_priv.h
— ./001_mariadb-10.1.8-partition_cond_push/sql/sql_priv.h 2015-10-13 23:49:10.189129839 +0900
+++ ./002_mariadb-10.1.8-spider/sql/sql_priv.h 2015-10-14 01:48:54.642665315 +0900
@@ -27,6 +27,8 @@
#ifndef SQL_PRIV_INCLUDED
#define SQL_PRIV_INCLUDED

+#define PLUGIN_VAR_CAN_MEMALLOC
+
#ifndef MYSQL_CLIENT

The above is not needed, as all code that is testing this is doing:

#if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000

Which is always true in MariaDB 10.x

Comment by Michael Widenius [ 2016-11-21 ]

Check my comments and/or email
Current suggestion, without connection string handling, pushed to 10.2-spider

Comment by Michael Widenius [ 2016-12-12 ]

Discussed with Kentoku

Generated at Thu Feb 08 07:21:36 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.