• Michael Widenius's avatar
    Fixes bugs found by testcase for lp:815022 and lp:726374 "ma_blockrec.c:3000:... · b95d2778
    Michael Widenius authored
    Fixes bugs found by testcase for lp:815022 and lp:726374 "ma_blockrec.c:3000: write_block_record: Assertion `cur_block[1].page_count == 0' failed with a multi-index Aria workload"
    The issues was:
    - For some tables with a lot of not packed fields, we didn't allocate enough memory in head page which caused DBUG_ASSERT's
    - Removed wrong DBUG_ASSERT()
    - Fixed a problem with underflow() where it generates a key page where all keys didn't fit.
    - Max key length is now limited by block_size/3  (was block_size /2).  This is required for underflow() to work with packed keys.
    
    
    
    
    mysql-test/lib/v1/mysql-test-run.pl:
      Remove --alignment=8 as this doesn't work on 64 bit systems
    mysql-test/suite/maria/r/small_blocksize.result:
      Test case for Aria bug
    mysql-test/suite/maria/t/small_blocksize-master.opt:
      Test case for Aria bug
    mysql-test/suite/maria/t/small_blocksize.test:
      Test case for Aria bug
    storage/maria/ha_maria.cc:
      Fixed comment
    storage/maria/ma_bitmap.c:
      Fixed wrong variable usage in find_where_to_split_row() where we allocated too little memory for head page.
      We did not take into account space for head extents (long VARCHAR) when trying to split row on head page. This caused us to allocate too little space from bitmap which lead to ASSERT failures later.
    storage/maria/ma_blockrec.c:
      Made some argument const (to ensure they was not accidently changed)
      Removed wrong DBUG_ASSERT()
    storage/maria/ma_blockrec.h:
      Removed not used variable
    storage/maria/ma_delete.c:
      Added my_afree() in case of error
      More comments and DBUG_ASSERT() for underflow()
    storage/maria/ma_open.c:
      Make keyinfo->underflow_block_length smaller for packed keys. This has to be done as for long packed keys, underflow() otherwise generates a key page where all keys didn't fit.
    storage/maria/ma_page.c:
      New DBUG_ASSERT()
    storage/maria/ma_write.c:
      Fixed comment
    storage/maria/maria_def.h:
      We have to have space for at least 3 keys on a key page.
      (Otherwise the underflow() code doesn't work for packed keys, even when we have an underflow() for an empty key page)
    b95d2778
ma_blockrec.h 13.9 KB