From 668306640edd3d3c6f55290000a7398ec7dd888d Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Mon, 13 May 2013 00:43:46 +0300 Subject: Fixed MDEV-4291: Assertion `trid >= info->s->state.create_trid' failure or data corruption (key points to record outside datafile) on INSERT into an Aria table. The isssue was that the check if a table was moved between systems didn't take into account that create_trid could be bigger than the current max trid on the new system. This could only happen if one tried to move a table that one had just done a 'REPAIR TABLE' on. Tables that one had run 'aria_chk --zerofill' on worked. Fixed this by assuming that if create_trid is too big then the table has been moved from one system to another and we have to do an automatic zerofill. Other fixed: - Added a check to detect a wrong create_trid in 'check table'. - aria_chk -dvv will now write out also the create_trid (to make future error finding easier) - aria_chk --zerofill doesn't anymore require a aria_control_file - Removed some warnings from safemalloc when using aria_chk, ma_test1 and ma_test2. include/myisamchk.h: Removed wrong 'QQ' flags (the flags are used by myisamchk and aria_chk) storage/maria/ha_maria.cc: maria_chk_status() can now also return an error. storage/maria/ma_check.c: In maria_chk_status() check if create_trid value is too big. storage/maria/ma_open.c: Changed check if table is moved so that we can detect wrong create_trid values. Don't set STATE_NOT_MOVABLE flag if we are doing repair/check. This was done so that aria_chk can print out the movable flag. storage/maria/ma_test1.c: Added code to suppress memory leaks from safemalloc storage/maria/ma_test2.c: Added code to suppress memory leaks from safemalloc storage/maria/maria_chk.c: Added code to suppress memory leaks from safemalloc. Make help text a bit better for --HELP and --zerofill. Incresed version number. Don't require a control file if we are only doing --zerofill Print out 'create_trid' when doing --describe --verbose storage/maria/unittest/ma_test_recovery.expected: Updated result file --- storage/maria/ha_maria.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'storage/maria/ha_maria.cc') diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index dd5dfe5ce3a..d050a65a1cb 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1309,8 +1309,9 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt) old_proc_info= thd_proc_info(thd, "Checking status"); thd_progress_init(thd, 3); - (void) maria_chk_status(¶m, file); // Not fatal - error= maria_chk_size(¶m, file); + error= maria_chk_status(¶m, file); // Not fatal + if (maria_chk_size(¶m, file)) + error= 1; if (!error) error|= maria_chk_del(¶m, file, param.testflag); thd_proc_info(thd, "Checking keys"); -- cgit v1.2.1