1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Fixed LP:990187 Assertion `share->reopen == 1' failed at maria_extra on ADD PARTITION

mysql-test/suite/maria/maria-partitioning.result:
  New test case
mysql-test/suite/maria/maria-partitioning.test:
  New test case
sql/sql_base.cc:
  Ignore HA_EXTRA_NORMAL for wait_while_table_is_used()
  More DBUG
sql/sql_partition.cc:
  Don't use HA_EXTRA_FORCE_REOPEN for wait_while_table_is_used() as the table is opened multiple times (in prep_alter_part_table)
  This fixes the assert in Aria where we check if table is opened multiple times if HA_EXTRA_FORCE_REOPEN is issued
This commit is contained in:
Michael Widenius
2012-05-16 22:04:48 +03:00
parent c39da19c4a
commit 26cc22f3fe
4 changed files with 21 additions and 4 deletions

View File

@@ -28,3 +28,7 @@ insert into t1 values (2);
select * from t2 left join t1 on (t2.a=t1.a) where t2.a='bbb';
a a
drop table t1,t2;
CREATE TABLE t1 ( i INT ) ENGINE=Aria
PARTITION BY HASH(i) PARTITIONS 2;
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
drop table t1;

View File

@@ -34,6 +34,15 @@ insert into t1 values (2);
select * from t2 left join t1 on (t2.a=t1.a) where t2.a='bbb';
drop table t1,t2;
#
# LP:990187
# Assertion `share->reopen == 1' failed at maria_extra on ADD PARTITION
#
CREATE TABLE t1 ( i INT ) ENGINE=Aria
PARTITION BY HASH(i) PARTITIONS 2;
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
drop table t1;
# Set defaults back
--disable_result_log
--disable_query_log

View File

@@ -2312,6 +2312,7 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *db,
@param function HA_EXTRA_PREPARE_FOR_DROP if table is to be deleted
HA_EXTRA_FORCE_REOPEN if table is not be used
HA_EXTRA_PREPARE_FOR_RENAME if table is to be renamed
HA_EXTRA_NORMAL Don't call extra()
@note When returning, the table will be unusable for other threads
until metadata lock is downgraded.
@@ -2336,6 +2337,7 @@ bool wait_while_table_is_used(THD *thd, TABLE *table,
table->s->db.str, table->s->table_name.str,
FALSE);
/* extra() call must come only after all instances above are closed */
if (function != HA_EXTRA_NORMAL)
(void) table->file->extra(function);
DBUG_RETURN(FALSE);
}
@@ -9240,6 +9242,7 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
uint key_length;
TABLE *table;
TABLE_SHARE *share;
DBUG_ENTER("tdc_remove_table");
if (! has_lock)
mysql_mutex_lock(&LOCK_open);
@@ -9297,6 +9300,7 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
if (! has_lock)
mysql_mutex_unlock(&LOCK_open);
DBUG_VOID_RETURN;
}

View File

@@ -6640,7 +6640,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
ERROR_INJECT_CRASH("crash_drop_partition_2") ||
ERROR_INJECT_ERROR("fail_drop_partition_2") ||
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN) ||
wait_while_table_is_used(thd, table, HA_EXTRA_NORMAL) ||
ERROR_INJECT_CRASH("crash_drop_partition_3") ||
ERROR_INJECT_ERROR("fail_drop_partition_3") ||
(close_table_on_failure= TRUE, FALSE) ||
@@ -6714,7 +6714,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
ERROR_INJECT_CRASH("crash_add_partition_2") ||
ERROR_INJECT_ERROR("fail_add_partition_2") ||
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN) ||
wait_while_table_is_used(thd, table, HA_EXTRA_NORMAL) ||
ERROR_INJECT_CRASH("crash_add_partition_3") ||
ERROR_INJECT_ERROR("fail_add_partition_3") ||
(close_table_on_failure= TRUE, FALSE) ||
@@ -6820,7 +6820,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
mysql_change_partitions(lpt) ||
ERROR_INJECT_CRASH("crash_change_partition_4") ||
ERROR_INJECT_ERROR("fail_change_partition_4") ||
wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN) ||
wait_while_table_is_used(thd, table, HA_EXTRA_NORMAL) ||
ERROR_INJECT_CRASH("crash_change_partition_5") ||
ERROR_INJECT_ERROR("fail_change_partition_5") ||
write_log_final_change_partition(lpt) ||