diff -Narup ./039_mariadb-10.4.3-child_partition_pruning/sql/ha_partition.cc ./048_mariadb-10.4.3-vp_partition/sql/ha_partition.cc
--- ./039_mariadb-10.4.3-child_partition_pruning/sql/ha_partition.cc	2019-03-26 19:33:55.151890300 +0900
+++ ./048_mariadb-10.4.3-vp_partition/sql/ha_partition.cc	2019-03-26 20:33:57.237796100 +0900
@@ -4317,6 +4317,7 @@ int ha_partition::write_row(uchar * buf)
   }
   m_last_part= part_id;
   DBUG_PRINT("info", ("Insert in partition %u", part_id));
+  DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
   start_part_bulk_insert(thd, part_id);
 
   tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */
@@ -4362,6 +4363,7 @@ int ha_partition::update_row(const uchar
   uint32 new_part_id, old_part_id= m_last_part;
   int error= 0;
   DBUG_ENTER("ha_partition::update_row");
+  DBUG_PRINT("info", ("partition this: %p", this));
   m_err_rec= NULL;
 
   // Need to read partition-related columns, to locate the row's partition:
@@ -4402,6 +4404,7 @@ int ha_partition::update_row(const uchar
 
 
   m_last_part= new_part_id;
+  DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
   start_part_bulk_insert(thd, new_part_id);
   if (new_part_id == old_part_id)
   {
@@ -4501,6 +4504,7 @@ int ha_partition::delete_row(const uchar
   int error;
   THD *thd= ha_thd();
   DBUG_ENTER("ha_partition::delete_row");
+  DBUG_PRINT("info", ("partition this: %p", this));
   m_err_rec= NULL;
 
   DBUG_ASSERT(bitmap_is_subset(&m_part_info->full_part_field_set,
@@ -4881,6 +4885,7 @@ int ha_partition::rnd_init(bool scan)
   uint i= 0;
   uint32 part_id;
   DBUG_ENTER("ha_partition::rnd_init");
+  DBUG_PRINT("info", ("partition this: %p", this));
 
   /*
     For operations that may need to change data, we may need to extend
@@ -5177,6 +5182,7 @@ int ha_partition::rnd_pos(uchar * buf, u
   uint part_id;
   handler *file;
   DBUG_ENTER("ha_partition::rnd_pos");
+  DBUG_PRINT("info", ("partition this: %p", this));
   decrement_statistics(&SSV::ha_read_rnd_count);
 
   part_id= uint2korr((const uchar *) pos);
@@ -5184,6 +5190,7 @@ int ha_partition::rnd_pos(uchar * buf, u
   file= m_file[part_id];
   DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), part_id));
   m_last_part= part_id;
+  DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
   DBUG_RETURN(file->ha_rnd_pos(buf, (pos + PARTITION_BYTES_IN_POS)));
 }
 
@@ -5380,8 +5387,17 @@ int ha_partition::index_init(uint inx, b
   */
   if (get_lock_type() == F_WRLCK)
   {
-    DBUG_PRINT("info", ("partition set part_field bitmap"));
-    bitmap_union(table->read_set, &m_part_info->full_part_field_set);
+    if (bitmap_is_overlapping(&m_part_info->full_part_field_set,
+                              table->write_set))
+    {
+      DBUG_PRINT("info", ("partition set full bitmap"));
+      bitmap_set_all(table->read_set);
+    }
+    else
+    {
+      DBUG_PRINT("info", ("partition set part_field bitmap"));
+      bitmap_union(table->read_set, &m_part_info->full_part_field_set);
+    }
   }
   if (sorted)
   {
@@ -5503,6 +5519,7 @@ int ha_partition::index_read_map(uchar *
                                  enum ha_rkey_function find_flag)
 {
   DBUG_ENTER("ha_partition::index_read_map");
+  DBUG_PRINT("info", ("partition this: %p", this));
   decrement_statistics(&SSV::ha_read_key_count);
   end_range= 0;
   m_index_scan_type= partition_index_read;
@@ -5754,6 +5771,7 @@ int ha_partition::index_read_idx_map(uch
 {
   int error= HA_ERR_KEY_NOT_FOUND;
   DBUG_ENTER("ha_partition::index_read_idx_map");
+  DBUG_PRINT("info", ("partition this: %p", this));
 
   if (find_flag == HA_READ_KEY_EXACT)
   {
@@ -5788,7 +5806,10 @@ int ha_partition::index_read_idx_map(uch
         break;
     }
     if (part <= m_part_spec.end_part)
+    {
       m_last_part= part;
+      DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
+    }
   }
   else
   {
@@ -6645,7 +6666,10 @@ int ha_partition::ft_init()
     */
     if (bitmap_is_overlapping(&m_part_info->full_part_field_set,
                               table->write_set))
+    {
+      DBUG_PRINT("info", ("partition set full bitmap"));
       bitmap_set_all(table->read_set);
+    }
     else
     {
       /*
@@ -6654,6 +6678,7 @@ int ha_partition::ft_init()
         fields of the partition functions are read such that we can
         calculate the partition id to place updated and deleted records.
       */
+      DBUG_PRINT("info", ("partition set part_field bitmap"));
       bitmap_union(table->read_set, &m_part_info->full_part_field_set);
     }
   }
@@ -6928,6 +6953,7 @@ int ha_partition::ft_read(uchar *buf)
     {
       /* Found row: remember position and return it. */
       m_part_spec.start_part= m_last_part= part_id;
+      DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
       table->status= 0;
       DBUG_RETURN(0);
     }
@@ -6952,6 +6978,7 @@ int ha_partition::ft_read(uchar *buf)
       break;
     }
     m_part_spec.start_part= m_last_part= part_id;
+    DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
     file= m_file[part_id];
     DBUG_PRINT("info", ("now using partition %u", (uint) part_id));
     late_extra_cache(part_id);
@@ -7277,6 +7304,7 @@ int ha_partition::handle_unordered_next(
   handler *file;
   int error;
   DBUG_ENTER("ha_partition::handle_unordered_next");
+  DBUG_PRINT("info", ("partition this: %p", this));
 
   if (m_part_spec.start_part >= m_tot_parts)
   {
@@ -7297,6 +7325,7 @@ int ha_partition::handle_unordered_next(
                  multi_range_read_next(&m_range_info[m_part_spec.start_part]))))
     {
       m_last_part= m_part_spec.start_part;
+      DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
       DBUG_RETURN(0);
     }
   }
@@ -7305,6 +7334,7 @@ int ha_partition::handle_unordered_next(
     if (likely(!(error= file->read_range_next())))
     {
       m_last_part= m_part_spec.start_part;
+      DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
       DBUG_RETURN(0);
     }
   }
@@ -7314,6 +7344,7 @@ int ha_partition::handle_unordered_next(
                                                  m_start_key.length))))
     {
       m_last_part= m_part_spec.start_part;
+      DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
       DBUG_RETURN(0);
     }
   }
@@ -7322,6 +7353,7 @@ int ha_partition::handle_unordered_next(
     if (likely(!(error= file->ha_index_next(buf))))
     {
       m_last_part= m_part_spec.start_part;
+      DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
       DBUG_RETURN(0);                           // Row was in range
     }
   }
@@ -7357,6 +7389,7 @@ int ha_partition::handle_unordered_scan_
   uint i= m_part_spec.start_part;
   int saved_error= HA_ERR_END_OF_FILE;
   DBUG_ENTER("ha_partition::handle_unordered_scan_next_partition");
+  DBUG_PRINT("info", ("partition this: %p", this));
 
   /* Read next partition that includes start_part */
   if (i)
@@ -7401,6 +7434,7 @@ int ha_partition::handle_unordered_scan_
     if (likely(!error))
     {
       m_last_part= i;
+      DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
       DBUG_RETURN(0);
     }
     if (likely((error != HA_ERR_END_OF_FILE) &&
@@ -9863,6 +9897,8 @@ void ha_partition::print_error(int error
     {
       DBUG_ASSERT(0);
       m_last_part= 0;
+      DBUG_PRINT("info", ("partition m_last_part: %d", m_last_part));
+      DBUG_PRINT("info", ("partition m_last_part: %p", &m_last_part));
     }
     m_file[m_last_part]->print_error(error, errflag);
   }
@@ -11006,6 +11042,31 @@ TABLE_LIST *ha_partition::get_next_globa
 }
 
 
+void ha_partition::check_and_set_bitmap_for_update(bool rnd)
+{
+  handler **file;
+  DBUG_ENTER("ha_partition::check_and_set_bitmap_for_update");
+  DBUG_PRINT("info",("partition this=%p", this));
+  for (file= m_file; *file; file++)
+  {
+    (*file)->check_and_set_bitmap_for_update(rnd);
+  }
+
+  if (bitmap_is_overlapping(&m_part_info->full_part_field_set,
+                            table->write_set))
+  {
+    DBUG_PRINT("info", ("partition set full bitmap"));
+    bitmap_set_all(table->read_set);
+  }
+  else
+  {
+    DBUG_PRINT("info", ("partition set part_field bitmap"));
+    bitmap_union(table->read_set, &m_part_info->full_part_field_set);
+  }
+  DBUG_VOID_RETURN;
+}
+
+
 /**
   Push an engine condition to the condition stack of the storage engine
   for each partition.
diff -Narup ./039_mariadb-10.4.3-child_partition_pruning/sql/ha_partition.h ./048_mariadb-10.4.3-vp_partition/sql/ha_partition.h
--- ./039_mariadb-10.4.3-child_partition_pruning/sql/ha_partition.h	2019-03-26 19:31:13.988846300 +0900
+++ ./048_mariadb-10.4.3-vp_partition/sql/ha_partition.h	2019-03-26 20:34:56.990158800 +0900
@@ -1450,6 +1450,7 @@ public:
     virtual int assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt);
     virtual int preload_keys(THD* thd, HA_CHECK_OPT* check_opt);
     virtual TABLE_LIST *get_next_global_for_child();
+    virtual void check_and_set_bitmap_for_update(bool rnd);
 
   /*
     -------------------------------------------------------------------------
diff -Narup ./039_mariadb-10.4.3-child_partition_pruning/sql/handler.h ./048_mariadb-10.4.3-vp_partition/sql/handler.h
--- ./039_mariadb-10.4.3-child_partition_pruning/sql/handler.h	2019-03-26 19:02:57.422325000 +0900
+++ ./048_mariadb-10.4.3-vp_partition/sql/handler.h	2019-03-26 20:36:08.313384200 +0900
@@ -4170,6 +4170,7 @@ public:
 
  /* Needed for partition / spider */
   virtual TABLE_LIST *get_next_global_for_child() { return NULL; }
+  virtual void check_and_set_bitmap_for_update(bool rnd) { return; };
 
  /**
    Part of old, deprecated in-place ALTER API.
