summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2016-01-27 16:33:41 +0200
committerMonty <monty@mariadb.org>2016-01-27 16:33:41 +0200
commit13b79f488b874847d77a7e6d6abe4bd7b5d0aa5a (patch)
treee51ad661582c0f9ebb70fd9cdffc81fa914b8b1e
parentb404b236a2093e9bd259ed0d6c2add62dc3005d4 (diff)
downloadmariadb-git-13b79f488b874847d77a7e6d6abe4bd7b5d0aa5a.tar.gz
Fixed MDEV-9347 Not all rows returned by the C API
Problem was that insert-order (enforced by the optimizer) did not handle the case where the bitmap changed to a new one. Fixed by remembering the last bitmap page used and to force usage of this when inserting new rows
-rw-r--r--storage/maria/ma_bitmap.c17
-rw-r--r--storage/maria/maria_def.h1
2 files changed, 17 insertions, 1 deletions
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index 7c144ac52a4..60d57b95d86 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -1249,7 +1249,7 @@ static my_bool allocate_head(MARIA_FILE_BITMAP *bitmap, uint size,
DBUG_ASSERT(size <= FULL_PAGE_SIZE(share));
- if (insert_order)
+ if (insert_order && bitmap->page == share->last_insert_bitmap)
{
uint last_insert_page= share->last_insert_page;
uint byte= 6 * (last_insert_page / 16);
@@ -1315,6 +1315,7 @@ found:
{
share->last_insert_page=
((uint) (best_data - bitmap->map)) / 6 * 16 + best_pos;
+ share->last_insert_bitmap= bitmap->page;
}
fill_block(bitmap, block, best_data, best_pos, best_bits, FULL_HEAD_PAGE);
DBUG_RETURN(0);
@@ -1614,6 +1615,16 @@ static my_bool find_head(MARIA_HA *info, uint length, uint position)
*/
block= dynamic_element(&info->bitmap_blocks, position, MARIA_BITMAP_BLOCK *);
+ if (info->s->base.extra_options & MA_EXTRA_OPTIONS_INSERT_ORDER)
+ {
+ if (bitmap->page != info->s->last_insert_bitmap &&
+ _ma_change_bitmap_page(info, bitmap,
+ info->s->last_insert_bitmap))
+ return 1;
+ /* Don't allocate any blocks from earlier pages */
+ info->s->state.first_bitmap_with_space= info->s->last_insert_bitmap;
+ }
+
/*
We need to have DIRENTRY_SIZE here to take into account that we may
need an extra directory entry for the row
@@ -3115,6 +3126,10 @@ static my_bool _ma_bitmap_create_missing(MARIA_HA *info,
bzero(bitmap->map, bitmap->block_size);
bitmap->used_size= 0;
#ifndef DBUG_OFF
+ /*
+ Make a copy of the page to be able to print out bitmap changes during
+ debugging
+ */
memcpy(bitmap->map + bitmap->block_size, bitmap->map, bitmap->block_size);
#endif
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index 676927b119a..7337b01a981 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -523,6 +523,7 @@ typedef struct st_maria_share
Keep of track of last insert page, used to implement insert order
*/
uint last_insert_page;
+ pgcache_page_no_t last_insert_bitmap;
} MARIA_SHARE;