• Michael Widenius's avatar
    Fixed MDEV-4291: Assertion `trid >= info->s->state.create_trid' failure or... · 66830664
    Michael Widenius authored
    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
    66830664
ma_test_recovery.expected 55.8 KB