summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc36
1 files changed, 24 insertions, 12 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index fc1f0ebcb4e..ec5f504a186 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -4273,8 +4273,10 @@ int ha_partition::write_row(uchar * buf)
if (have_auto_increment)
{
if (!table_share->next_number_keypart)
- update_next_auto_inc_val();
- error= update_auto_increment();
+ error= update_next_auto_inc_val();
+
+ if (!error)
+ error= update_auto_increment();
/*
If we have failed to set the auto-increment value for this row,
@@ -8221,6 +8223,7 @@ int ha_partition::compare_number_of_records(ha_partition *me,
int ha_partition::info(uint flag)
{
+ int error;
uint no_lock_flag= flag & HA_STATUS_NO_LOCK;
uint extra_var_flag= flag & HA_STATUS_VARIABLE_EXTRA;
DBUG_ENTER("ha_partition::info");
@@ -8273,7 +8276,11 @@ int ha_partition::info(uint flag)
break;
}
file= *file_array;
- file->info(HA_STATUS_AUTO | no_lock_flag);
+ if ((error= file->info(HA_STATUS_AUTO | no_lock_flag)))
+ {
+ unlock_auto_increment();
+ DBUG_RETURN(error);
+ }
set_if_bigger(auto_increment_value,
file->stats.auto_increment_value);
} while (*(++file_array));
@@ -8329,7 +8336,8 @@ int ha_partition::info(uint flag)
i= bitmap_get_next_set(&m_part_info->read_partitions, i))
{
file= m_file[i];
- file->info(HA_STATUS_VARIABLE | no_lock_flag | extra_var_flag);
+ if ((error= file->info(HA_STATUS_VARIABLE | no_lock_flag | extra_var_flag)))
+ DBUG_RETURN(error);
stats.records+= file->stats.records;
stats.deleted+= file->stats.deleted;
stats.data_file_length+= file->stats.data_file_length;
@@ -8414,7 +8422,8 @@ int ha_partition::info(uint flag)
if (!(flag & HA_STATUS_VARIABLE) ||
!bitmap_is_set(&(m_part_info->read_partitions),
(uint) (file_array - m_file)))
- file->info(HA_STATUS_VARIABLE | no_lock_flag | extra_var_flag);
+ if ((error= file->info(HA_STATUS_VARIABLE | no_lock_flag | extra_var_flag)))
+ DBUG_RETURN(error);
if (file->stats.records > max_records || !handler_instance_set)
{
handler_instance_set= 1;
@@ -8435,7 +8444,8 @@ int ha_partition::info(uint flag)
this);
file= m_file[handler_instance];
- file->info(HA_STATUS_CONST | no_lock_flag);
+ if ((error= file->info(HA_STATUS_CONST | no_lock_flag)))
+ DBUG_RETURN(error);
stats.block_size= file->stats.block_size;
stats.create_time= file->stats.create_time;
ref_length= m_ref_length;
@@ -8451,7 +8461,8 @@ int ha_partition::info(uint flag)
Note: all engines does not support HA_STATUS_ERRKEY, so set errkey.
*/
file->errkey= errkey;
- file->info(HA_STATUS_ERRKEY | no_lock_flag);
+ if ((error= file->info(HA_STATUS_ERRKEY | no_lock_flag)))
+ DBUG_RETURN(error);
errkey= file->errkey;
}
if (flag & HA_STATUS_TIME)
@@ -8468,7 +8479,8 @@ int ha_partition::info(uint flag)
do
{
file= *file_array;
- file->info(HA_STATUS_TIME | no_lock_flag);
+ if ((error= file->info(HA_STATUS_TIME | no_lock_flag)))
+ DBUG_RETURN(error);
if (file->stats.update_time > stats.update_time)
stats.update_time= file->stats.update_time;
} while (*(++file_array));
@@ -10443,11 +10455,11 @@ int ha_partition::cmp_ref(const uchar *ref1, const uchar *ref2)
the underlying partitions require that the value should be re-calculated
*/
-void ha_partition::update_next_auto_inc_val()
+int ha_partition::update_next_auto_inc_val()
{
- if (!part_share->auto_inc_initialized ||
- need_info_for_auto_inc())
- info(HA_STATUS_AUTO);
+ if (!part_share->auto_inc_initialized || need_info_for_auto_inc())
+ return info(HA_STATUS_AUTO);
+ return 0;
}