cleanup: ha_external_unlock() helper

as mentioned in f9f33b85be and generally to make it
easier to talk about
This commit is contained in:
Sergei Golubchik 2020-04-19 19:47:31 +02:00
parent f29287d280
commit 67aaf51cf9
9 changed files with 13 additions and 12 deletions

View file

@ -1701,7 +1701,7 @@ void ha_partition::cleanup_new_partition(uint part_count)
handler **file= m_added_file;
while ((part_count > 0) && (*file))
{
(*file)->ha_external_lock(thd, F_UNLCK);
(*file)->ha_external_unlock(thd);
(*file)->ha_close();
/* Leave the (*file)->ha_delete_table(part_name) to the ddl-log */
@ -4055,7 +4055,7 @@ err_handler:
j < i;
j= bitmap_get_next_set(&m_locked_partitions, j))
{
(void) m_file[j]->ha_external_lock(thd, F_UNLCK);
(void) m_file[j]->ha_external_unlock(thd);
}
bitmap_clear_all(&m_locked_partitions);
DBUG_RETURN(error);

View file

@ -6556,7 +6556,7 @@ int handler::ha_reset()
clear_top_table_fields();
if (lookup_handler != this)
{
lookup_handler->ha_external_lock(table->in_use, F_UNLCK);
lookup_handler->ha_external_unlock(table->in_use);
lookup_handler->close();
delete lookup_handler;
lookup_handler= this;

View file

@ -3381,6 +3381,7 @@ public:
and delete_row() below.
*/
int ha_external_lock(THD *thd, int lock_type);
int ha_external_unlock(THD *thd) { return ha_external_lock(thd, F_UNLCK); }
int ha_write_row(const uchar * buf);
int ha_update_row(const uchar * old_data, const uchar * new_data);
int ha_delete_row(const uchar * buf);

View file

@ -396,7 +396,7 @@ static int lock_external(THD *thd, TABLE **tables, uint count)
while (--i)
{
tables--;
(*tables)->file->ha_external_lock(thd, F_UNLCK);
(*tables)->file->ha_external_unlock(thd);
(*tables)->current_lock=F_UNLCK;
}
DBUG_RETURN(error);
@ -724,7 +724,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
if ((*table)->current_lock != F_UNLCK)
{
(*table)->current_lock = F_UNLCK;
if (unlikely((error=(*table)->file->ha_external_lock(thd, F_UNLCK))))
if (unlikely((error=(*table)->file->ha_external_unlock(thd))))
{
error_code= error;
(*table)->file->print_error(error, MYF(0));

View file

@ -1380,7 +1380,7 @@ void DsMrr_impl::close_second_handler()
{
secondary_file->extra(HA_EXTRA_NO_KEYREAD);
secondary_file->ha_index_or_rnd_end();
secondary_file->ha_external_lock(current_thd, F_UNLCK);
secondary_file->ha_external_unlock(current_thd);
secondary_file->ha_close();
delete secondary_file;
secondary_file= NULL;

View file

@ -1338,7 +1338,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
{
DBUG_PRINT("info", ("Freeing separate handler %p (free: %d)", file,
free_file));
file->ha_external_lock(current_thd, F_UNLCK);
file->ha_external_unlock(current_thd);
file->ha_close();
delete file;
}
@ -1528,7 +1528,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler,
if (init())
{
file->ha_external_lock(thd, F_UNLCK);
file->ha_external_unlock(thd);
file->ha_close();
goto failure;
}
@ -1557,7 +1557,7 @@ end:
{
if (!reuse_handler)
{
file->ha_external_lock(thd, F_UNLCK);
file->ha_external_unlock(thd);
file->ha_close();
goto failure;
}

View file

@ -11322,7 +11322,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
ha_enable_transaction(thd, TRUE);
}
if (to->file->ha_external_lock(thd,F_UNLCK))
if (to->file->ha_external_unlock(thd))
error=1;
if (error < 0 && !from->s->tmp_table &&
to->file->extra(HA_EXTRA_PREPARE_FOR_RENAME))

View file

@ -33,7 +33,7 @@ namespace mrn {
ExternalLock::~ExternalLock() {
if (lock_type_ != F_UNLCK) {
handler_->ha_external_lock(thd_, F_UNLCK);
handler_->ha_external_unlock(thd_);
}
}

View file

@ -10453,7 +10453,7 @@ int spider_db_udf_direct_sql(
if (table->file->has_transactions())
#endif
{
table->file->ha_external_lock(table->in_use, F_UNLCK);
table->file->ha_external_unlock(table->in_use);
#if MYSQL_VERSION_ID < 50500
#else
if (