summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2018-01-26 12:46:14 +0300
committerSergei Golubchik <serg@mariadb.org>2018-02-23 15:33:22 +0100
commitdf0e1817c716a4b2c48d2f83d55f4d2549168843 (patch)
tree7767d619d9d7ab7a3faf5f0aab16dd756f7598b1 /sql/ha_partition.cc
parent45e1c9bb6d32fb7a2fe2e59845ccc3389223d7c9 (diff)
downloadmariadb-git-df0e1817c716a4b2c48d2f83d55f4d2549168843.tar.gz
Vers SQL: partition rotation by INTERVAL fix
Update partition stats on ha_partition::write_row()
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index a0b4abf77fb..b990baf49fb 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -4269,6 +4269,10 @@ int ha_partition::write_row(uchar * buf)
if (have_auto_increment && !table->s->next_number_keypart)
set_auto_increment_if_higher(table->next_number_field);
reenable_binlog(thd);
+
+ if (m_part_info->part_type == VERSIONING_PARTITION)
+ m_part_info->vers_update_stats(thd, part_id);
+
exit:
thd->variables.sql_mode= saved_sql_mode;
table->auto_increment_field_not_null= saved_auto_inc_field_not_null;
@@ -4378,13 +4382,7 @@ int ha_partition::update_row(const uchar *old_data, const uchar *new_data)
goto exit;
if (m_part_info->part_type == VERSIONING_PARTITION)
- {
- uint sub_factor= m_part_info->num_subparts ? m_part_info->num_subparts : 1;
- DBUG_ASSERT(m_tot_parts == m_part_info->num_parts * sub_factor);
- uint lpart_id= new_part_id / sub_factor;
- // lpart_id is HISTORY partition because new_part_id != old_part_id
- m_part_info->vers_update_stats(thd, lpart_id);
- }
+ m_part_info->vers_update_stats(thd, new_part_id);
tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */
error= m_file[old_part_id]->ha_delete_row(old_data);