summaryrefslogtreecommitdiff
path: root/storage/maria/ma_close.c
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2014-07-30 13:27:52 +0300
committerMichael Widenius <monty@mariadb.org>2014-07-30 13:27:52 +0300
commit53643152296f007eb698d44f067016889b4d8470 (patch)
tree64e361e634f43062f8f362ff764d649896ba9d5e /storage/maria/ma_close.c
parenta1c1700b89ca22f8883d5ad0ee7d97eb0e1d60ff (diff)
downloadmariadb-git-53643152296f007eb698d44f067016889b4d8470.tar.gz
Fix for MDEV-6493: Assertion `table->file->stats.records > 0 || error' failure, or 'Invalid write' valgrind warnings, or crash on scenario with Aria table, view, LOCK TABLES
This bug only happens in case of paritioned tables used in LOCK TABLES and implicit_commit() was called (as part of trying to execute a CREATE TABLE withing lock tables) The problem was that Aria could not move the tables from one transaction to the new one, as thd->open_tables contained a partitioned tables and not an Aria table. Fix: - Store a list of all open tables that are part of a share in share->open_tables - In maria::implict_commit() use transaction->used_tables & share->open_tables to find out which tables was part of the current transaction instead of using thd->open_tables, which may contain partitioned tables. mysql-test/suite/maria/maria_partition.result: Added test case mysql-test/suite/maria/maria_partition.test: Added test case storage/maria/ha_maria.cc: Use trn->used tables and share->open_tables to find out which tables was part of the current transaction instead of using thd->open_tables. storage/maria/ma_close.c: Remove closed table from share->open_list storage/maria/ma_open.c: Add table to share->open_list storage/maria/ma_state.c: Added comment storage/maria/maria_def.h: Added share->open_list, a list of all tables that is using this share.
Diffstat (limited to 'storage/maria/ma_close.c')
-rw-r--r--storage/maria/ma_close.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/storage/maria/ma_close.c b/storage/maria/ma_close.c
index c355f1f1def..547c4445177 100644
--- a/storage/maria/ma_close.c
+++ b/storage/maria/ma_close.c
@@ -75,7 +75,8 @@ int maria_close(register MARIA_HA *info)
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
}
flag= !--share->reopen;
- maria_open_list=list_delete(maria_open_list,&info->open_list);
+ maria_open_list= list_delete(maria_open_list, &info->open_list);
+ share->open_list= list_delete(share->open_list, &info->share_list);
my_free(info->rec_buff);
(*share->end)(info);
@@ -86,6 +87,7 @@ int maria_close(register MARIA_HA *info)
/* Check that we don't have any dangling pointers from the transaction */
DBUG_ASSERT(share->in_trans == 0);
+ DBUG_ASSERT(share->open_list == 0);
if (share->kfile.file >= 0)
{