[Commits] 655b6b60bca: Spider Patch Integration

jacob.mathew at mariadb.com jacob.mathew at mariadb.com
Fri Jun 2 01:38:28 EEST 2017


revision-id: 655b6b60bca8f0b2777b152dd5fc7c71cdba5d60 (mariadb-10.2.3-97-g655b6b60bca)
parent(s): 234a933cd25d58e1766a76f5bff0061320e08c2a
author: Jacob Mathew
committer: Jacob Mathew
timestamp: 2017-06-01 15:28:46 -0700
message:

Spider Patch Integration

Spiral patches 021, 056 and 060.

---
 sql/ha_partition.cc               | 40 +++++++++++++++++++++++++++++++++++----
 sql/ha_partition.h                |  3 +++
 sql/handler.cc                    |  1 +
 sql/handler.h                     | 11 ++++++-----
 sql/sql_admin.cc                  |  2 +-
 sql/sql_base.cc                   | 24 ++++++++++++++++-------
 storage/myisammrg/ha_myisammrg.cc |  2 +-
 7 files changed, 65 insertions(+), 18 deletions(-)

diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 867bfb627dc..faedf1faf48 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -7157,10 +7157,8 @@ bool ha_partition::check_parallel_search()
             if (order_field && order_field->table == table_list->table)
             {
               Field *part_field = m_part_info->full_part_field_array[0];
-#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
               if (set_top_table_fields)
                 order_field = top_table_field[order_field->field_index];
-#endif
               DBUG_PRINT("info",("partition order_field=%p", order_field));
               DBUG_PRINT("info",("partition part_field=%p", part_field));
               if (part_field == order_field)
@@ -7201,10 +7199,8 @@ bool ha_partition::check_parallel_search()
             if (group_field && group_field->table == table_list->table)
             {
               Field *part_field = m_part_info->full_part_field_array[0];
-#ifdef HANDLER_HAS_TOP_TABLE_FIELDS
               if (set_top_table_fields)
                 group_field = top_table_field[group_field->field_index];
-#endif
               DBUG_PRINT("info",("partition group_field=%p", group_field));
               DBUG_PRINT("info",("partition part_field=%p", part_field));
               if (part_field == group_field)
@@ -11631,15 +11627,51 @@ void ha_partition::bulk_req_exec()
   DBUG_VOID_RETURN;
 }
 
+
+int ha_partition::set_top_table_and_fields(
+  TABLE *top_table,
+  Field **top_table_field,
+  uint top_table_fields
+) {
+  int error;
+  handler **file, **file_err;
+  DBUG_ENTER("ha_partition::set_top_table_and_fields");
+  if (!set_top_table_fields)
+  {
+    for (file= m_file; *file; file++)
+    {
+      if ((error = (*file)->set_top_table_and_fields(top_table, top_table_field, top_table_fields)))
+      {
+        goto err;
+      }
+    }
+    this->top_table = top_table;
+    this->top_table_field = top_table_field;
+    this->top_table_fields = top_table_fields;
+    set_top_table_fields = TRUE;
+  }
+  DBUG_RETURN(0);
+
+err:
+  for (file_err= m_file; file_err < file; file_err++)
+    (*file_err)->clear_top_table_fields();
+  DBUG_RETURN(error);
+}
+
 void ha_partition::clear_top_table_fields()
 {
   handler **file;
+  DBUG_ENTER("ha_partition::clear_top_table_fields");
   if (set_top_table_fields)
   {
     set_top_table_fields = FALSE;
+    top_table = NULL;
+    top_table_field = NULL;
+    top_table_fields = 0;
     for (file= m_file; *file; file++)
       (*file)->clear_top_table_fields();
   }
+  DBUG_VOID_RETURN;
 }
 
 
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 38effacd454..45061ec6990 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1389,6 +1389,9 @@ class ha_partition :public handler
 #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
     virtual int info_push(uint info_type, void *info);
 #endif
+    virtual int set_top_table_and_fields(TABLE *top_table,
+                                         Field **top_table_field,
+                                         uint top_table_fields);
     virtual void clear_top_table_fields();
 
     private:
diff --git a/sql/handler.cc b/sql/handler.cc
index 722b13bce1d..92dff7b99e8 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -5937,6 +5937,7 @@ int handler::ha_reset()
   /* Reset information about pushed engine conditions */
   cancel_pushed_idx_cond();
   /* Reset information about pushed index conditions */
+  clear_top_table_fields();
   DBUG_RETURN(reset());
 }
 
diff --git a/sql/handler.h b/sql/handler.h
index 8f2e9f1be34..2e228c3559b 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1406,9 +1406,10 @@ handlerton *ha_default_tmp_handlerton(THD *thd);
 #define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported
 #define HTON_SUPPORT_LOG_TABLES      (1 << 7) //Engine supports log 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_MERGE               (1 << 9) //Merge type table
+#define HTON_CAN_MULTISTEP_MERGE     (1 <<10) //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)
+#define HTON_CAN_READ_CONNECT_STRING_IN_PARTITION (1 << 11)
 
 /*
   This flag should be set when deciding that the engine does not allow
@@ -1423,11 +1424,11 @@ handlerton *ha_default_tmp_handlerton(THD *thd);
   It's valuable for instance for virtual tables, eg: Performance
   Schema which have no meaning for replication.
 */
-#define HTON_NO_BINLOG_ROW_OPT       (1 << 9)
-#define HTON_SUPPORTS_EXTENDED_KEYS  (1 <<10) //supports extended keys
+#define HTON_NO_BINLOG_ROW_OPT       (1 <<12)
+#define HTON_SUPPORTS_EXTENDED_KEYS  (1 <<13) //supports extended keys
 
 // MySQL compatibility. Unused.
-#define HTON_SUPPORTS_FOREIGN_KEYS   (1 << 0) //Foreign key constraint supported.
+#define HTON_SUPPORTS_FOREIGN_KEYS   (1 <<14) //Foreign key constraint supported.
 
 class Ha_trx_info;
 
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index bc5b9bde8e8..d8afa51da03 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -182,7 +182,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
     goto end;					// No data file
 
   /* A MERGE table must not come here. */
-  DBUG_ASSERT(table->file->ht->db_type != DB_TYPE_MRG_MYISAM);
+  DBUG_ASSERT(!(table->file->ht->flags & HTON_CAN_MERGE));
 
   // Name of data file
   strxmov(from, table->s->normalized_path.str, ext[1], NullS);
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 5eade2994ee..f968435c86e 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -974,7 +974,7 @@ TABLE_LIST* find_dup_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
   if (table->table)
   {
     /* All MyISAMMRG children are plain MyISAM tables. */
-    DBUG_ASSERT(table->table->file->ht->db_type != DB_TYPE_MRG_MYISAM);
+    DBUG_ASSERT(!(table->table->file->ht->flags & HTON_CAN_MERGE));
 
     table= table->find_underlying_table(table->table);
     /*
@@ -1080,7 +1080,10 @@ unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
   table= table->find_table_for_update();
 
   if (table->table &&
-      table->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE)
+    (
+     (table->table->file->ht->flags & HTON_CAN_MERGE) ||
+     (table->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE)
+    ))
   {
     TABLE_LIST *child;
     dup= NULL;
@@ -1089,7 +1092,10 @@ unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
          child= child->next_global)
     {
       if (child->table &&
-          child->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE)
+        (
+         (child->table->file->ht->flags & HTON_CAN_MERGE) ||
+         (child->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE)
+        ))
         continue;
 
       /*
@@ -4059,8 +4065,10 @@ bool open_tables(THD *thd, const DDL_options_st &options,
       continue;
 
     /* Schema tables may not have a TABLE object here. */
-    if (tbl->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE)
-    {
+    if (
+      (tbl->file->ht->flags & HTON_CAN_MERGE) ||
+      (tbl->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE)
+    ) {
       /* MERGE tables need to access parent and child TABLE_LISTs. */
       DBUG_ASSERT(tbl->pos_in_table_list == tables);
       if (tbl->file->extra(HA_EXTRA_ATTACH_CHILDREN))
@@ -4604,8 +4612,10 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type,
     */
     DBUG_ASSERT(table_list->table);
     table= table_list->table;
-    if (table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE)
-    {
+    if (
+      (table->file->ht->flags & HTON_CAN_MERGE) ||
+      (table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE)
+    ) {
       /* A MERGE table must not come here. */
       /* purecov: begin tested */
       my_error(ER_WRONG_OBJECT, MYF(0), table->s->db.str,
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 3d91aa67793..8689205a21e 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -1755,7 +1755,7 @@ static int myisammrg_init(void *p)
   myisammrg_hton->db_type= DB_TYPE_MRG_MYISAM;
   myisammrg_hton->create= myisammrg_create_handler;
   myisammrg_hton->panic= myisammrg_panic;
-  myisammrg_hton->flags= HTON_NO_PARTITION;
+  myisammrg_hton->flags= HTON_NO_PARTITION | HTON_CAN_MERGE;
   myisammrg_hton->tablefile_extensions= ha_myisammrg_exts;
 
   return 0;


More information about the commits mailing list