diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-07-27 11:02:57 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-07-27 11:02:57 +0200 |
commit | 3bb36e949534fc4a24d68d4297663ae8b80ba336 (patch) | |
tree | 09907f6c2e82d718f261323075ffb33cb350fef7 /sql/ha_partition.cc | |
parent | 9a897335eb4387980aed7698b832a893dbaa3d81 (diff) | |
parent | bd935a41060199a17019453d6e187e8edd7929ba (diff) | |
download | mariadb-git-3bb36e949534fc4a24d68d4297663ae8b80ba336.tar.gz |
Merge branch '10.3' into 10.4
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r-- | sql/ha_partition.cc | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 1833b4ab682..0069bbf66c3 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4357,15 +4357,15 @@ int ha_partition::write_row(const uchar * buf) if (have_auto_increment) { if (!table_share->next_number_keypart) - update_next_auto_inc_val(); - error= update_auto_increment(); + if (unlikely(error= update_next_auto_inc_val())) + goto exit; /* If we have failed to set the auto-increment value for this row, it is highly likely that we will not be able to insert it into the correct partition. We must check and fail if necessary. */ - if (unlikely(error)) + if (unlikely(error= update_auto_increment())) goto exit; /* @@ -8336,6 +8336,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"); @@ -8388,7 +8389,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)); @@ -8445,7 +8450,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; @@ -8534,7 +8540,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; @@ -8555,7 +8562,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; @@ -8571,7 +8579,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) @@ -8588,7 +8597,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)); @@ -10609,11 +10619,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; } |