summaryrefslogtreecommitdiff
path: root/innobase/row
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2005-03-01 19:42:59 +0200
committerunknown <marko@hundin.mysql.fi>2005-03-01 19:42:59 +0200
commit39cf45fd54247ca02554a2ecfedcbfbd996b9060 (patch)
tree87a9487085f2946b718777b52b8cfc500bea903b /innobase/row
parent91fa4862c07354a7ac65055758ca21cf21296245 (diff)
downloadmariadb-git-39cf45fd54247ca02554a2ecfedcbfbd996b9060.tar.gz
After review fixes. Fix bugs in TRUNCATE.
innobase/dict/dict0crea.c: dict_truncate_index_tree(): Commit the mtr after deleting the index tree. Add diagnostics for error cases. Let the caller update SYS_INDEXES.PAGE_NO to the new root page number. Return the new root page number, or FIL_NULL on error. innobase/include/dict0crea.h: dict_truncate_index_tree(): Commit the mtr after deleting the index tree. Add diagnostics for error cases. Let the caller update SYS_INDEXES.PAGE_NO to the new root page number. Return the new root page number, or FIL_NULL on error. innobase/include/page0page.ic: page_mem_free(): Disable the memset() call, to make it possible to recover some data if someone accidentally deletes a large number of records from a table. innobase/log/log0recv.c: Do not disable InnoDB Hot Backup specific code in MySQL builds. innobase/row/row0mysql.c: row_truncate_table_for_mysql(): Remove an infinite loop in case a SYS_INDEXES record has been deleted. Avoid deadlocks by committing and restarting the mini-transaction. sql/ha_innodb.cc: ha_innobase::delete_all_rows(): set trx->active_trans = 1
Diffstat (limited to 'innobase/row')
-rw-r--r--innobase/row/row0mysql.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 39c4b76f814..4c014d39f7a 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -2615,6 +2615,7 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
rec_t* rec;
const byte* field;
ulint len;
+ ulint root_page_no;
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
/* The end of SYS_INDEXES has been reached. */
@@ -2633,11 +2634,33 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
if (rec_get_deleted_flag(rec, FALSE)) {
/* The index has been dropped. */
- continue;
+ goto next_rec;
}
- dict_truncate_index_tree(table, rec, &mtr);
+ btr_pcur_store_position(&pcur, &mtr);
+ /* This call may commit and restart mtr. */
+ root_page_no = dict_truncate_index_tree(table, rec, &mtr);
+
+ btr_pcur_restore_position(BTR_MODIFY_LEAF, &pcur, &mtr);
+ rec = btr_pcur_get_rec(&pcur);
+
+ if (root_page_no != FIL_NULL) {
+ page_rec_write_index_page_no(rec,
+ DICT_SYS_INDEXES_PAGE_NO_FIELD,
+ root_page_no, &mtr);
+ /* We will need to commit and restart the
+ mini-transaction in order to avoid deadlocks.
+ The dict_truncate_index_tree() call has allocated
+ a page in this mini-transaction, and the rest of
+ this loop could latch another index page. */
+ mtr_commit(&mtr);
+ mtr_start(&mtr);
+ btr_pcur_restore_position(BTR_MODIFY_LEAF,
+ &pcur, &mtr);
+ }
+
+ next_rec:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}