diff options
author | Marko Mäkelä <marko.makela@oracle.com> | 2012-09-19 22:55:26 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@oracle.com> | 2012-09-19 22:55:26 +0300 |
commit | eb69278b328ea1b84b78a9b241f9ccb0098656c9 (patch) | |
tree | 9d70f916e0e02a5579e82658c2d74075b3829787 /storage/innobase/ibuf | |
parent | e86a7cbc811bef7212fdd340dae3726479a02bc2 (diff) | |
parent | b3e0fa548137d084a833cb4f66904f0f73e775e0 (diff) | |
download | mariadb-git-eb69278b328ea1b84b78a9b241f9ccb0098656c9.tar.gz |
Merge mysql-5.1 to mysql-5.5.
Diffstat (limited to 'storage/innobase/ibuf')
-rw-r--r-- | storage/innobase/ibuf/ibuf0ibuf.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index 69175553e66..70af56b99f2 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -2868,6 +2868,14 @@ ibuf_get_volume_buffered_count_func( ut_a(len == 1); ut_ad(trx_sys_multiple_tablespace_format); + if (rec_get_deleted_flag(rec, 0)) { + /* This record has been merged already, + but apparently the system crashed before + the change was discarded from the buffer. + Pretend that the record does not exist. */ + return(0); + } + types = rec_get_nth_field_old(rec, IBUF_REC_FIELD_METADATA, &len); switch (UNIV_EXPECT(len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE, @@ -4285,6 +4293,22 @@ ibuf_delete_rec( ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no); ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space); +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG + if (ibuf_debug == 2) { + /* Inject a fault (crash). We do this before trying + optimistic delete, because a pessimistic delete in the + change buffer would require a larger test case. */ + + /* Flag the buffered record as processed, to avoid + an assertion failure after crash recovery. */ + btr_cur_set_deleted_flag_for_ibuf( + btr_pcur_get_rec(pcur), NULL, TRUE, mtr); + ibuf_mtr_commit(mtr); + log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE); + DBUG_SUICIDE(); + } +#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ + success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr); if (success) { @@ -4319,7 +4343,13 @@ ibuf_delete_rec( ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no); ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space); - /* We have to resort to a pessimistic delete from ibuf */ + /* We have to resort to a pessimistic delete from ibuf. + Delete-mark the record so that it will not be applied again, + in case the server crashes before the pessimistic delete is + made persistent. */ + btr_cur_set_deleted_flag_for_ibuf( + btr_pcur_get_rec(pcur), NULL, TRUE, mtr); + btr_pcur_store_position(pcur, mtr); ibuf_btr_pcur_commit_specify_mtr(pcur, mtr); @@ -4600,7 +4630,7 @@ loop: fputs("InnoDB: Discarding record\n ", stderr); rec_print_old(stderr, rec); fputs("\nInnoDB: from the insert buffer!\n\n", stderr); - } else if (block) { + } else if (block && !rec_get_deleted_flag(rec, 0)) { /* Now we have at pcur a record which should be applied on the index page; NOTE that the call below copies pointers to fields in rec, and we must |