From 91bc9cc9e66d55e003e90a206a1771c9f27d54b1 Mon Sep 17 00:00:00 2001 From: Guilhem Bichot Date: Fri, 5 Dec 2008 22:11:46 +0100 Subject: Fix for BUG#41037 "Maria: recovery failure (pushbuild2)" (checkpoint bug). mysql-test/suite/maria/r/maria-recovery3.result: result. mysql-test/suite/maria/t/maria-recovery3-master.opt: usual recovery test options mysql-test/suite/maria/t/maria-recovery3.test: Test for BUG#41037. Without the bugfix, the test would hang because Recovery would fail with "undo_key_insert got error 126": Recovery would believe INSERT of 2 is uncommitted, try to execute its UNDO_KEY_INSERT, fail to find the key to delete because DELETE deleted it. That failure of _ma_ck_real_delete() would mark table as corrupted (see in d_search()) which is error 126 (HA_ERR_CRASHED). storage/maria/ma_blockrec.c: set trn->rec_lsn to LSN of commit record, when writing it. storage/maria/ma_blockrec.h: new function storage/maria/ma_commit.c: when committing or rolling back, rec_lsn should be LSN_IMPOSSIBLE: assertion is moved here from trnman_end_trn(), because now ma_commit() can set rec_lsn and so when we reach trnman_end_trn() it's not LSN_IMPOSSIBLE anymore. Adding debug possibility to pause between COMMIT record write and trnman_commit_trn(), to be able to fire checkpoint in between. storage/maria/ma_loghandler.c: in-write hook for COMMIT records storage/maria/ma_recovery.c: More debugging info in maria_recovery.trace, to see how the starting point of REDO phase is determined storage/maria/trnman.c: assertion cannot be here anymore see ma_commit.c --- storage/maria/ma_commit.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'storage/maria/ma_commit.c') diff --git a/storage/maria/ma_commit.c b/storage/maria/ma_commit.c index 1066eb15e11..951de1beeff 100644 --- a/storage/maria/ma_commit.c +++ b/storage/maria/ma_commit.c @@ -33,6 +33,7 @@ int ma_commit(TRN *trn) LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS]; DBUG_ENTER("ma_commit"); + DBUG_ASSERT(trn->rec_lsn == LSN_IMPOSSIBLE); if (trn->undo_lsn == 0) /* no work done, rollback (cheaper than commit) */ DBUG_RETURN(trnman_rollback_trn(trn)); /* @@ -61,8 +62,14 @@ int ma_commit(TRN *trn) trn, NULL, 0, sizeof(log_array)/sizeof(log_array[0]), log_array, NULL, NULL) | - translog_flush(commit_lsn) | - trnman_commit_trn(trn)); + translog_flush(commit_lsn)); + + DBUG_EXECUTE_IF("maria_sleep_in_commit", + { + DBUG_PRINT("info", ("maria_sleep_in_commit")); + sleep(3); + }); + res|= trnman_commit_trn(trn); /* -- cgit v1.2.1