diff --git a/mysql-test/suite/pbxt/r/range.result b/mysql-test/suite/pbxt/r/range.result index 2439489581a..a8e97d1c725 100644 --- a/mysql-test/suite/pbxt/r/range.result +++ b/mysql-test/suite/pbxt/r/range.result @@ -422,20 +422,20 @@ test.t1 analyze status OK test.t2 analyze status OK 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 -1 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where -1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 +1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where +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; 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 t2 ref uid_index uid_index 4 test.t1.uid 1 +1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where +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; 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 t2 ref uid_index uid_index 4 test.t1.uid 1 +1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where +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; 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 t2 ref uid_index uid_index 4 test.t1.uid 1 +1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where +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; id name uid id name uid 1001 A 1 1001 A 1 diff --git a/mysql-test/suite/pbxt/t/range.test b/mysql-test/suite/pbxt/t/range.test index 2e4e2b7da12..8d02089ee1b 100644 --- a/mysql-test/suite/pbxt/t/range.test +++ b/mysql-test/suite/pbxt/t/range.test @@ -383,9 +383,14 @@ analyze table t1,t2; # This part doesn't make sense for pbxt as the result may vary becasue # records_in_range() gives same results for t1 and t2. # 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; +--replace_column 9 # 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; +--replace_column 9 # 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; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c589ededa9c..71d15e873bc 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3070,10 +3070,11 @@ int my_message_sql(uint error, const char *str, myf MyFlags) } 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 should never happen in normal operation, so lets assert here in debug builds. diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c index a76b36e1115..ff23c408931 100644 --- a/storage/maria/ma_bitmap.c +++ b/storage/maria/ma_bitmap.c @@ -1875,6 +1875,7 @@ static my_bool set_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap, uint offset_page, offset, tmp, org_tmp; uchar *data; DBUG_ENTER("set_page_bits"); + DBUG_ASSERT(fill_pattern <= 7); bitmap_page= page - page % bitmap->pages_covered; if (bitmap_page != bitmap->page && @@ -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 to not set the bits to the same value as before. */ - if (bits != current_bitmap_value && - set_page_bits(info, bitmap, block->page, bits)) - goto err; + if (bits != current_bitmap_value) + { + 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) && _ma_bitmap_reset_full_page_bits(info, bitmap, diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index 0779564c8af..f582bfb3b97 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -1990,7 +1990,8 @@ static my_bool write_tail(MARIA_HA *info, block->empty_space= (enough_free_entries(row_pos.buff, share->block_size, 1 + share->base.blobs) ? 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 */ position= (my_off_t) block->page * block_size;