• Michael Widenius's avatar
    Fixed several errors in Aria discovered by test case for lp:727869... · 079aaf43
    Michael Widenius authored
    Fixed several errors in Aria discovered by test case for lp:727869 ma_pagecache.c:2103: find_block: Assertion `block->rlocks == 0
    - Fixed assert in transaction log handler when aria_check was run on block-record table that was much bigger than expected.
    - Fixed warnings about wrong mutex order between bitmap and intern_lock
    - Fixed error in bitmap that could cause two rows to use same block for a block record.
    - Fixed wrong test that could cause error if last page for a bitmap was used by a blob.
    - Fixed several bugs in pagecache for the case where pagecase had very few blocks and there was a lot of threads competing to get the blocks (very unlikely case).
    
    
    mysql-test/suite/maria/r/maria-recovery3.result:
      Updated results
    sql/mysqld.cc:
      Allow mi_check() to send information messages for log file
    storage/maria/ma_bitmap.c:
      Fixed problem with wrong mutex order when bitmap was the first page that was flushed out of page cache
      - Fixed by introducing _ma_bitmap_mark_file_changed() that marks file changed without a bitmap lock.
      - Fixed one case in _ma_change_bitmap_page() where we didn't mark the bitmap changed. This could cause to rows to reuse same block if this was the only change to the bitmap.
      - Split _ma_bitmap_get_page_bits() in two parts to not take a bitmap lock when we already have it
      - Fixed bug in _ma_bitmap_set_full_page_bits() that caused an error if last page for a bitmap was used by a blob
    storage/maria/ma_check.c:
      Better handling of wrong file length.
      Fixed bug when we tried to write to transaction log when it was not opened (happened when block record file was bigger than expected)
    storage/maria/ma_pagecache.c:
      Fixed several bugs in pagecache for the case where pagecase had very few blocks and there was a lot of threads competing to get the blocks:
      - In link_block() mark a block given to another thread with PCBLOCK_REASSIGNED to ensure that no other threads can start re-using the block
        before the thread that requsted a block.
      - In free_block(), don't reset status for a block that is in re-assign by link_block() (we don't want to loose the PCBLOCK_REASSIGNED flag).
      - Added call to wait_for_flush() when we got a new block in find_block() to ensure that we don't use a block that is beeing flushed by another thread.
      - Moved setting of hits_left and last_hit_time in find_block() to where we assign the block.
      
      
      Code cleanup and making code uniform:
      - Changed a lot of KEYCACHE_DBUG_PRINT to use DBUG_PRINT
      - Streamlined all reporting of 'signal' and 'wait' between threads to be identical.
      - Use thread name instead of thread number (for each match against --debug)
      - Added more DBUG_ENTER, DBUG_PRINT and DBUG_ASSERT()
      - Added more comments
    storage/myisam/ha_myisam.cc:
      Only print information about that we make a backup if we are really making a backup.
    storage/myisam/mi_check.c:
      Inform mysqld that we are creating a backup of the data file (for inclusion in error log).
    079aaf43
ma_bitmap.c 90.3 KB