- Fixed assert in transaction log handler when aria_check was run on block-record table that was much bigger than expected.
- Fixed warnings about wrong mutex order between bitmap and intern_lock
- Fixed error in bitmap that could cause two rows to use same block for a block record.
- Fixed wrong test that could cause error if last page for a bitmap was used by a blob.
- Fixed several bugs in pagecache for the case where pagecase had very few blocks and there was a lot of threads competing to get the blocks (very unlikely case).
mysql-test/suite/maria/r/maria-recovery3.result:
Updated results
sql/mysqld.cc:
Allow mi_check() to send information messages for log file
storage/maria/ma_bitmap.c:
Fixed problem with wrong mutex order when bitmap was the first page that was flushed out of page cache
- Fixed by introducing _ma_bitmap_mark_file_changed() that marks file changed without a bitmap lock.
- Fixed one case in _ma_change_bitmap_page() where we didn't mark the bitmap changed. This could cause to rows to reuse same block if this was the only change to the bitmap.
- Split _ma_bitmap_get_page_bits() in two parts to not take a bitmap lock when we already have it
- Fixed bug in _ma_bitmap_set_full_page_bits() that caused an error if last page for a bitmap was used by a blob
storage/maria/ma_check.c:
Better handling of wrong file length.
Fixed bug when we tried to write to transaction log when it was not opened (happened when block record file was bigger than expected)
storage/maria/ma_pagecache.c:
Fixed several bugs in pagecache for the case where pagecase had very few blocks and there was a lot of threads competing to get the blocks:
- In link_block() mark a block given to another thread with PCBLOCK_REASSIGNED to ensure that no other threads can start re-using the block
before the thread that requsted a block.
- In free_block(), don't reset status for a block that is in re-assign by link_block() (we don't want to loose the PCBLOCK_REASSIGNED flag).
- Added call to wait_for_flush() when we got a new block in find_block() to ensure that we don't use a block that is beeing flushed by another thread.
- Moved setting of hits_left and last_hit_time in find_block() to where we assign the block.
Code cleanup and making code uniform:
- Changed a lot of KEYCACHE_DBUG_PRINT to use DBUG_PRINT
- Streamlined all reporting of 'signal' and 'wait' between threads to be identical.
- Use thread name instead of thread number (for each match against --debug)
- Added more DBUG_ENTER, DBUG_PRINT and DBUG_ASSERT()
- Added more comments
storage/myisam/ha_myisam.cc:
Only print information about that we make a backup if we are really making a backup.
storage/myisam/mi_check.c:
Inform mysqld that we are creating a backup of the data file (for inclusion in error log).
There were so many changes into mtr (this is the new mtr coming) that I rather
copied mtr from 6.0-main here (at least this one knows how to run Maria tests).
I also fixed suite/maria tests to be accepted by the new mtr.
mysys/thr_mutex.c:
adding DBUG_PRINT here, so that we can locate where the warning is issued.
mysql-test/suite/maria/r/maria-recovery3.result:
result update
mysql-test/suite/maria/t/maria-recovery3.test:
Test for BUG#42112; before the bugfix, recovery would assert like this:
ma_blockrec.c:6051: _ma_apply_redo_insert_row_head_or_tail: Assertion `rownr == 0 && new_page' failed.
storage/maria/ma_create.c:
Fix for BUG#42112; plus some intentional crashes to test the fix. The bug was that if crash happened during
TRUNCATE TABLE, in maria_create(), after the index file's state has been written but before its LSNs
have been updated (so, if crash happened between _ma_state_info_write_sub() and _ma_update_state__lsns_sub()),
then that would leave a table with create_rename_lsn==0. Recovery would then try old pre-TRUNCATE REDOs
on this table, and fail as this table is already partly shortened. Fix is to write create_rename_lsn==LSN_MAX
as soon as TRUNCATE touches the index file, so that Recovery ignores this table. This allows Maria to start;
the table is still corrupted but the user can successfully repeat TRUNCATE TABLE (which required Maria to start).
storage/maria/ma_delete_all.c:
A comment.
output related to this.
mysql-test/suite/maria/r/maria-recovery3.result:
result update
mysql-test/suite/maria/t/maria-recovery3.test:
Test for bug; before the fix, the "CHECK TABLE EXTENDED" would mention a bad bitmap, because the
REDO_INSERT_ROW_BLOBS was containing a page number which was actually the one of a tail, so execution of this
record would mark the tail page as full in bitmap (like if it were a blob page), though it wasn't full.
Also, the assertion added around ma_blockrec.c:6580 in the present revision fired.
storage/maria/ma_blockrec.c:
- fix for BUG#41493: if we found out that logging was not needed at this point (blob_length==0 i.e. tail page),
then we forgot to increment tmp_block, so in the second iteration (assuming two BLOB columns), we would log the
page range of the first iteration (i.e. the tail page's number) for this second BLOB, which would cause
Recovery to overwrite the tail page with the second BLOB.
- assert when marking the table corrupted during REDO phase; this catches some problems earlier
otherwise they get caught only when a later record wants to use the table.
- _ma_apply_redo_insert_row_blobs() now fills some synthetic info about the blobs and pages involved
in a REDO_INSERT_ROW_BLOBS record, for inclusion into maria_recovery.trace: number of blobs, of ranges,
first and last page (does not tell about any gaps in the middle, but good enough for now). It also asserts
that it's not overwriting a tail/head page (which happened in the bug).
storage/maria/ma_blockrec.h:
new prototype for _ma_apply_redo_insert_row_blobs
storage/maria/ma_recovery.c:
Print info got from _ma_apply_redo_insert_row_blobs() to maria_recovery.trace (so far this file had mentioned
what head and tail pages a record touched, but not blob pages).
mysql-test/suite/maria/r/maria-recovery3.result:
result.
mysql-test/suite/maria/t/maria-recovery3-master.opt:
usual recovery test options
mysql-test/suite/maria/t/maria-recovery3.test:
Test for BUG#41037. Without the bugfix, the test would hang because Recovery would fail with "undo_key_insert got error 126": Recovery would believe INSERT of 2 is uncommitted, try to execute its UNDO_KEY_INSERT, fail to find the key to delete because DELETE deleted it. That failure of _ma_ck_real_delete() would mark table as corrupted (see
in d_search()) which is error 126 (HA_ERR_CRASHED).
storage/maria/ma_blockrec.c:
set trn->rec_lsn to LSN of commit record, when writing it.
storage/maria/ma_blockrec.h:
new function
storage/maria/ma_commit.c:
when committing or rolling back, rec_lsn should be LSN_IMPOSSIBLE: assertion is moved here
from trnman_end_trn(), because now ma_commit() can set rec_lsn and so when we reach trnman_end_trn()
it's not LSN_IMPOSSIBLE anymore.
Adding debug possibility to pause between COMMIT record write and trnman_commit_trn(), to be
able to fire checkpoint in between.
storage/maria/ma_loghandler.c:
in-write hook for COMMIT records
storage/maria/ma_recovery.c:
More debugging info in maria_recovery.trace, to see how the starting point of REDO phase is determined
storage/maria/trnman.c:
assertion cannot be here anymore see ma_commit.c