Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-7700

Spiral patch 002_mariadb-10.0.15.spider.diff

Details

    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.

      Attachments

        Activity

          svoj Sergey Vojtovich created issue -
          svoj Sergey Vojtovich made changes -
          Field Original Value New Value
          Epic Link MDEV-7698 [ 50410 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.1 [ 16100 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 60027 ] MariaDB v3 [ 66993 ]
          svoj Sergey Vojtovich made changes -
          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.
          serg Sergei Golubchik made changes -
          Fix Version/s 10.1 [ 16100 ]

          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

          monty Michael Widenius added a comment - 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
          monty Michael Widenius made changes -
          Assignee Michael Widenius [ monty ]
          monty Michael Widenius made changes -
          Status Open [ 1 ] In Progress [ 3 ]

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

          monty Michael Widenius added a comment - Check my comments and/or email Current suggestion, without connection string handling, pushed to 10.2-spider
          monty Michael Widenius made changes -
          Assignee Michael Widenius [ monty ] Kentoku [ kentoku ]
          Status In Progress [ 3 ] In Review [ 10002 ]
          alvinr Alvin Richards (Inactive) made changes -
          Labels NRE-305367

          Discussed with Kentoku

          monty Michael Widenius added a comment - Discussed with Kentoku
          monty Michael Widenius made changes -
          Component/s Storage Engine - Spider [ 10132 ]
          Fix Version/s N/A [ 14700 ]
          Resolution Fixed [ 1 ]
          Status In Review [ 10002 ] Closed [ 6 ]
          alvinr Alvin Richards (Inactive) made changes -
          NRE Projects NRE-305367
          alvinr Alvin Richards (Inactive) made changes -
          Labels NRE-305367
          dthompson David Thompson (Inactive) made changes -
          Labels spiral_p02
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 66993 ] MariaDB v4 [ 132534 ]

          People

            Kentoku Kentoku Shiba (Inactive)
            svoj Sergey Vojtovich
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.