Commit 55bc3f1d authored by Monty's avatar Monty

Fixed performance problem with Aria in find_head()

For some simple benchmarks, a majority of time was
spend in find_head() which tries to find the best
place to put the record.

The result of this patch is a 2x or more speedup for
inserts without keys for format PAGE. All changes
are only related to how rows are stored

Should fix some of the problems mentioned in:
MDEV-8132 Temporary tables using Aria with very poor performance
MDEV-9079 Aria very slow for internal temporary tables
MDEV-5841 Mariadb very poor temporary performance

The following changes where done:
- For rows with a small row length that fits into
  a page (818 bytes with 8192 pages), stop as soon as we
  hit a match.
- Added markers full_head_size and full_tail_size that tells
  us where to start searching on the bitmap page
- Ensure that page->used_size is correctly updated when
  bitmap grows. This allows us to stop searching at used_size
- Added code to check that the bitmap variables are correct.
- Fixed a wrong test where we set "first_bitmap_with_space".
  This shouldn't have caused any notable problems.
parent 965e1637
This diff is collapsed.
......@@ -331,7 +331,10 @@ typedef struct st_maria_file_bitmap
pgcache_page_no_t last_bitmap_page; /* Last possible bitmap page */
my_bool changed; /* 1 if page needs to be written */
my_bool changed_not_flushed; /* 1 if some bitmap is not flushed */
my_bool return_first_match; /* Shortcut find_head() */
uint used_size; /* Size of bitmap head that is not 0 */
uint full_head_size; /* Where to start search for head */
uint full_tail_size; /* Where to start search for tail */
uint flush_all_requested; /**< If _ma_bitmap_flush_all waiting */
uint waiting_for_flush_all_requested; /* If someone is waiting for above */
uint non_flushable; /**< 0 if bitmap and log are in sync */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment