[Commits] 589cfca49ca: Spider Patch Integration

jacob.mathew at mariadb.com jacob.mathew at mariadb.com
Sat Jun 3 03:35:06 EEST 2017


revision-id: 589cfca49ca3d5c13684f84254d6a6d186567987 (mariadb-10.2.3-99-g589cfca49ca)
parent(s): e6c01f439a4e5b9ca54678db2558aa02f90cb15f
author: Jacob Mathew
committer: Jacob Mathew
timestamp: 2017-06-02 17:25:15 -0700
message:

Spider Patch Integration

Spiral patches 027 and 030.

---
 sql/ha_partition.cc | 30 +++++++++++++++++++++++++++++-
 sql/ha_partition.h  |  3 +++
 sql/handler.h       |  8 ++++++--
 sql/sql_delete.cc   |  6 ++++--
 sql/sql_update.cc   |  9 +++++----
 5 files changed, 47 insertions(+), 9 deletions(-)

diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index faedf1faf48..994f2145627 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -255,6 +255,9 @@ ha_partition::ha_partition(handlerton *hton, TABLE_SHARE *share)
   , bulk_access_info_current(NULL)
   , bulk_access_info_exec_tgt(NULL)
 #endif
+#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
+  , m_need_info_for_auto_inc(FALSE)
+#endif
 {
   DBUG_ENTER("ha_partition::ha_partition(table)");
   init_alloc_root(&m_mem_root, 512, 512, MYF(0));
@@ -286,6 +289,9 @@ ha_partition::ha_partition(handlerton *hton, partition_info *part_info)
   , bulk_access_info_current(NULL)
   , bulk_access_info_exec_tgt(NULL)
 #endif
+#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
+  , m_need_info_for_auto_inc(FALSE)
+#endif
 {
   DBUG_ENTER("ha_partition::ha_partition(part_info)");
   DBUG_ASSERT(part_info);
@@ -324,6 +330,9 @@ ha_partition::ha_partition(handlerton *hton, TABLE_SHARE *share,
   , bulk_access_info_current(NULL)
   , bulk_access_info_exec_tgt(NULL)
 #endif
+#ifdef HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
+  , m_need_info_for_auto_inc(FALSE)
+#endif
 {
   DBUG_ENTER("ha_partition::ha_partition(clone)");
   init_alloc_root(&m_mem_root, 512, 512, MYF(0));
@@ -8251,7 +8260,8 @@ int ha_partition::info(uint flag)
         {
           set_if_bigger(part_share->next_auto_inc_val,
                         auto_increment_value);
-          part_share->auto_inc_initialized= true;
+          if (can_use_for_auto_inc_init())
+            part_share->auto_inc_initialized= true;
           DBUG_PRINT("info", ("initializing next_auto_inc_val to %lu",
                        (ulong) part_share->next_auto_inc_val));
         }
@@ -10288,6 +10298,24 @@ bool ha_partition::need_info_for_auto_inc()
 #endif
 
 
+#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
+bool ha_partition::can_use_for_auto_inc_init()
+{
+  handler **file= m_file;
+  DBUG_ENTER("ha_partition::can_use_for_auto_inc_init");
+
+  do
+  {
+    if (!(*file)->can_use_for_auto_inc_init())
+    {
+      DBUG_RETURN(FALSE);
+    }
+  } while (*(++file));
+  DBUG_RETURN(TRUE);
+}
+#endif
+
+
 int ha_partition::reset_auto_increment(ulonglong value)
 {
   handler **file= m_file;
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 45061ec6990..577574bbf46 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1224,6 +1224,9 @@ class ha_partition :public handler
   bool m_need_info_for_auto_inc;
   virtual bool need_info_for_auto_inc();
 #endif
+#ifdef HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
+  virtual bool can_use_for_auto_inc_init();
+#endif
   virtual void get_auto_increment(ulonglong offset, ulonglong increment,
                                   ulonglong nb_desired_values,
                                   ulonglong *first_value,
diff --git a/sql/handler.h b/sql/handler.h
index 2e228c3559b..3086a4c40b7 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -45,6 +45,7 @@
 
 #define HANDLER_HAS_DIRECT_UPDATE_ROWS
 #define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC
+#define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT
 #define HANDLER_HAS_DIRECT_AGGREGATE
 #define INFO_KIND_UPDATE_FIELDS 101
 #define INFO_KIND_UPDATE_VALUES 102
@@ -279,8 +280,10 @@ enum enum_alter_inplace_result {
 #define HA_BINLOG_FLAGS (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE)
 
 /* The following is for partition handler */
-#define HA_CAN_MULTISTEP_MERGE (1LL << 47)
-#define HA_CAN_BULK_ACCESS     (1LL << 49)
+#define HA_CAN_MULTISTEP_MERGE          (1LL << 47)
+#define HA_CAN_BULK_ACCESS              (1LL << 49)
+#define HA_CAN_FORCE_BULK_UPDATE        (1LL << 50)
+#define HA_CAN_FORCE_BULK_DELETE        (1LL << 51)
 
 /* bits in index_flags(index_number) for what you can do with index */
 #define HA_READ_NEXT            1       /* TODO really use this flag */
@@ -3424,6 +3427,7 @@ class handler :public Sql_alloc
   virtual void unlock_row() {}
   virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;}
   virtual bool need_info_for_auto_inc() { return 0; }
+  virtual bool can_use_for_auto_inc_init() { return 1; }
   virtual void get_auto_increment(ulonglong offset, ulonglong increment,
                                   ulonglong nb_desired_values,
                                   ulonglong *first_value,
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 436fba991f9..5536bb68373 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -565,8 +565,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
 
   if (!do_direct_update)
   {
-    if (table->prepare_triggers_for_delete_stmt_or_event())
-    {
+    if (
+      !(table->file->ha_table_flags() & HA_CAN_FORCE_BULK_DELETE) &&
+      table->prepare_triggers_for_delete_stmt_or_event()
+    ) {
       will_batch= FALSE;
     }
     else
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 9fe33f68c83..f2e37d75e40 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -746,10 +746,11 @@ int mysql_update(THD *thd,
     found = update_rows;
     if (!error)
       error = -1;
-  }
-  else {
-    if (table->prepare_triggers_for_update_stmt_or_event())
-    {
+  } else {
+    if (
+      !(table->file->ha_table_flags() & HA_CAN_FORCE_BULK_UPDATE) &&
+      table->prepare_triggers_for_update_stmt_or_event()
+    ) {
       will_batch= FALSE;
     }
     else


More information about the commits mailing list