Commit 89e62085 authored by Michael Widenius's avatar Michael Widenius

Fixed recovery bug where bitmap pages would not be correctly updated after processing UNDO rows.

Fixed test failures in buildbot
Don't write errors when failing to send ok packet

mysql-test/suite/pbxt/r/range.result:
  Don't write number of rows as it varies.
mysql-test/suite/pbxt/t/range.test:
  Don't write number of rows as it varies.
sql/mysqld.cc:
  Don't write errors when failing to send ok packet
storage/maria/ma_bitmap.c:
  Added DBUG_ASSERT to detect wrong bitmap pages
storage/maria/ma_blockrec.c:
  Don't reset BLOCKUSED_USE_ORG_BITMAP flag. This fixed a bug where bitmap could be wrong after UNDO of row with blobs
parent 5288f8c0
...@@ -422,20 +422,20 @@ test.t1 analyze status OK ...@@ -422,20 +422,20 @@ test.t1 analyze status OK
test.t2 analyze status OK test.t2 analyze status OK
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where 1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where 1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where 1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where 1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid #
select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id name uid id name uid id name uid id name uid
1001 A 1 1001 A 1 1001 A 1 1001 A 1
......
...@@ -383,9 +383,14 @@ analyze table t1,t2; ...@@ -383,9 +383,14 @@ analyze table t1,t2;
# This part doesn't make sense for pbxt as the result may vary becasue # This part doesn't make sense for pbxt as the result may vary becasue
# records_in_range() gives same results for t1 and t2. # records_in_range() gives same results for t1 and t2.
# Added straight_join to get predictable results # Added straight_join to get predictable results
--replace_column 9 #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
--replace_column 9 #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
--replace_column 9 #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
--replace_column 9 #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
......
...@@ -3070,10 +3070,11 @@ int my_message_sql(uint error, const char *str, myf MyFlags) ...@@ -3070,10 +3070,11 @@ int my_message_sql(uint error, const char *str, myf MyFlags)
} }
else else
{ {
if (thd->main_da.is_ok()) if (thd->main_da.is_ok() && !thd->main_da.can_overwrite_status)
{ {
/* /*
Client has already got ok packet; Write message to error log. Client has already got ok packet and we are not in net_flush(), so
we write a message to error log.
This could happen if we get an error in implicit commit. This could happen if we get an error in implicit commit.
This should never happen in normal operation, so lets This should never happen in normal operation, so lets
assert here in debug builds. assert here in debug builds.
......
...@@ -1875,6 +1875,7 @@ static my_bool set_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap, ...@@ -1875,6 +1875,7 @@ static my_bool set_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap,
uint offset_page, offset, tmp, org_tmp; uint offset_page, offset, tmp, org_tmp;
uchar *data; uchar *data;
DBUG_ENTER("set_page_bits"); DBUG_ENTER("set_page_bits");
DBUG_ASSERT(fill_pattern <= 7);
bitmap_page= page - page % bitmap->pages_covered; bitmap_page= page - page % bitmap->pages_covered;
if (bitmap_page != bitmap->page && if (bitmap_page != bitmap->page &&
...@@ -2296,9 +2297,16 @@ my_bool _ma_bitmap_release_unused(MARIA_HA *info, MARIA_BITMAP_BLOCKS *blocks) ...@@ -2296,9 +2297,16 @@ my_bool _ma_bitmap_release_unused(MARIA_HA *info, MARIA_BITMAP_BLOCKS *blocks)
The page has all bits set; The following test is an optimization The page has all bits set; The following test is an optimization
to not set the bits to the same value as before. to not set the bits to the same value as before.
*/ */
if (bits != current_bitmap_value && if (bits != current_bitmap_value)
set_page_bits(info, bitmap, block->page, bits)) {
goto err; if (set_page_bits(info, bitmap, block->page, bits))
goto err;
}
else
{
DBUG_ASSERT(current_bitmap_value ==
_ma_bitmap_get_page_bits(info, bitmap, block->page));
}
} }
else if (!(block->used & BLOCKUSED_USED) && else if (!(block->used & BLOCKUSED_USED) &&
_ma_bitmap_reset_full_page_bits(info, bitmap, _ma_bitmap_reset_full_page_bits(info, bitmap,
......
...@@ -1990,7 +1990,8 @@ static my_bool write_tail(MARIA_HA *info, ...@@ -1990,7 +1990,8 @@ static my_bool write_tail(MARIA_HA *info,
block->empty_space= (enough_free_entries(row_pos.buff, share->block_size, block->empty_space= (enough_free_entries(row_pos.buff, share->block_size,
1 + share->base.blobs) ? 1 + share->base.blobs) ?
empty_space : 0); empty_space : 0);
block->used= BLOCKUSED_USED | BLOCKUSED_TAIL; /* Keep BLOCKUSED_USE_ORG_BITMAP */
block->used|= BLOCKUSED_USED | BLOCKUSED_TAIL;
/* Increase data file size, if extended */ /* Increase data file size, if extended */
position= (my_off_t) block->page * block_size; position= (my_off_t) block->page * block_size;
......
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