diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-06-15 10:01:51 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-06-15 10:01:51 +0300 |
commit | 9fe784ff7e56b7b5c182b29819ccc4da5f7b2af7 (patch) | |
tree | 6c0bd328ab31b6766886ba4276bdfe5f5df78262 /sql/sql_partition.cc | |
parent | f929fa45b66e4a98c815bac3a2778efb97989b98 (diff) | |
parent | 4c0cd953abffea841271f3a5cce1712d5e6c5633 (diff) | |
download | mariadb-git-9fe784ff7e56b7b5c182b29819ccc4da5f7b2af7.tar.gz |
Merge 10.8 into 10.9
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r-- | sql/sql_partition.cc | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index f42b9955b90..77f46187bbc 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2005, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, 2021, MariaDB + Copyright (c) 2009, 2022, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -7027,16 +7027,33 @@ static bool alter_partition_lock_handling(ALTER_PARTITION_PARAM_TYPE *lpt) static int alter_close_table(ALTER_PARTITION_PARAM_TYPE *lpt) { - int error= 0; + THD *thd= lpt->thd; + TABLE_SHARE *share= lpt->table->s; DBUG_ENTER("alter_close_table"); - if (lpt->table->db_stat) - { - error= mysql_lock_remove(lpt->thd, lpt->thd->lock, lpt->table); - error= lpt->table->file->ha_close(); - lpt->table->db_stat= 0; // Mark file closed - } - DBUG_RETURN(error); + TABLE *table= thd->open_tables; + do { + table= find_locked_table(table, share->db.str, share->table_name.str); + if (!table) + { + DBUG_RETURN(0); + } + + if (table->db_stat) + { + if (int error= mysql_lock_remove(thd, thd->lock, table)) + { + DBUG_RETURN(error); + } + if (int error= table->file->ha_close()) + { + DBUG_RETURN(error); + } + table->db_stat= 0; // Mark file closed + } + } while ((table= table->next)); + + DBUG_RETURN(0); } |