mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
79 commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Michael Widenius
|
6db663d614 |
Fixes for Aria storage engine:
- Fixed bug lp:624099 ma_close.c:75: maria_close: Assertion `share->in_trans == 0' failed on UNLOCK TABLES - Fixed bug that caused table to be marked as not closed (crashed) during recovery testing. - Use maria_delete_table_files() instead of maria_delete_table() to delete tempoary tables (faster and safer) - Added checks to ensure that bitmap and internal mutex are always taken in right order. - For transactional tables, only mark the table as changed before page for table is to be written to disk (and thus the log is flushed). This speeds up things a bit and fixes a problem where open_count was incremented on disk but there was no log entry to fix it during recovery -> table was crashed. - Fixed a bug in repair() where table was not automaticly repaired. - Ensure that state->global_changed, share->changed and share->state.open_count are set and reset properly. - Added option --ignore-control-file to maria_chk to be able to run maria_chk even if the control file is locked. mysql-test/suite/maria/r/maria-recover.result: Test result changed as we now force checkpoint before copying table, which results in pagecache getting flushed and we have more rows to recover. mysql-test/suite/maria/r/maria.result: Added new tests mysql-test/suite/maria/t/maria-recover.test: Force checkpoint before copying table. This is needed as now the open-count is increased first when first page is flushed. mysql-test/suite/maria/t/maria.test: Added tests to verify fix for lp:624099 storage/maria/ha_maria.cc: Use table->in_use instead of current_thd (trivial optimization) Use maria_delete_table_files() instead of maria_delete_table() to delete tempoary tables (faster and safer) More DBUG_ASSERT() Reset locked tables count after locked tables have been moved to new transaction. This fixed lp:624099 storage/maria/ma_bitmap.c: Temporarly unlock bitmap mutex when calling _ma_mark_file_changed() and pagecache_delete_pages() to ensure right mutex lock order. Call _ma_bitmap_unpin_all() when bitmap->non_flusable is set to 0. This fixed a case when bitmap was not proparly unpinned. More comments Added DBUG_ASSERT() for detecting wrong share->bitmap usage storage/maria/ma_blockrec.c: More DBUG_ASSERT() Moved code around in _ma_apply_redo_insert_row_head_or_tail() to make things safer on error conditions. storage/maria/ma_check.c: Changed parameter for _ma_set_uuid() Corrected test for detecting if we lost many rows. This fixed some cases where auto-recovery failed. share->changed need to be set if state.open_count is changed. Removed setting of share->changed= 0 as called function sets it. storage/maria/ma_close.c: - Added code to properly decrement open_count and have it written by _ma_state_info_write() for transactional tables. (This is more correct and also saves us one extra write by _ma_decrement_open_count() at close. - Added DBUG_ASSERT() to detect if open_count is wrong at maria_close(). storage/maria/ma_delete.c: Updated argument to _ma_mark_file_changed() storage/maria/ma_delete_all.c: Updated argument to _ma_mark_file_changed() For transactional tables, call _ma_mark_file_changed() after log entry has been written (to allow recover to fix open_count) Reset more needed variables in _ma_reset_status() storage/maria/ma_delete_table.c: Moved deletion of Aria files to maria_delete_table_files(). Remove RAID usage (old not working code) storage/maria/ma_extra.c: Set share->changed=1 when state needs to be updated on disk. Don't reset share->changed after call to _ma_state_info_write() as this calls sets share->changed. Set share->state.open_count to 1 to force table to be auto repaired if drop fails. Set share->global_changed before call to _ma_flush_table_files() to ensure that we don't try to mark the table changed during flush. Added DBUG_ENTER storage/maria/ma_locking.c: Split _ma_mark_file_changed() into two functions to delay marking transactional tables as changed on disk until first disk write. Added argument to _ma_decrement_open_count() to tell if we should call ma_lock_database() or not. Don't decrement open count for transactional tables during _ma_decrement_open_count(). This will be done during close. Changed parameter for _ma_set_uuid() storage/maria/ma_open.c: Set share->open_count_not_zero_on_open if state.open_count is not zero. This is needed for DBUG_ASSERT() in maria_close() that is there to enforce that open_count is always 0 at close. This test doesn't however work for tables that had open_count != 0 already on disk (ie, crashed tables). Enforce right mutex order for share->intern_lock and share->bitmap.bitmap_lock Don't set share->changed to 0 if share->state.open_count != 0, as state needs to be be written at close storage/maria/ma_pagecache.c: Moved a bit of code in find_block() to avoid one if. More DBUG_ASSERT() (I left a comment in the code for Sanja to look at; The code probably works but we need to check if it's optimal) storage/maria/ma_pagecrc.c: For transactional tables, just before first write to disk, but after log is flushed, mark the file changed. This fixes some cases where recovery() did not detect that table was marked as changed and could thus not recover the marker. storage/maria/ma_recovery.c: Set share->changed when share->global_changed is set. storage/maria/ma_update.c: Updated parameter for _ma_mark_file_changed() storage/maria/ma_write.c: Updated parameter for _ma_mark_file_changed() storage/maria/maria_chk.c: Added option --ignore-control-file to be able to run maria_chk even if the control file is locked. storage/maria/maria_def.h: Updated function prototypes. Added open_count_not_zero_on_open to MARIA_SHARE. storage/myisam/ha_myisam.cc: current_thd -> table->in_use |
||
Michael Widenius
|
5bcf3a242c |
Aria fixes:
- Fixed a bug where we didn't signal a thread waiting for bitmap flush that it's now time to continue which caused a deadlock in Aria. - Fix for lp:700623 "Aria recovery: ma_blockrec.c:3930: _ma_update_at_original_place: Assertion `block->org_bitmap_value == _ma_bitmap_get_page_bits(info, &info->s->bitmap, page)' failed" - Fixed a bug in pagecache where a block could change while it was in use. - In maria_chk set --update-state to on by default so that open_count is cleared if table was ok during check. storage/maria/ma_bitmap.c: Fixed a bug where we didn't signal a thread waiting for bitmap flush that it's now time to continue. This fix adds counters for the different conditions that may be waited upon and signals if there is a waiter when the condition changes. storage/maria/ma_blockrec.c: Check if directory if full when calculating what should be in the bitmap. Fixes lp:700623 "Aria recovery: ma_blockrec.c:3930: _ma_update_at_original_place: Assertion `block->org_bitmap_value == _ma_bitmap_get_page_bits(info, &info->s->bitmap, page)' failed" storage/maria/ma_pagecache.c: Added more comments Removed some duplicated DBUG_PRINT and DBUG_ASSERT() find_block() now waits for block to be usable if we are not copying it directly. This fixes a bug where a block changed information while we where using it. Fixed by adding an extra parameter to find_block() Simplified code in make_lock_and_pin() as block can never be == 0 here. storage/maria/ma_recovery.c: Reset open_count for tables that are closed in middle of recovery. storage/maria/maria_chk.c: Set --update-state to on by default so that open_count is cleared if table was ok during check. Update time when table was recovered/checked if --update-state was used. Updated --help message with missing information. storage/maria/maria_def.h: Added wait counters |
||
Michael Widenius
|
26565ae1d6 |
Aria issues:
- Fix for LP#700623 "Aria recovery: ma_blockrec.c:3930: _ma_update_at_original_place: Assertion `block->org_bitmap_value == _ma_bitmap_get_page_bits(info, &info->s->bitmap, page)' failed" - Issue was that when deleting a tail page where all index entries where full, the page was marked wrongly in the bitmap. - If debug_assert_if_crashed_table is set, we now crash when we find Aria corrupted. - Write more information if we find something wrong with the bitmap. - Fixed that REPAIR also can fix wrong create_rename_lsn issues (a very unlikely event) - Define STATE_CRASHED_FLAGS as set of all CRASHED flags (to simplify code) storage/maria/ha_maria.cc: Mark the normal page cache (not the page cache for the logs) so that we can request extra debugging for it. Copy the value of debug_assert_if_crashed_table to maria_assert_if_crashed_table so that we can request a crash at exactly the point where we find Aria corrupted. Use STATE_CRASHED_FLAGS storage/maria/ma_bitmap.c: Made bits_to_txt extern so that we can use this in maria_chk Added extra information to the log files to be able to easier find bitmap failures in recovery. (When compiling with -DEXTRA_DEBUG_BITMAP) Added _ma_get_bitmap_description() to request a clear text description of the bitmap. Simplify _ma_check_bitmap_data(), as we know the bitmap pattern in the caller. storage/maria/ma_blockrec.c: In delete_head_or_tail(), fixed a bug where we sent wrong information to _ma_bitmap_set() if the directory was full for a page that should be freed. This fixed LP#700623 (failure in bitmap found during recovery) storage/maria/ma_blockrec.h: Added definitions for _ma_get_bitmap_description() and bits_to_txt storage/maria/ma_check.c: Simplify call to _ma_check_bitmap_data(). Write more information if we find something wrong with the bitmap. Moved getting clear text information about the bitmap to ma_bitmap.c::_ma_get_bitmap_description() storage/maria/ma_checkpoint.c: More asserts storage/maria/ma_create.c: Fix wrong create_rename_lsn during repair. (Create_rename_lsn can be too big if someone restores an old maria_log_file after an Aria file was created) storage/maria/ma_delete.c: Call _ma_set_fatal_error() in case of crashed file Remove not needed test of save_errno == HA_ERR_KEY_NOT_FOUND. (Handled by other code storage/maria/ma_extra.c: Call _ma_set_fatal_error() in case of crashed file Reset share->bitmap.changed_not_flushed to not cause new ASSERTS to trigger. Added _ma_file_callback_to_id() for writing share->id to log file in case of DEBUG logging. storage/maria/ma_init.c: Destroy also translog if it's readonly (as when called by maria_read_log -d) storage/maria/ma_key.c: Call _ma_set_fatal_error() in case of crashed file storage/maria/ma_key_recover.c: STATE_CRASHED -> STATE_CRASHED_FLAGS storage/maria/ma_keycache.c: Call _ma_set_fatal_error() in case of crashed file storage/maria/ma_locking.c: Call _ma_set_fatal_error() in case of crashed file. Added _ma_set_fatal_error() storage/maria/ma_open.c: Call _ma_set_fatal_error() in case of crashed file storage/maria/ma_page.c: Call _ma_set_fatal_error() in case of crashed file storage/maria/ma_pagecache.c: Added extra information to log file to simply debugging of bitmap errors. storage/maria/ma_pagecache.h: Added extra_debug flag to allow marking of row and index cache for extra logging (for debugging). storage/maria/ma_panic.c: Flush both data and index blocks in case of HA_PANIC_CLOSE Fixed wrong position of 'break'. (Not critical for MariaDB as MariaDB never uses this code) storage/maria/ma_recovery_util.c: Avoid writing extra not needed \n to DBUG log. storage/maria/ma_rkey.c: Call _ma_set_fatal_error() in case of crashed file storage/maria/ma_search.c: Call _ma_set_fatal_error() in case of crashed file storage/maria/ma_static.c: Define maria_assert_if_crashed_table storage/maria/ma_update.c: Call _ma_set_fatal_error() in case of crashed file. The new code also avoids a problem where we before would print the error twice. storage/maria/ma_write.c: Call _ma_set_fatal_error() in case of crashed file storage/maria/maria_chk.c: STATE_CRASHED -> STATE_CRASHED_FLAGS storage/maria/maria_def.h: Added STATE_CRASHED_PRINTED to avoid giving error message about crash twice. Added STATE_CRASHED_FLAGS to be able to easily detect and set all CRASHED related flags. Added prototypes for new functions. storage/myisam/mi_panic.c: Fixed wrong position of 'break'. (Not critical for MariaDB as MariaDB never uses this code) |
||
Michael Widenius
|
1e0b42d91f |
Fixed recovery problem in Aria where bitmap had wrong information after recovery.
LP#619731: Aria recovery corruption "Page 1: Row: 1 has an extent with wrong information in bitmap storage/maria/ma_bitmap.c: Don't send broadcast if no one is waiting for it storage/maria/ma_blockrec.c: Don't update bitmap if the page is not in the dirty_page list (or LSN is after checkpoint start) Fixes the case where we have in the log redo_free_block followed by another redo entry for the same page which is ignored. Also fixed that _ma_apply_redo_insert_row_blobs() doesn't update the bitmap in similar circumstances. storage/maria/ma_blockrec.h: Updated prototype storage/maria/ma_check.c: Added printing of bitmap information if used with maria_chk -vvv (for debugging) storage/maria/ma_recovery.c: Updated call parameters to _ma_apply_redo_free_blocks(). |
||
Michael Widenius
|
d95cbe369c |
Fixed bug discovered by testcase for LP#618558 (original bug seams to be fixed):
- Fixed bug in pagecache_delete_internal() when deleting block that was flushed by another thread (fixed bug when block->next_used was unexpectedly null) Fixed some using uninitialized memory warnings found by valgrind. mysql-test/t/information_schema_all_engines-master.opt: Added options to make slow test run faster sql/sp.cc: Fixed valgrind warning. sql/sql_show.cc: Fixed valgrind warning. storage/maria/ma_bitmap.c: Fixed wrong call parameter to pagecache_unlock_by_link() that caused assert crash in pagecache storage/maria/ma_pagecache.c: Fixed possible error in pagecache_wait_lock() when hash_link was not set. (We never hit this issue, but could be possible when two threads updates the same page. Fixed bug in pagecache_delete_internal() when deleting block that was flushed by another thread (fixed bug when block->next_used was unexpectedly null) Cleanup: moved pagecache_pthread_mutex_unlock() over comments and asserts to be just before pagecache_fwrite() |
||
Michael Widenius
|
5b3159dbc7 |
Fixed compiler & valgrind warnings from my previous push.
Fixed a bug in Aria when two threads was inserting into the same table and row page and one thread did an abort becasue of duplicate key. mysys/thr_lock.c: Fixed valgrind warning sql/sql_base.cc: Remove not used variable storage/maria/ma_bitmap.c: Added ma_bitmap_lock() & ma_bitmap_unlock() to protect against two threads using the bitmap at the same time. More DBUG_PRINT() storage/maria/ma_blockrec.c: Fixed a bug in Aria when two threads was inserting into the same table and row page and one thread did an abort becasue of duplicate key. Fix was that we block other threads to modify the bitmap while we are removing the row with a duplicate key. storage/maria/ma_blockrec.h: Added ma_bitmap_lock() & ma_bitmap_unlock() to protect against two threads using the bitmap at the same time. storage/maria/maria_def.h: Changed flush_all_requested to be a counter. storage/myisam/mi_locking.c: Fixed compiler error on windows (typo). |
||
Michael Widenius
|
20acfbf30d |
Fix for: LP #634955: Assert in _ma_update_at_original_place()
Added locking of lock mutex when updating status in external_unlock() for Aria and MyISAM tables. Fixed that 'source' command doesn't cause mysql command line tool to exit on error. DEBUG_EXECUTE() and DEBUG_EVALUATE_IF() should not execute things based on wildcards. (Allows one to run --debug with mysql-test-run scripts that uses @debug) Fixed several core dump, deadlock and crashed table bugs in handling of LOCK TABLE with MERGE tables: - Added priority of locks to avoid crashes with MERGE tables. - Added thr_lock_merge() to allow one to merge two results of thr_lock(). Fixed 'not found row' bug in REPLACE with Aria tables. Mark MyISAM tables that are part of MERGE with HA_OPEN_MERGE_TABLE and set the locks to have priority THR_LOCK_MERGE_PRIV. - By sorting MERGE tables last in thr_multi_unlock() it's safer to release and relock them many times (can happen when TRIGGERS are created) Avoid printing (null) in debug file (to easier find out wrong NULL pointer usage with %s). client/mysql.cc: Fixed that 'source' command doesn't cause mysql command line tool to exit on error. client/mysqltest.cc: Don't send NULL to fn_format(). (Can cause crash on Solaris when using --debug) dbug/dbug.c: DEBUG_EXECUTE() and DEBUG_EVALUATE_IF() should not execute things based on wildcards. include/my_base.h: Added flag to signal if one opens a MERGE table. Added extra() command to signal that one is not part of a MERGE table anymore. include/thr_lock.h: Added priority for locks (needed to fix bug in thr_lock when using MERGE tables) Added option to thr_unlock() if get_status() should be called. Added prototype for thr_merge_locks(). mysql-test/mysql-test-run.pl: Ignore crashed table warnings for tables named 'crashed'. mysql-test/r/merge.result: Renamed triggers to make debugging easier. Added some CHECK TABLES to catch errors earlier. Additional tests. mysql-test/r/merge_debug.result: Test of error handling when reopening MERGE tables. mysql-test/r/udf_query_cache.result: Added missing flush status mysql-test/suite/parts/r/partition_repair_myisam.result: Update results mysql-test/t/merge.test: Renamed triggers to make debugging easier. Added some CHECK TABLES to catch errors earlier. Additional tests. mysql-test/t/merge_debug.test: Test of error handling when reopening MERGE tables. mysql-test/t/udf_query_cache.test: Added missing flush status mysys/my_getopt.c: Removed not used variable mysys/my_symlink2.c: Changed (null) to (NULL) to make it easier to find NULL arguments to DBUG_PRINT() functions. (On linux, NULL to sprintf is printed 'null') mysys/thr_lock.c: Added priority of locks to avoid crashes with MERGE tables. Added thr_lock_merge() to allow one to merge two results of thr_lock(). - This is needed for MyISAM as all locked table must share the same status. If not, you will not see newly inserted rows in other instances of the table. If calling thr_unlock() with THR_UNLOCK_UPDATE_STATUS, call update_status() and restore_status() for the locks. This is needed in some rare cases where we call thr_unlock() followed by thr_lock() without calling external_unlock/external_lock in between. Simplify loop in thr_multi_lock(). Added 'start_trans', which is called at end of thr_multi_lock() when all locks are taken. - This was needed by Aria to ensure that transaction is started when we got all locks, not at get_status(). Without this, some rows could not be visible when we lock two tables at the same time, causing REPLACE using two tables to fail unexpectedly. sql/handler.cc: Add an assert() in handler::print_error() for "impossible errors" (like table is crashed) when --debug-assert-if-crashed-table is used. sql/lock.cc: Simplify mysql_lock_tables() code if get_lock_data() returns 0 locks. Added new parameter to thr_multi_unlock() In mysql_unlock_read_tables(), call first externa_unlock(), then thr_multi_unlock(); This is same order as we do in mysql_unlock_tables(). Don't abort locks in mysql_lock_abort() for merged tables when a MERGE table is deleted; Would cause a spin lock. Added call to thr_merge_locks() in mysql_lock_merge() to ensure consistency in thr_locks(). - New locks of same type and table is stored after the old lock to ensure that we get the status from the original lock. sql/mysql_priv.h: Added debug_assert_if_crashed_table sql/mysqld.cc: Added --debug-assert-if-crashed-table sql/parse_file.cc: Don't print '(null)' in DBUG_PRINT of no dir given sql/set_var.cc: Increase default size of buffer for @debug variable. sql/sql_base.cc: In case of error from reopen_table() in reopen_tables(), call unlock_open_table() and restart loop. - This fixed bug when we twice deleted same table from open_cache. Don't take name lock for already name locked table in open_unireg_entry(). - Fixed bug when doing repair in reopen_table(). - In detach_merge_children(), always detach if 'clear_refs' is given. We can't trust parent->children_attached as this function can be called twice, first time with clear_refs set to 0. sql/sql_class.cc: Changed printing of (null) to "" in set_thd_proc_info() sql/sql_parse.cc: Added DBUG sql/sql_trigger.cc: Don't call unlink_open_table() if reopen_table() fails as the table may already be freed. storage/maria/ma_bitmap.c: Fixed DBUG_ASSERT() in allocate_tail() storage/maria/ma_blockrec.c: Fixed wrong calculation of row length for very small rows in undo_row_update(). - Fixes ASSERT() when doing undo. storage/maria/ma_blockrec.h: Added _ma_block_start_trans() and _ma_block_start_trans_no_versioning() storage/maria/ma_locking.c: Call _ma_update_status_with_lock() when releasing write locks. - Fixes potential problem with updating status without the proper lock. storage/maria/ma_open.c: Changed to use start_trans() instead of get_status() to ensure that we see all rows in all locked tables when we got the locks. - Fixed 'not found row' bug in REPLACE with Aria tables. storage/maria/ma_state.c: Added _ma_update_status_with_lock() and _ma_block_start_trans(). This is to ensure that we see all rows in all locked tables when we got the locks. storage/maria/ma_state.h: Added _ma_update_status_with_lock() storage/maria/ma_write.c: More DBUG_PRINT storage/myisam/mi_check.c: Fixed error message storage/myisam/mi_extra.c: Added HA_EXTRA_DETACH_CHILD: - Detach MyISAM table to not be part of MERGE table (remove flag & lock priority). storage/myisam/mi_locking.c: Call mi_update_status_with_lock() when releasing write locks. - Fixes potential problem with updating status without the proper lock. Change to use new HA_OPEN_MERGE_TABLE flag to test if MERGE table. Added mi_fix_status(), called by thr_merge(). storage/myisam/mi_open.c: Added marker if part of MERGE table. Call mi_fix_status() in thr_lock() for transactional tables. storage/myisam/myisamdef.h: Change my_once_flag to uint, as it stored different values than just 0/1 Added 'open_flag' to store state given to mi_open() storage/myisammrg/ha_myisammrg.cc: Add THR_LOCK_MERGE_PRIV to THR_LOCK_DATA to get MERGE locks sorted after other types of locks. storage/myisammrg/myrg_locking.c: Remove windows specific code. storage/myisammrg/myrg_open.c: Use HA_OPEN_MERGE_TABLE to mi_open(). Set HA_OPEN_MERGE_TABLE for linked MyISAM tables. storage/xtradb/buf/buf0buf.c: Fixed compiler warning storage/xtradb/buf/buf0lru.c: Initialize variable that could be used not initialized. |
||
Michael Widenius
|
2f85f78db4 |
Fixes some bug in Aria recovery:
- _ma_apply_redo_index: Assertion `page_offset != 0 && page_offset + length <= page_length' failed Fixes one bug and one log assert when inserting rows: - _ma_log_split: Assertion `org_length <= info->s->max_index_block_size' failed - write_block_record: Assertion '(data_length < MAX_TAIL_SIZE(block_size)' failed Mark in recovery log where _ma_log_add() calls was done (for better debugging). storage/maria/ma_bitmap.c: Don't write a head part on a tail page. (Caused an assert in write_block_record()) storage/maria/ma_delete.c: Mark in recovery log where _ma_log_add() calls was done storage/maria/ma_key_recover.c: Mark in recovery log where _ma_log_add() calls was done Fixed not handled logging case for overfull index pages. storage/maria/ma_key_recover.h: Mark in recovery log where _ma_log_add() calls was done storage/maria/ma_loghandler.h: Mark in recovery log where _ma_log_add() calls was done storage/maria/ma_rt_key.c: Mark in recovery log where _ma_log_add() calls was done storage/maria/ma_write.c: Mark in recovery log where _ma_log_add() calls was done. Fixed wrong call to _ma_split_page() for overfull pages |
||
Michael Widenius
|
b7158601d3 |
Fixed bug LP#605798 "wrong data in bitmap" after recovery.
Extend remove_function_from_trace.pl to work with many threads (patch from Sergei) dbug/remove_function_from_trace.pl: Extend remove_function_from_trace.pl to work with many threads (patch from Sergei) storage/maria/ma_bitmap.c: Added marker that table had changed since last checkpoint. This ensures that we will flush all bitmap pages from cache at checkpoint. This fixes bug LP#605798 "wrong data in bitmap" after recovery. storage/maria/ma_check.c: Cleaned up error output storage/maria/ma_recovery.c: Cleaned up error output storage/maria/maria_def.h: Added changed_not_flushed |
||
Michael Widenius
|
89e62085c6 |
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 |
||
Michael Widenius
|
53310c6ee7 |
Trivial fixes, more safe DBUG_ASSERT()'s and some more DBUG_
- CTRL-C now aborts 'source' commands in mysql client - Fix that thread id's are removed in convert-debug-for-diff.sh client/mysql.cc: CTRL-C now aborts 'source' commands scripts/convert-debug-for-diff.sh: Fix expression to remove thread id storage/maria/ha_maria.cc: Don't call DBUG_ASSERT() when we kill a query during REPAIR / ALTER TABLE storage/maria/ma_bitmap.c: Added DBUG_ASSERT() if we call _ma_bitmap_set_full_page_bits() storage/maria/ma_key_recover.c: Don't do an assert if table is marked crashed. storage/maria/ma_recovery.c: Added DBUG_ENTER |
||
Michael Widenius
|
6795a545e3 | Trivial optimizations and cleanups | ||
Michael Widenius
|
6bbb0b5739 |
Added option --start-from-checkpoint to maria_read_log
Print out checked file names in maria_check -s (unless you use a second -s) Some trivial optimizations storage/maria/ma_bitmap.c: Trivial optimizations: - Combine common code (to be able to remove duplicate mutex_lock call) - Move setting of thread specific variables outside of mutex storage/maria/ma_check.c: Fixed wrong argument to printf storage/maria/maria_chk.c: Print out checked table names unless -s -s storage/maria/maria_read_log.c: Added option --start-from-checkpoint (to help find bugs in checkpoints) |
||
Michael Widenius
|
e6cf286b5d |
Fixed LP#605798 RQG: Table corruption after Maria engine recovery - "Wrong data in bitmap"
maria_chk & maria_read_log now reads block size from control file. mysql-test/suite/maria/r/maria.result: Updated results after trivial change of maria_chk's output storage/maria/ma_bitmap.c: More DBUG_PRINT storage/maria/ma_blockrec.c: Fixed bug that we didn't mark page full in bitmap if directory is full storage/maria/ma_check.c: Write out if directory is full for errors in bitmap storage/maria/ma_control_file.c: Don't give error for wrong block size if block size is 0 storage/maria/maria_chk.c: Read block size from control file In case of -dvv, write also out bitmap information (good for debugging) storage/maria/maria_read_log.c: Read block size from control file Fixed that maria_read_log works with different page size than TRANSLOG_PAGE_SIZE |
||
Michael Widenius
|
dd5b9fc6cd | Merge with base MySQL-5.1-maria | ||
Michael Widenius
|
7eda7f1337 |
Code cleanup:
- Removed not needed casts - Indentation fixes - Changed some buffer variables to uchar, to be able to remove casts storage/maria/ma_bitmap.c: Removed not needed casts storage/maria/ma_blockrec.c: Removed not needed casts storage/maria/ma_check.c: Removed not needed casts. Changed type of buffers to be able to remove casts storage/maria/ma_create.c: Removed not needed casts storage/maria/ma_delete.c: Removed not needed casts storage/maria/ma_dynrec.c: Removed not needed casts storage/maria/ma_extra.c: Removed not needed casts storage/maria/ma_ft_boolean_search.c: Removed not needed casts storage/maria/ma_ft_nlq_search.c: Removed not needed casts storage/maria/ma_ft_parser.c: Removed not needed casts storage/maria/ma_loghandler.c: Removed not needed casts storage/maria/ma_open.c: Removed not needed casts storage/maria/ma_packrec.c: Removed not needed casts storage/maria/ma_pagecache.c: Removed not needed casts storage/maria/ma_preload.c: Removed not needed casts Removed not needed initialization storage/maria/ma_rnext_same.c: Removed not needed casts storage/maria/ma_rt_index.c: Removed not needed casts storage/maria/ma_search.c: Removed not needed casts storage/maria/ma_sort.c: Removed not needed casts Removed not needed if Fixed indentation storage/maria/ma_statrec.c: Removed not needed casts storage/maria/ma_test2.c: Removed not needed casts storage/maria/ma_write.c: Removed not needed casts Indentation fixes storage/maria/maria_chk.c: Removed not needed casts storage/maria/maria_pack.c: Removed not needed casts |
||
Guilhem Bichot
|
c9a29373e1 |
Fix for BUG#41159 "Maria: deadlock between checkpoint and maria_write() when extending data file".
No testcase (concurrency, tested by pushbuild2). storage/maria/ha_maria.cc: a comment about what Sanja had discovered a while ago storage/maria/ma_bitmap.c: guard against concurrent flush of bitmap by checkpoint: we must have close_lock here storage/maria/ma_blockrec.c: comment fixed for new behaviour storage/maria/ma_checkpoint.c: Release intern_lock before flushing bitmap, or it deadlocks with allocate_and_write_block_record() when that function needs to increase the data file's length (that function makes bitmap non flushable, then wants intern_lock to increase data_file_length). The checkpoint section which looks at the share's content (bitmap, state) needs to be protected from the possible my_free-ing done by a concurrent maria_close(); intern_lock is not enough as both maria_close() and checkpoint now have to release it in the middle. So the protection is done with close_lock. in_checkpoint is now protected by close_lock in places where it was protected by intern_lock. storage/maria/ma_close.c: hold close_lock in maria_close() from start to end, to guard against checkpoint trying to flush bitmap while we have my_free'd its structures, for example. intern_lock was not enough as both maria_close() and checkpoint have to release it in the middle, to avoid deadlocks. storage/maria/ma_open.c: initialize new mutex storage/maria/ma_recovery.c: a comment about what Sanja had discovered a while ago storage/maria/maria_def.h: comment. new mutex protecting the close of a MARIA_SHARE, from _start_ to _end_ of it. |
||
Guilhem Bichot
|
8b87da7fa7 |
Fix for BUG#39363 "Concurent inserts in the same table lead to hang in maria engine"
(need a mutex when modifying bitmap->non_flushable), which I hit when running maria_bulk_insert.yy. After fixing this, I hit an assertion in check_and_set_lsn() saying that the page was PAGECACHE_PLAIN_PAGE. This could be caused by pages left by an operation which had transactions disabled (like a bulk insert with repair): in this patch we remove those pages out of the cache when we re-enable transactions. After fixing this, I get page cache deadlocks, pushbuild2 also has some, to be looked at. No testcase, requires concurrency and running for 15 minutes, but automatically tested by pushbuild2. storage/maria/ma_bitmap.c: Doing bitmap->non_flushable++ without mutex was wrong. If this ++ happened while another ++ or -- was happening in another thread, one ++ or -- could be missed and the bitmap code would behave wrongly. For example, if a ++ was missed, the DBUG_ASSERT(((int) (bitmap->non_flushable)) >= 0) in _ma_bitmap_release_unused() could fire. I saw this assertion happen in practice in maria_bulk_insert.yy. Adding this mutex lock eliminated the assertion problem. The >=0 was wrong, should be >0 (or the variable could go negative). storage/maria/ma_recovery.c: When we re-enable transactionality, as we may have created pages of type PAGECACHE_PLAIN_PAGE before, we need to remove them from the cache (FLUSH_RELEASE). Or they would stay this way, and later when we maria_write() to them, we would try to tag them with a LSN (ma_unpin_all_pages()), which is incorrect for a plain page (and causes assertion in the page cache at start of check_and_set_lsn()). I saw the assertion fire with maria_bulk_insert.yy, and this seems to cure it. page cache |
||
Guilhem Bichot
|
8ecda6cd26 |
_ma_bitmap_unpin_all() needs to unpin not-locked pages which were pinned by other threads
in write_changed_bitmap(), and page cache forbids that. Here we make the page cache more relaxed. Original patch by Sanja, simplified by me as limited to not-locked. See comment of ma_bitmap.c. With that, maria_stress.yy runs until hitting BUG 39665. storage/maria/ma_bitmap.c: A thread which unpins bitmap pages in _ma_bitmap_unpin_all() sometimes hit an assertion in the page cache (info!=0 in remove_pin()) which states that you can unpin/unlock only what *you* have pinned/locked. Fixed by setting the new last parameter of pagecache_unlock_by_link() to TRUE in _ma_bitmap_unpin_all(). storage/maria/ma_blockrec.c: new prototype and splitting assertion in three (3rd one fires: BUG 39665) storage/maria/ma_check.c: new prototype storage/maria/ma_key_recover.c: new prototype storage/maria/ma_loghandler.c: new prototype storage/maria/ma_pagecache.c: Allow a thread to unpin, with pagecache_unlock_by_link(), a non-locked page pinned by others. This is a hack for _ma_bitmap_unpin_all() which needs to unpin pages which were pinned by other threads in write_changed_bitmap(). storage/maria/ma_pagecache.h: new prototype storage/maria/ma_preload.c: new prototype storage/maria/unittest/ma_pagecache_rwconsist.c: new prototype storage/maria/unittest/ma_pagecache_single.c: new prototype |
||
Guilhem Bichot
|
8dc87e3e9b |
WL#4595 "Maria - no write-lock when pinning bitmap pages": turns out that page cache
already supports pin-without-lock so implementation of this WL is instant and done here. This could improve concurrency. No testcase, this requires multiple threads and is automatically tested at push time by maria_stress.yy (pushbuild2). storage/maria/ma_bitmap.c: As the page cache supports pinning without write-locking, we don't take write lock in write_changed_bitmap(), only a pin; this could improve concurrency (WL#4595). |
||
Guilhem Bichot
|
ed567bd2a9 |
Fix for BUG#39210 "Maria deadlock in _ma_bitmap_wait_or_flush". It was a thread
which nobody woke up (see comment of ma_bitmap.c). No testcase, this requires multiple threads and is automatically tested at push time by maria_stress.yy (pushbuild2). storage/maria/ma_bitmap.c: * _ma_bitmap_wait_or_flush() didn't publish that it was waiting for bitmap to not be over-allocated (i.e. didn't modify bitmap->flush_all_requested) so nobody (_ma_bitmap_flushable(), _ma_bitmap_release_unused()) knew it had to wake it up => it stalled (BUG#39210). In fact the wait in _ma_bitmap_wait_or_flush() is not needed, it's ok if this function sends the over-allocated bitmap to page cache and keeps pin on it (_ma_bitmap_unpin_all() will unpin it later, and the one who added _ma_bitmap_wait_or_flush() didn't know it). Function is thus deleted, as _ma_bitmap_flush() can do its job. * After fixing that, test runs longer and BUG 39665 happens, which looks like a separate page cache bug. * Smaller changes: _ma_bitmap_flush_all() called write_changed_bitmap() even though it might not be changed; added some DBUG calls in functions; split assertions. * In _ma_bitmap_release_unused(), it's more logical to test non_flushable_state than now_transactional to know if we have to decrement non_flushable (it's exactly per the definition of non_flushable_state). storage/maria/ma_blockrec.c: _ma_bitmap_wait_or_flush() is not needed. ****** new prototype and splitting assertion in three (3rd one fires: BUG 39665) storage/maria/ma_blockrec.h: _ma_bitmap_wait_or_flush() is not needed. |
||
unknown
|
f094eff1d9 |
Injecting more "const" declarations into code which does not change
pointed data. I ran gcc -Wcast-qual on storage/maria, this identified un-needed casts, a couple of functions which said they had a const parameter though they changed the pointed content! This is fixed here. Some suspicious places receive a comment. The original intention of running -Wcast-qual was to find what code changes R-tree keys: I added const words, but hidden casts like those of int2store (casts target to (uint16*)) removed const checking; -Wcast-qual helped find those hidden casts. Log handler does not change the content pointed by LEX_STRING::str it receives, so we now use a struct which has a const inside, to emphasize this and be able to pass "const uchar*" buffers to log handler without fear of their content being changed by it. One-line fix for a merge glitch (when merging from MyISAM). include/m_string.h: As Maria's log handler uses LEX_STRING but never changes the content pointed by LEX_STRING::str, and assigns uchar* into this member most of the time, we introduce a new struct LEX_CUSTRING (C const U unsigned) for the log handler. include/my_global.h: In macros which read pointed content: use const pointers so that gcc -Wcast-qual does not warn about casting a const pointer to non-const. include/my_handler.h: In macros which read pointed content: use const pointers so that gcc -Wcast-qual does not warn about casting a const pointer to non-const. ha_find_null() does not change *a. include/my_sys.h: insert_dynamic() does not change *element. include/myisampack.h: In macros which read pointed content: use const pointers so that gcc -Wcast-qual does not warn about casting a const pointer to non-const. mysys/array.c: insert_dynamic() does not change *element mysys/my_handler.c: ha_find_null() does not change *a storage/maria/ma_bitmap.c: Log handler receives const strings now storage/maria/ma_blockrec.c: Log handler receives const strings now. _ma_apply_undo_row_delete/update() do change *header. storage/maria/ma_blockrec.h: correct prototype storage/maria/ma_check.c: Log handler receives const strings now. Un-needed casts storage/maria/ma_checkpoint.c: Log handler receives const strings now storage/maria/ma_checksum.c: unneeded cast storage/maria/ma_commit.c: Log handler receives const strings now storage/maria/ma_create.c: Log handler receives const strings now storage/maria/ma_dbug.c: fixing warning of gcc -Wcast-qual storage/maria/ma_delete.c: Log handler receives const strings now storage/maria/ma_delete_all.c: Log handler receives const strings now storage/maria/ma_delete_table.c: Log handler receives const strings now storage/maria/ma_dynrec.c: fixing some warnings of gcc -Wcast-qual. Unneeded casts removed. Comment about function which lies. storage/maria/ma_ft_parser.c: fix for warnings of gcc -Wcast-qual, removing unneeded casts storage/maria/ma_ft_update.c: less casts, comment storage/maria/ma_key.c: less casts, stay const (warnings of gcc -Wcast-qual) storage/maria/ma_key_recover.c: Log handler receives const strings now storage/maria/ma_loghandler.c: Log handler receives const strings now storage/maria/ma_loghandler.h: Log handler receives const strings now storage/maria/ma_loghandler_lsn.h: In macros which read pointed content: use const pointers so that gcc -Wcast-qual does not warn about casting a const pointer to non-const. storage/maria/ma_page.c: Log handler receives const strings now; more const storage/maria/ma_recovery.c: Log handler receives const strings now storage/maria/ma_rename.c: Log handler receives const strings now storage/maria/ma_rt_index.c: more const, to emphasize that functions don't change pointed content. best_key= NULL was forgotten during merge from MyISAM a few days ago, was causing a Valgrind warning storage/maria/ma_rt_index.h: new proto storage/maria/ma_rt_key.c: more const storage/maria/ma_rt_key.h: new proto storage/maria/ma_rt_mbr.c: more const for functions which deserve it storage/maria/ma_rt_mbr.h: new prototype storage/maria/ma_rt_split.c: make const what is not changed. storage/maria/ma_search.c: un-needed casts, more const storage/maria/ma_sp_key.c: more const storage/maria/ma_unique.c: un-needed casts. storage/maria/ma_write.c: Log handler receives const strings now storage/maria/maria_def.h: some more const storage/maria/unittest/ma_test_loghandler-t.c: Log handler receives const strings now storage/maria/unittest/ma_test_loghandler_first_lsn-t.c: Log handler receives const strings now storage/maria/unittest/ma_test_loghandler_max_lsn-t.c: Log handler receives const strings now storage/maria/unittest/ma_test_loghandler_multigroup-t.c: Log handler receives const strings now storage/maria/unittest/ma_test_loghandler_multithread-t.c: Log handler receives const strings now storage/maria/unittest/ma_test_loghandler_noflush-t.c: Log handler receives const strings now storage/maria/unittest/ma_test_loghandler_nologs-t.c: Log handler receives const strings now storage/maria/unittest/ma_test_loghandler_pagecache-t.c: Log handler receives const strings now storage/maria/unittest/ma_test_loghandler_purge-t.c: Log handler receives const strings now |
||
unknown
|
311d8e898f |
Mac compiler warnings fixed.
include/maria.h: mac compiler warnings fixed. storage/maria/ma_bitmap.c: mac compiler warnings fixed. storage/maria/ma_blockrec.c: mac compiler warnings fixed. storage/maria/ma_check.c: mac compiler warnings fixed. storage/maria/ma_control_file.c: mac compiler warnings fixed. storage/maria/ma_create.c: mac compiler warnings fixed. storage/maria/ma_delete.c: mac compiler warnings fixed. storage/maria/ma_ft_boolean_search.c: mac compiler warnings fixed. storage/maria/ma_page.c: mac compiler warnings fixed. storage/maria/ma_pagecache.c: mac compiler warnings fixed. storage/maria/ma_recovery.c: mac compiler warning fixed. storage/maria/ma_rt_test.c: mac compiler warnings fixed. storage/maria/ma_search.c: mac compiler warning fixed. storage/maria/ma_write.c: mac compiler warnings fixed. storage/maria/unittest/ma_control_file-t.c: mac compiler warnings fixed. storage/maria/unittest/ma_pagecache_consist.c: mac compiler warnings fixed. storage/maria/unittest/ma_pagecache_single.c: mac compiler warnings fixed. storage/maria/unittest/ma_test_loghandler_pagecache-t.c: mac compiler warning fixed. storage/maria/unittest/test_file.c: mac compiler warning fixed. |
||
unknown
|
0825c48549 |
- fix for segfault in rpl_trigger/rpl_found_rows with default engine=maria
(fix is keeping the real TRN through a disable_logging/reenable cycle) - fix for pagecache assertion failure in ps/type_ranges with default engine=maria (fix is in sql_insert.cc) - when reenabling logging we must either flush all dirty pages, or at least verify (in debug build) that there are none. For example a bulk insert with single UNDO_BULK_INSERT must flush them, no matter if it uses repair or not (bugfix) - UNDO_BULK_INSERT_WITH_REPAIR is also used with repair, changes name mysql-test/r/maria.result: tests for bugs fixed mysql-test/t/maria.test: tests for bugs fixed sql/sql_insert.cc: Bugfix: even if select_create::prepare() failed to create the 'table' object we still have to re-enable logging. storage/maria/ha_maria.cc: Bugfix: when a transactional table does a bulk insert without repair, it still sometimes skips logging of REDOs thus needs a full flush and sync at the end. Not if repair is done, as repair does it internally already (see end of maria_repair*()). storage/maria/ha_maria.h: variable now can have 3 states not 2 storage/maria/ma_bitmap.c: name change storage/maria/ma_blockrec.c: name change storage/maria/ma_blockrec.h: name change storage/maria/ma_check.c: * When maria_repair() re-enables logging it does not need to ask for a flush&sync as it did it by itself already a few lines before. * the log record of bulk insert can be used even without repair * disable logging in maria_zerofill(): without that, it puts LSN pages in the cache, so when it flushes them it flushes the log; the change makes auto-ha_maria::zerofill-if-moved faster (no log flush). storage/maria/ma_key_recover.c: name change storage/maria/ma_loghandler.c: name change storage/maria/ma_loghandler.h: name change storage/maria/ma_pagecache.c: A function, to check in debug builds that no dirty pages exist for a file. storage/maria/ma_pagecache.h: new function (nothing in non-debug) storage/maria/ma_recovery.c: _ma_tmp_disable_logging() sets info->trn to dummy_transaction_object when needed now. The changes done here about info->trn are to allow a table to retain its original, real TRN through a disable/reenable cycle (see replication scenario in _ma_reenable_logging_for_table()). When we reenable, we offer the caller to flush and sync the table; if the caller doesn't accept our offer, we verify that it's ok (no REDOs => no dirty pages are allowed to exist). storage/maria/maria_chk.c: comment storage/maria/maria_def.h: new names mysql-test/suite/rpl/r/rpl_stm_maria.result: result (it used to crash) mysql-test/suite/rpl/t/rpl_stm_maria.test: Test of replication-specific Maria bug fixed |
||
unknown
|
cd15ea74f7 |
- fix for bug when creating bitmaps
- fix for bug seen when running test "type_datetime" with Maria (wrong data_file_length in maria_repair()) - fix for bug seen when running test "repair" with Maria (myisam_sort_buffer_size was influencing Maria) sql/handler.cc: Sounds illogical to store myisam_sort_buffer_size into a structure used by all engines. There are only MyISAM and Maria which used sort_buffer_size: they can get their value from their respective system variable (myisam|maria_sort_buffer_size). Using MyISAM's value for all engines was wrong (myisam_sort_buffer_size influenced Maria). sql/handler.h: not needed storage/maria/ha_maria.cc: check_opt->sort_buffer_size was myisam_sort_buffer_size; Maria must use maria_sort_buffer_size instead. storage/maria/ma_bitmap.c: don't use my_chsize() now that Monty re-explained the problem to me :) storage/maria/ma_check.c: making maria_repair() work like maria_repair_by_sort(): sort_param.filepos must be set at start then possibly corrected by create_new_data_handle(); in the opposite order, filepos is finally set to 0, and if the table has no records, it stays 0 and this causes state.data_file_length to be 0 which is incorrect for a BLOCK_RECORD table having always at least one bitmap page. storage/maria/ma_pagecache.c: Comments storage/myisam/ha_myisam.cc: check_opt->sort_buffer_size is gone |
||
unknown
|
534417c285 |
WL#3072 - Maria Recovery
Bulk insert: don't log REDO/UNDO for rows, log one UNDO which will truncate files; this is an optimization and a bugfix (table was left half-repaired by crash). Repair: mark table crashed-on-repair at start, bump skip_redo_lsn at start, this is easier for recovery (tells it to skip old REDOs or even UNDO phase) and user (tells it to repair) in case of crash, sync files in the end. Recovery skips missing or corrupted table and moves to next record (in REDO or UNDO phase) to be more robust; warns if happens in UNDO phase. Bugfix for UNDO_KEY_DELETE_WITH_ROOT (tested in ma_test_recovery) and maria_enable_indexes(). Create missing bitmaps when needed (there can be more than one to create, in rare cases), log a record for this. include/myisamchk.h: new flag: bulk insert repair mustn't bump create_rename_lsn mysql-test/lib/mtr_report.pl: skip normal warning in maria-recovery.test mysql-test/r/maria-recovery.result: result: crash before bulk insert is committed, causes proper rollback, and crash right after OPTIMIZE replaces index file with new index file leads to table marked corrupted and recovery not failing. mysql-test/t/maria-recovery.test: - can't check the table or it would commit the transaction, but check is made after recovery. - test of crash before bulk-insert-with-repair is committed (to see if it is rolled back), and of crash after OPTIMIZE has replaced index file but not finished all operations (to see if recovery fails - it used to assert when trying to execute an old REDO on the new index). storage/maria/CMakeLists.txt: new file storage/maria/Makefile.am: new file storage/maria/ha_maria.cc: - If bulk insert on a transactional table using an index repair: table is initially empty, so don't log REDO/UNDO for data rows (optimization), just log an UNDO_BULK_INSERT_WITH_REPAIR which will, if executed, empty the data and index file. Re-enable logging in end_bulk_insert(). - write log record for repair operation only after it's fully done, index sort including (maria_repair*() used to write the log record). - Adding back file->trn=NULL which was removed by mistake earlier. storage/maria/ha_maria.h: new member (see ha_maria.cc) storage/maria/ma_bitmap.c: Functions to create missing bitmaps: - one function which creates missing bitmaps in page cache, except the missing one with max offset which it does not put into page cache as it will be modified very soon. - one function which the one above calls, and creates bitmaps in page cache - one function to execute REDO_BITMAP_NEW_PAGE which uses the second one above. storage/maria/ma_blockrec.c: - when logging REDO_DELETE_ALL, not only 'records' and 'checksum' has to be reset under log's mutex. - execution of REDO_INSERT_ROW_BLOBS now checks the dirty pages' list - execution of UNDO_BULK_INSERT_WITH_REPAIR storage/maria/ma_blockrec.h: new functions storage/maria/ma_check.c: - table-flush-before-repair is moved to a separate function reused by maria_sort_index(); syncing is added - maria_repair() is allowed to re-enable logging only if it is the one which disabled it. - "_ma_flush_table_files_after_repair" was a bad name, it's not after repair now, and it should not sync as we do more changes to the files shortly after (sync is postponed to when writing the log record) - REDO_REPAIR record should be written only after all repair operations (in particular after sorting index in ha_mara::repair()) - close to the end of repair by sort, flushing of pages must happen also in the non-quick case, to prepare for the sync at end. - in parallel repair, some page flushes are not needed as done by initialize_variables_for_repair(). storage/maria/ma_create.c: Update skip_redo_lsn, create_rename_lsn optionally. storage/maria/ma_delete_all.c: Need to sync files at end of maria_delete_all_rows(), if transactional. storage/maria/ma_extra.c: During repair, we sometimes call _ma_flush_table_files() (via _ma_flush_table_files_before_swap()) while there is a WRITE_CACHE. storage/maria/ma_key_recover.c: - when we see CLR_END for UNDO_BULK_INSERT_WITH_REPAIR, re-enable indices. - fixing bug: _ma_apply_undo_key_delete() parsed UNDO_KEY_DELETE_WITH_ROOT wrongly, leading to recovery failure storage/maria/ma_key_recover.h: new prototype storage/maria/ma_locking.c: DBUG_VOID_RETURN missing storage/maria/ma_loghandler.c: UNDO for bulk insert with repair, and REDO for creating bitmaps. LOGREC_FIRST_FREE to not have to change the for() every time we add a new record type. storage/maria/ma_loghandler.h: new UNDO and REDO storage/maria/ma_open.c: Move share.kfile.file=kfile up a bit, so that _ma_update_state_lsns() can get its value, this fixes a bug where LSN_REPAIRED_BY_MARIA_CHK was not corrected on disk by maria_open(). Store skip_redo_lsn in index' header. maria_enable_indexes() had a bug for BLOCK_RECORD, where an empty file has one page, not 0 bytes. storage/maria/ma_recovery.c: - Skip a corrupted, missing, or repaired-with-maria_chk, table in recovery: don't fail, just go to next REDO or UNDO; but if an UNDO is skipped in UNDO phase we issue warnings. - Skip REDO|UNDO in REDO phase if <skip_redo_lsn. - If UNDO phase fails, delete transactions to not make trnman assert. - Update skip_redo_lsn when playing REDO_CREATE_TABLE - Don't record UNDOs for old transactions which we don't know (long_trid==0) - Bugfix for UNDO_KEY_DELETE_WITH_ROOT (see ma_key_recover.c) - Execution of UNDO_BULK_INSERT_WITH_REPAIR - Don't try to find a page number in REDO_DELETE_ALL - Pieces moved to ma_recovery_util.c storage/maria/ma_rename.c: name change storage/maria/ma_static.c: I modified layout of the index' header (inserted skip_redo_lsn in its middle) storage/maria/ma_test2.c: allow breaking the test towards the end, tests execution of UNDO_KEY_DELETE_WITH_ROOT storage/maria/ma_test_recovery.expected: 6 as testflag instead of 4 storage/maria/ma_test_recovery: Increase the amount of rollback work to do when testing recovery with ma_test2; this reproduces the UNDO_KEY_DELETE_WITH_ROOT bug. storage/maria/maria_chk.c: skip_redo_lsn should be updated too, for consistency. Write a REDO_REPAIR after all operations (including sort-records) have been done. No reason to flush blocks after maria_chk_data_link() and maria_sort_records(), there is maria_close() in the end. write_log_record() is a function, to not clutter maria_chk(). storage/maria/maria_def.h: New member skip_redo_lsn in the state, and comments storage/maria/maria_pack.c: skip_redo_lsn should be updated too, for consistency storage/maria/ma_recovery_util.c: _ma_redo_not_needed_for_page(), defined in ma_recovery.c, is needed by ma_blockrec.c; this causes link issues, resolved by putting _ma_redo_not_needed_for_page() into a new file (so that it is not in the same file as repair-related objects of ma_recovery.c). storage/maria/ma_recovery_util.h: new file |
||
unknown
|
89ff50d429 |
Fixed compiler warnings
Fixed type that caused windows builds to fail include/my_alloc.h: Use size_t for memory areas instead of uint mysys/mf_iocache.c: Fixed compiler warnings by adding casts mysys/my_compress.c: Fixed compiler warnings by adding casts mysys/my_getsystime.c: Fixed typo mysys/my_static.h: Use size_t for memory areas mysys/safemalloc.c: Use size_t for memory areas storage/maria/ma_bitmap.c: Fixed compiler warnings by adding casts storage/maria/ma_blockrec.c: Fixed compiler warnings by adding casts storage/maria/ma_cache.c: Use size_t for memory areas storage/maria/ma_info.c: Use size_t for memory areas storage/maria/ma_key.c: Fixed compiler warnings by adding casts storage/maria/ma_locking.c: Fixed compiler warnings by adding casts storage/maria/ma_open.c: Fixed compiler warnings by adding casts storage/maria/ma_packrec.c: Fixed compiler warnings by fixing type for variable storage/maria/ma_statrec.c: Fixed compiler warnings by adding casts storage/maria/ma_write.c: Fixed compiler warnings by adding casts storage/maria/maria_def.h: Use size_t for memory areas storage/myisam/mi_search.c: Fixed compiler warnings by adding casts |
||
unknown
|
266fde77b2 |
Added --loose-skip-maria to MYSQLD_BOOTSTRAP_CMD to get bootstrap.test to work
Allow one to run bootstrap even if --skip-maria is used (needed for bootstrap.test) Fixed lots of compiler warnings NOTE: maria-big and maria-recover tests failes becasue of bugs in transaction log handling. Sanja knows about this and is working on it! mysql-test/mysql-test-run.pl: Added --loose-skip-maria to MYSQLD_BOOTSTRAP_CMD to get bootstrap.test to work mysql-test/r/maria-recovery.result: Updated results mysql-test/t/bootstrap.test: Removed not needed empty line mysql-test/t/change_user.test: Fixed results for 32 bit systems mysql-test/t/maria-big.test: Only run this when you use --big mysql-test/t/maria-recovery.test: Added test case for recovery with big blobs mysys/my_uuid.c: Fixed compiler warning sql/mysqld.cc: Allow one to run bootstrap even if --skip-maria is used (needed for bootstrap.test) sql/set_var.cc: Compare max_join_size with ULONG_MAX instead of HA_POS_ERROR as we set max_join_size to ULONG_MAX by default storage/maria/ma_bitmap.c: Added __attribute((unused)) to fix compiler warning storage/maria/ma_blockrec.c: Added casts to remove compiler warnings Change variable types to avoid compiler warnings storage/maria/ma_check.c: Added casts to remove compiler warnings storage/maria/ma_checkpoint.c: Change variable types to avoid compiler warnings storage/maria/ma_create.c: Change variable types to avoid compiler warnings storage/maria/ma_delete.c: Added casts to remove compiler warnings storage/maria/ma_key_recover.c: Added casts to remove compiler warnings storage/maria/ma_loghandler.c: Moved initiazation of prev_buffer first as this could otherwise not be set in case of errors storage/maria/ma_page.c: Added casts to remove compiler warnings storage/maria/ma_pagecache.c: Added __attribute((unused)) to fix compiler warning storage/maria/ma_pagecrc.c: Added #ifndef DBUG_OFF to remove compiler warning storage/maria/ma_recovery.c: Added casts to remove compiler warnings storage/maria/ma_write.c: Added casts to remove compiler warnings storage/maria/maria_chk.c: Split long string into two to avoid compiler warnings storage/myisam/ft_boolean_search.c: Added LINT_INIT() to remove compiler warning support-files/compiler_warnings.supp: Suppress wrong compiler warning unittest/mytap/tap.c: Fixed declaration to match prototypes to remove compiler warnings |
||
unknown
|
5ad477f6cb |
Added --with-maria-tmp-tables (default one) to allow on to configure if Maria should be used for internal temporary tables
Abort mysqld if Maria engine didn't start and we are using Maria for temporary tables Fixed bug that caused update of big blobs to crash Use pagecache_page_no_t as type for pages (to get rid of compiler warnings) Added cast to get rid of compiler warning Fixed wrong types of variables and arguments that caused lost information Fixed wrong DBUG_ASSERT() that caused REDO of big blobs to fail Removed some historical ifdefs that caused problem with windows compilations BUILD/SETUP.sh: Added --with-maria-tmp-tables include/maria.h: Use pagecache_page_no_t as type for pages Use my_bool as parameter for 'rep_quick' option include/my_base.h: Added comment mysql-test/r/maria-big.result: Added test that uses big blobs mysql-test/t/maria-big.test: Added test that uses big blobs sql/mysqld.cc: Abort mysqld if Maria engine didn't start and we are using Maria for temporary tables sql/sql_class.h: Don't use Maria for temporary tables if --with-maria-tmp-tables is not defined sql/sql_select.cc: Don't use Maria for temporary tables if --with-maria-tmp-tables is not defined storage/maria/ha_maria.cc: Fixed compiler warnings reported by MCC - Fixed usage of wrong types that caused data loss - Changed parameter for rep_quick to my_bool - Added safe casts Fixed indentation storage/maria/ma_bitmap.c: Use pagecache_page_no_t as type for pages Fixed compiler warnings Fixed bug that caused update of big blobs to crash storage/maria/ma_blockrec.c: Use pagecache_page_no_t as type for pages Use my_bool as parameter for 'rep_quick' option Fixed compiler warnings Fixed wrong DBUG_ASSERT() storage/maria/ma_blockrec.h: Use pagecache_page_no_t as type for pages storage/maria/ma_check.c: Fixed some wrong parameters where we didn't get all bits for test_flag Changed rep_quick to be of type my_bool Use pagecache_page_no_t as type for pages Added cast's to get rid of compiler warnings Changed type of record_pos to get rid of compiler warning storage/maria/ma_create.c: Added safe cast's to get rid of compiler warnings storage/maria/ma_dynrec.c: Fixed usage of wrong type storage/maria/ma_key.c: Fixed compiler warning storage/maria/ma_key_recover.c: Use pagecache_page_no_t as type for pages storage/maria/ma_loghandler_lsn.h: Added cast's to get rid of compiler warnings storage/maria/ma_page.c: Changed variable name from 'page' to 'pos' as it was an offset and not a page address Moved page_size inside block to get rid of compiler warning storage/maria/ma_pagecache.c: Fixed compiler warnings Replaced compile time assert with TODO storage/maria/ma_pagecache.h: Use pagecache_page_no_t as type for pages storage/maria/ma_pagecrc.c: Allow bitmap pages that is all zero storage/maria/ma_preload.c: Added cast to get rid of compiler warning storage/maria/ma_recovery.c: Changed types to get rid of compiler warnings Use bool for quick_repair to get rid of compiler warning Fixed some variables that was wrongly declared (not enough precission) Added cast to get rid of compiler warning storage/maria/ma_test2.c: Remove historical undefs storage/maria/maria_chk.c: Changed rep_quick to bool Fixed wrong parameter to maria_chk_data_link() storage/maria/maria_def.h: Use pagecache_page_no_t as type for pages storage/maria/maria_pack.c: Renamed isam -> maria storage/maria/plug.in: Added option --with-maria-tmp-tables storage/maria/trnman.c: Added cast to get rid of compiler warning storage/myisam/mi_test2.c: Remove historical undefs |
||
unknown
|
b5df1d3446 |
Bugs fixed:
- If not in autocommit mode, delete rows one by one so that we can roll back if necessary - bitmap->used_size was not correctly set, which caused bitmap pages to be overwritten - Fixed bug in bitmap handling when allocation tail pages - Ensure we reserve place for directory entry when calculation place for head and tail pages - Fixed wrong value in bitmap->size[0] - Fixed wrong assert in flush_log_for_bitmap - Fixed bug in _ma_bitmap_release_unused() where tail blocks could be wrongly reset - Mark new pages as changed (Required to get repair() to work) - Fixed problem with advancing log horizon pointer within one page bounds - Fixed DBUG_ASSERT() when enable_indexes failes for end_bulk_insert() - Fixed bug in logging of rows with more than one big blob - Fixed DBUG_ASSERTS() in pagecache to allow change of WRITE_LOCK to READ_LOCK in unlock() calls - Flush pagecache when we change from logging to not logging (if not, pagecache code breaks) - Ensure my_errno is set on return from write/delete/update - Fixed bug when using FIELD_SKIP_PRESPACE New features: - mysql_fix_privilege_tables now first uses binaries and scripts from source distribution, then in installed distribution - Fix that optimize works for Maria tables - maria_check --zerofill now also clear freed blob pages - maria_check -di now prints more information about record page utilization Optimizations: - Use pagecache_unlock_by_link() instead of pagecache_write() if possible. (Avoids a memory copy and a find_block) - Simplify code to abort when we found optimal bit pattern - Skip also full head page bit patterns when searching for tail - Increase default repair buffer to 128M for maria_chk and maria_read_log - Increase default sort buffer for maria_chk to 64M - Increase size of sortbuffer and pagecache for mysqld to 64M - VARCHAR/CHAR fields are stored in increasing length order for BLOCK_RECORD tables Better reporting: - Fixed test of error condition for flush (for better error code) - More error messages to mysqld if Maria recovery fails - Always print warning if rows are deleted in repair - Added global function _db_force_flush() that is usable when doing debugging in gdb - Added call to my_debug_put_break_here() in case of some errors (for debugging) - Remove used testfiles in unittest as these was written in different directories depending on from where the test was started This should fix the bugs found when importing a big table with many varchars and one/many blobs to Maria dbug/dbug.c: Added global function _db_force_flush() that is usable when doing debugging in gdbine extra/replace.c: Fixed memory leak include/my_dbug.h: Prototype for _db_force_flush() include/my_global.h: Added stdarg.h as my_sys.h now depends on it. include/my_sys.h: Make my_dbug_put_break_here() a NOP if not DBUG build Added my_printv_error() include/myisamchk.h: Added entry 'lost' to be able to count space that is lost forever mysql-test/r/maria.result: Updated results mysql-test/t/maria.test: Reset autocommit after test New test to check if delete_all_rows is used (verified with --debug) mysys/my_error.c: Added my_printv_error() scripts/mysql_fix_privilege_tables.sh: First use binaries and scripts from source distribution, then in installed distribution This ensures that a development branch doesn't pick up wrong scripts) sql/mysqld.cc: Fix that one can break maria recovery with ^C when debugging sql/sql_class.cc: Removed #ifdef that has no effect (The preceeding DBUG_ASSERT() ensures that the following code will not be exectued) storage/maria/ha_maria.cc: Increase size of sortbuffer and pagecache to 64M Fix that optimize works for Maria tables Fixed DBUG_ASSERT() when enable_indexes failes for end_bulk_insert() If not in autocommit mode, delete rows one by one so that we can roll back if necessary Fixed variable comments storage/maria/ma_bitmap.c: More ASSERTS to detect overwrite of bitmap pages bitmap->used_size was not correctly set, which caused bitmap pages to be overwritten Ensure we reserve place for directory entry when calculation place for head and tail pages bitmap->size[0] should not include space for directory entry Simplify code to abort when we found optimal bit pattern Skip also full head page bit patterns when searching for tail (should speed up some common cases) Fixed bug in allocate_tail() when block->used was not aligned on 6 bytes Fixed wrong assert in flush_log_for_bitmap Fixed bug in _ma_bitmap_release_unused() where tail blocks could be wrongly reset storage/maria/ma_blockrec.c: Ensure my_errno is set on return Fixed not optimal setting of row->min_length if we don't have variable length fields Use pagecache_unlock_by_link() instead of pagecache_write() if possible. (Avoids a memory copy and a find_block) Added DBUG_ASSERT() if we read or write wrong VARCHAR data Added DBUG_ASSERT() to find out if row sizes are calculated wrong Fixed bug in logging of rows with more than one big blob storage/maria/ma_check.c: Disable logging while normal repair is done to avoid logging of index changes Fixed bug that caused CHECKSUM part of key page to be used Fixed that deleted of wrong records also works for BLOCK_RECORD Clear unallocated pages: - BLOB pages are not automaticly cleared on delete, so we need to use the bitmap to know if page is used or not Better error reporting More information about record page utilization Change printing of file position to printing of pages to make output more readable Always print warning if rows are deleted storage/maria/ma_create.c: Calculate share.base_max_pack_length more accurately for BLOCK_RECORD pages (for future) Fixed that FIELD_SKIP_PRESPACE is recorded as FIELD_NORMAL; Fixed bug where fields could be used in wrong order Store FIELD_SKIP_ZERO fields before CHAR and VARCHAR fields (optimization) Store other fields in length order (to get better utilization of head block) storage/maria/ma_delete.c: Ensure my_errno is set on return storage/maria/ma_dynrec.c: Indentation fix storage/maria/ma_locking.c: Set changed if open_count is counted down. (To avoid getting error "client is using or hasn't closed the table properly" with transactional tables storage/maria/ma_loghandler.c: Fixed problem with advancing log horizon pointer within one page bounds (Patch from Sanja) Added more DBUG Indentation fixes storage/maria/ma_open.c: Removed wrong casts storage/maria/ma_page.c: Fixed usage of PAGECACHE_LOCK_WRITE_UNLOCK with _ma_new() Mark new pages as changed (Required to get repair() to work) storage/maria/ma_pagecache.c: Fixed test of error condition for flush Fixed problem when using PAGECACHE_LOCK_WRITE_TO_READ with unlock() Added call to my_debug_put_break_here() in case of errors (for debugging) storage/maria/ma_pagecrc.c: Ensure we get same crc for 32 and 64 bit systems by forcing argument to maria_page_crc to uint32 storage/maria/ma_recovery.c: Call my_printv_error() from eprint() to get critical errors to mysqld log Removed \n from error strings to eprint() to get nicer output in mysqld Added simple test in _ma_reenable_logging_for_table() to not do any work if not needed storage/maria/ma_update.c: Ensure my_errno is set on return storage/maria/ma_write.c: Ensure my_errno is set on return storage/maria/maria_chk.c: Use DEBUGGER_OFF if --debug is not use (to get slightly faster execution for debug binaries) Added option --skip-safemalloc Don't write exponents for rec/key storage/maria/maria_def.h: Increase default repair buffer to 128M for maria_chk and maria_read_log Increase default sort buffer for maria_chk to 64M storage/maria/unittest/Makefile.am: Don't update files automaticly from bitkeeper storage/maria/unittest/ma_pagecache_consist.c: Remove testfile at end storage/maria/unittest/ma_pagecache_single.c: Remove testfile at end storage/maria/unittest/ma_test_all-t: More tests Safer checking if test caused error |
||
unknown
|
f8b3e118ba |
Disable logging of index pages during repair
Fixed failure in unittest/ma_test_loghandler_pagecache-t Initialize pagecache callbacks explictily, not with pagecache_init(). This is to make things more readable and for the future to make more choices with callbacks storage/maria/ha_maria.cc: Disable logging of index pages during repair storage/maria/ma_bitmap.c: Initialize callbacks explictily, not with pagecache_init(), to make things more readable and for future to have more choices with callbacks Use new interface to flush logs from pagecache storage/maria/ma_check.c: Fixed test for wrong keyblocks Use default functions to setup callbacks for pagecache storage/maria/ma_loghandler.c: Use dummy functions for log flush callback (NULL doesn't work anymore) storage/maria/ma_open.c: Initialize callbacks explictily, not with pagecache_init(), to make things more readable and for future to have more choices with callbacks Prefix external functions with _ma_ storage/maria/ma_pagecache.c: Use new simpler interface to flush logs if needed storage/maria/ma_pagecache.h: Changed interface to a faster, simpler one to flush logs. Now we have a function that takes care of flushing logs, instead of a function to get lsn address storage/maria/ma_pagecrc.c: Add functions for flushing logs storage/maria/ma_recovery.c: Rename functions storage/maria/maria_chk.c: Use default functions to setup callbacks for pagecache storage/maria/maria_def.h: Prefixd global functions with _ma_ storage/maria/unittest/ma_pagecache_consist.c: Use dummy functions for log flush callback (NULL doesn't work anymore) storage/maria/unittest/ma_pagecache_single.c: Use dummy functions for log flush callback (NULL doesn't work anymore) storage/maria/unittest/ma_test_loghandler_pagecache-t.c: Use maria_flush_log_for_page to flush log pages. Fixes failure in unittest |
||
unknown
|
98aad88f4d |
after-merge fixes and comments
mysql-test/include/maria_empty_logs.inc: At one moment in maria-recovery.test the first log has number 2, because log 1 was manually deleted. mysql-test/r/maria-recovery.result: after-merge fix mysql-test/t/maria-recovery.test: after-merge fix storage/maria/ma_bitmap.c: after-merge fix. The todo is implemented now. storage/maria/ma_blockrec.c: comment storage/maria/ma_open.c: after-merge fix. Set write_fail also for index file or a write error would crash. storage/maria/ma_pagecache.c: comment storage/maria/ma_pagecache.h: I prefer to use NULL for 'no callback' instead of a dummy callback in the special case of get_log_address; indeed for non-transactional tables it uses an if(), while if using a dummy callback, it would use a function call plus an if() (the dummy callback would need to return a magic value to say "don't flush" and that value would be tested in if()). storage/maria/unittest/ma_test_all-t: fix if running from outside storage/maria |
||
unknown
|
4902e80471 | merge | ||
unknown
|
1e9ee8abbd |
Merge bk-internal.mysql.com:/home/bk/mysql-maria
into mysql.com:/home/my/mysql-maria dbug/dbug.c: Auto merged include/my_dbug.h: Auto merged include/my_global.h: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/r/maria-recovery.result: Auto merged mysql-test/t/maria-recovery.test: Auto merged mysql-test/t/maria.test: Auto merged sql/mysqld.cc: Auto merged sql/sql_show.cc: Auto merged storage/maria/Makefile.am: Auto merged storage/maria/ha_maria.cc: Auto merged storage/maria/ma_bitmap.c: Auto merged storage/maria/ma_check.c: Auto merged storage/maria/ma_key_recover.c: Auto merged storage/maria/ma_loghandler.c: Auto merged storage/maria/ma_open.c: Auto merged storage/maria/ma_recovery.c: Auto merged storage/maria/maria_chk.c: Auto merged storage/maria/maria_def.h: Auto merged storage/maria/ma_test_all.sh: Use remote version mysql-test/r/maria.result: Trivial merge storage/maria/ma_pagecache.c: Trivial merge |
||
unknown
|
bfd5c273c4 |
UNDO of rows now puts back all part of the row on their original pages and positions
Added variable _dbug_on_ to speed up execution when DBUG is not going to be used Added --debug-on option to mysqld (to be able to turn of DBUG with --debug-on=0) Fixed some bugs with 'non_flushable' marking of bitmap pages Don't use 'non_flushable' marking of bitmap pages for not transactional tables SHOW CREATE TABLE now shows if table was created with page checksums Fixed a lot of bugs with BLOB handling in case of update/REDO and UNDO More tests (especially for blobs) and DBUG_ASSERTS() More readable output from maria_read_log and maria_chk Fixed wrong shift that caused Maria to crash on files > 4G Mark tables as crashed of REDO fails dbug/dbug.c: Changed to use my_bool (allowed me to remove some windows specific code) Added variable _dbug_on_ to speed up execution when DBUG is not going to be used Removed initialization of variables if not needed include/my_dbug.h: Use my_bool for some functions that was defined as BOOLEAN in dbug.c code Added DBUGGER_ON/DEBUGGER_OFF to speed up execution when DBUG is not used include/my_global.h: Define my_bool early Increase MY_HOW_OFTEN_TO_WRITE as computers are now faster than 10 years ago mysql-test/mysql-test-run.pl: Added debug-on=0 to speed up tests mysql-test/r/maria-recovery.result: Added new test by Guilhem to test if UNDO_ROW_DELETE preserves rowid mysql-test/r/maria.result: Added testing of page checksums mysql-test/t/crash_commit_before-master.opt: Added --debug-on as test require DBUG to work mysql-test/t/maria-recovery-bitmap-master.opt: Added --debug-on as test require DBUG to work mysql-test/t/maria-recovery-master.opt: Added --debug-on as test require DBUG to work mysql-test/t/maria-recovery.test: Added new test by Guilhem to test if UNDO_ROW_DELETE preserves rowid mysql-test/t/maria.test: Added testing of page checksums sql/mysqld.cc: Added --debug-on option (to be able to turn of DBUG with --debug-on=0) Indentation fixes Removed end spaces sql/sql_show.cc: Allow update_create_info() to inform MySQL if PACK_KEYS, NO_PACK_KEYS, CHECKSUM, PAGE_CHECKSUM or DELAY_KEY_WRITE is used storage/maria/Makefile.am: Added ma_test_big.sh storage/maria/ha_maria.cc: Store in create_info if page checksums are used (For SHOW CREATE TABLE) storage/maria/ma_bitmap.c: Added _ma_bitmap_wait_or_flush() to cause reader of bitmap pages to wait with reading until bitmap is flushed. Use TAIL_PAGE_COUNT_MARKER for tail pages Set 'sub_blocks' for and only for the head page or for the first extent of a blob. This is needed for store_extent_info() to be able to set START_EXTENT_BIT's Don't allocate more than 0x3ffff pages in one extent (We need bit 0x4000 as a START_EXTENT_BIT) Increase the calculated 'head_length' with the number of bytes used for extents. Update row->space_on_head_page also in _ma_bitmap_find_new_place() Make _ma_bitmap_get_page_bits() global. (Needed for UNDO handling) Changed _ma_bitmap_flushable() to take MARIA_HA instead of MARIA_SHARE. This was needed to be able to mark the handler if we had a 'non_flushable' call pending or not. Don't use 'non_flushable' marking of bitmap pages for not transactional tables. Added BLOCKUSED_USE_ORG_BITMAP handling also for tail pages. Added more DBUG_ASSERT() to find possible errors in other code Some code simplications by adding new local variables storage/maria/ma_blockrec.c: UNDO of rows now puts back all part of the row on their original pages and positions. Changed UNDO of DELETE and UNDO of UPDATE to contain information about the original length of data on head block and also extent information This changes a lot of logic as now an insert of a row on a page may happen to any position (and not just to the first or next free) Use PAGE_COUNT to mark if an extent is the start of of a blob. (Needed for extent_to_bitmap_blocks()) Added check_directory() for checking that directroy entries are correct. Added checking of row checksums when reading rows (with EXTRA_DEBUG) Added make_space_for_directory() and extend_directory() for doing expansion of directory Added get_rowpos_in_head_or_tail_page() to be able to store head/tail on original position in UNDO Added extent_to_bitmap_blocks() to be able to generate original bitmap blocks from UNDO entry Added _ma_update_at_original_place() for UNDO of DELETES Added row->min_length to hold minmum required space needed on head page Changed find_free_position() to use make_space_for_directory() Changed make_empty_page() to allow optional creation of directory entry Changed delete_head_or_tail() and _ma_apply_undo_row_isnert() to not copy pagecache block (speed optimization) Changed _ma_apply_redo_insert_row_head_or_tail() to be able to insert new row at any position on 'new' page Changed _ma_apply_undo_row_delete() and _ma_apply_undo_row_update() to put row in it's original position Ensure allocation of tail blocks are of at least MIN_TAIL_SIZE. Ensure we store pages in pinned pages even if read failed. (If not we will have pages pinned forever in page cache) Write original extent information in UNDO entry, not compacted ones (we need position to tails!) When setting BLOCKUSED_USED, don't clear other bits (we have to preserve BLOCKUSED_USE_ORG_BITMAP) Fixed som bugs in directory handling Fixed bug where we wrote wrong lsn to blob pages Added separate blob_buffer for fixing bug when updating row that had char/varchar that spanned several pages and also had blobs Ensure we call _ma_bitmap_flushable() also in case of errors When doing an update, first delete old entries, then search in bitmap for where to put new information Info->s -> share Rowid -> rowid More DBUG_ASSERT() storage/maria/ma_blockrec.h: Added START_EXTENT_BIT and TAIL_PAGE_COUNT_MARKER Added _ma_bitmap_wait_or_flush() and _ma_bitmap_get_page_bits() storage/maria/ma_check.c: Don't write extra empty line if there is no deleted blocks Ignore START_EXTENT_BIT's in page count Call _ma_fast_unlock_key_del() to free key_del link storage/maria/ma_close.c: Ensure that used_key_del is 0. (If not, someone forgot to call _ma_unlock_key_del()) storage/maria/ma_create.c: Changed constant to macro storage/maria/ma_delete.c: For deleted keys, log also position to row storage/maria/ma_extra.c: Release blob buffer at maria_reset() if bigger than MARIA_SMALL_BLOB_BUFFER storage/maria/ma_key_recover.c: Added bzero() of LSN that confused paged cache in case of uninitialized block Mark file crashed if applying of index changes fails Added calls to _ma_fast_unlock_key_del() for protection of shared key_del link. storage/maria/ma_locking.c: Added usage of MARIA_FILE_OPEN_COUNT_OFFSET Added _ma_mark_file_crashed() storage/maria/ma_loghandler.c: Fixed bug where we logged uninitialized memory storage/maria/ma_open.c: Moved state->changed to be at start of state info on disk to allow one to easly mark files as crashed storage/maria/ma_page.c: Disable 'dummy' checksumming of pages as this gave false warnings. (Need to investigate if this is ever needed) storage/maria/ma_pagecache.c: Fixed wrong shift that caused Maria to crash on files > 4G storage/maria/ma_recovery.c: In case of errors, start writing on new line if we where in %## %## printing mode (Made errors more readable) Changed global variable name from warnings -> recovery_warnings Use MARIA_FILE_CREATE_RENAME_LSN_OFFSET instead of constant Removed special handling of row position for deleted keys. Keys now always includes row positions _ma_apply_undo_row_delete() now gets page and row position Added check that we don't loop forever when handling undo's (in case of bug in undo chain) Print name of failed REDO/UNDO storage/maria/ma_recovery.h: Removed old comment storage/maria/ma_static.c: Chaned version number of Maria files to not accidently use old ones (becasue of change of ordering of status variables) storage/maria/ma_test2.c: Added option -u to specify number of rows to update Changed old option -u to be -A, as for ma_test1 Fixed bug in update of rows with blobs (before blobs was always reset to empty on update) First created blob is now of max blob length to ensure we have at least one big blob in the table storage/maria/ma_test_all.sh: More tests storage/maria/ma_test_recovery.expected: Updated results storage/maria/ma_test_recovery: Changed tests to use bigger blobs (not just 1K) Added new tests that tests recovery of update with blobs Removed comparision of .MAD file as it's not guranteed that recovery from scratch gives identical data file as original update (compact_page() may be called at different times during normal execution and during REDO) storage/maria/ma_update.c: Simplify code (changed * to if) storage/maria/maria_chk.c: Make output more readable storage/maria/maria_def.h: Changed 'changed' to int to prepare for more bits Added 2 more bytes to status information Added 'st_mara_row->min_length' for storing min length needed on head page Added 'st_mara_handler->blob_buff & blob_buff_size' for storing blobs Moved all tunning parameters into one block Added MARIA_SMALL_BLOB_BUFFER Added _ma_mark_file_crashed() storage/myisam/mi_test2.c: Fixed bug in update of rows with blobs (before blobs was always reset to empty on update) storage/maria/ma_test_big.sh: Testing of insert, update, delete, recovery and undo of rows with blobs Thanks to the random-ness of ma_test2 this is likely to find most bugs in the row handling |
||
unknown
|
18bc7b695a |
WL#3072 - Maria Recovery
* to honour WAL we now force the whole log when flushing a bitmap page. * ability to intentionally crash in various places for recovery testing * bugfix (dirty pages list found in checkpoint record was ignored) * smaller checkpoint record * misc small cleanups and comments mysql-test/include/maria_empty_logs.inc: maria-purge.test creates ~11 logs, remove them all mysql-test/r/maria-recovery-bitmap.result: result is good; without the _ma_bitmap_get_log_address() call, we got check error Bitmap at 0 has pages reserved outside of data file length mysql-test/r/maria-recovery.result: result update mysql-test/t/maria-recovery-bitmap.test: enable test of "bitmap-flush should flush whole log otherwise corrupted data file (bitmap ahead of data pages)". mysql-test/t/maria-recovery.test: test of checkpoint sql/sql_table.cc: comment storage/maria/ha_maria.cc: _ma_reenable_logging_for_table() now includes file->trn=0. At the end of repair() we don't need to re-enable logging, it is done already by caller (like copy_data_between_tables()); it sounds strange that this function could decide to re-enable, it should be up to caller who knows what other operations it plans. Removing this line led to assertion failure in maria_lock_database(F_UNLCK), fixed by removing the assertion: maria_lock_database() is here called in a context where F_UNLCK does not make the table visible to others so assertion is excessive, and external_lock() is already designed to honour the asserted condition. Ability to crash at the end of bulk insert when indices have been enabled. storage/maria/ma_bitmap.c: Better use pagecache_file_init() than set pagecache callbacks directly; and a new function to set those callbacks for bitmap so that we can reuse it. _ma_bitmap_get_log_address() is a pagecache get_log_address callback which causes the whole log to be flushed when a bitmap page is flushed by the page cache. This was required by WAL. storage/maria/ma_blockrec.c: get_log_address pagecache callback for data (non bitmap) pages: just reads the LSN from the page's content, like was hard-coded before in ma_pagecache.c. storage/maria/ma_blockrec.h: functions which need to be exported storage/maria/ma_check.c: create_new_data_handle() can be static. Ability to crash after rebuilding the index in OPTIMIZE, in REPAIR. my_lock() implemented already. storage/maria/ma_checkpoint.c: As MARIA_SHARE* is now accessible to pagecache_collect_changed_blocks_LSN(), we don't need to store kfile/dfile descriptors in checkpoint record, 2-byte-id of the table plus one byte to say if this is data or index file is enough. So we go from 4+4 bytes per table down to 2+1. storage/maria/ma_commit.c: removing duplicate functions (see _ma_tmp_disable_logging_for_table()) storage/maria/ma_extra.c: Monty fixed storage/maria/ma_key_recover.c: comment storage/maria/ma_locking.c: Sometimes other code does funny things with maria_lock_database(), like ha_maria::repair() calling it at start and end without going through ha_maria::external_lock(). So it happens that maria_lock_database() is called with now_transactional!=born_transactional. storage/maria/ma_loghandler.c: update to new prototype storage/maria/ma_open.c: set_data|index_pagecache_callbacks() need to be exported as they are now called when disabling/enabling transactionality. storage/maria/ma_pagecache.c: Removing PAGE_LSN_OFFSET, as much of the code relies on it being 0 anyway (let's not give impression we can just change this constant). When flushing a page to disk, call the get_log_address callback to know up to which LSN the log should be flushed. As we now can access MARIA_SHARE* we can know share->id and store it into the checkpoint record; we thus go from 4 bytes per dirty page to 2+1. storage/maria/ma_pagecache.h: get_log_address callback storage/maria/ma_panic.c: No reason to reset pagecache callbacks in HA_PANIC_READ: all we do is reopen files if they were closed; callbacks should be in place already as 'info' exists; we just want to modify the file descriptors, not the full PAGECACHE_FILE structure. If we open data file and it was closed, share->bitmap.file needs to be set. Note that the modified code is disabled anyway. storage/maria/ma_recovery.c: Checkpoint record does not contain kfile/dfile descriptors anymore so code can be simplified. Hash key in all_dirty_pages is not made from file_descriptor & pageno anymore, but index_or_data & table-short-id & pageno. If a table's create_rename_lsn is higher than record's LSN, we skip the table and don't fail if it's corrupted (because the LSNs say that we don't have to look at this table). If a table is skipped (for example due to create_rename_lsn), its UNDOs still cause undo_lsn to advance; this is so that if later we notice the transaction has to rollback we fail (as table should not be skipped in this case). Fixing a bug: the dirty_pages list was never used, because the LSN below which it was used was the minimum rec_lsn of dirty pages! It is now the min(checkpoint_start_log_horizon, min(trn's rec_lsn)). When we disable/reenable transactionality, we modify pagecache callbacks (needed for example for get_log_address: changing share->page_type is not enough anymore). storage/maria/ma_write.c: 'records' and 'checksum' are protected: they are updated under log's mutex in write-hooks when UNDO is written. storage/maria/maria_chk.c: remove use of duplicate functions. storage/maria/maria_def.h: set_data|index_pagecache_callbacks() need to be exported; _ma_reenable_logging_for_table() changes to a real function. storage/maria/unittest/ma_pagecache_consist.c: new prototype storage/maria/unittest/ma_pagecache_single.c: new prototype storage/maria/unittest/ma_test_loghandler_pagecache-t.c: new prototype |
||
unknown
|
bf9c8b8a10 |
Write failure callback added.
storage/maria/ma_key_recover.c: Initialization fixed (by Monty) |
||
unknown
|
30d3d8d3fc |
Fixed several bugs in page CRC handling
- Ignore CRC errors in REDO for potential new pages - Ignore CRC errors when repairing tables - Don't do readcheck callback on read error - Set my_errno to HA_ERR_WRONG_CRC if we find page with wrong CRC - Check index page for length before calculating CRC to catch bad pages Fixed bugs where we used wrong file descriptor to read/write bitmaps Fixed wrong hash key in 'files_in_flush' Fixed wrong lock method when writing bitmap Fixed some wrong printf statements in check/repair that caused core dumps Fixed argument to translog_page_validator that cause reading of log files to fail Store number of bytes used for delete-linked key pages to be able to use standard index CRC for deleted key pages. Use fast 'dummy' pagecheck callbacks for temporary tables Don't die silently if flush finds pinned pages Give error (for now) if one tries to create a transactional table with fulltext or spatial keys Removed some not needed calls to pagecache_file_init() Added checking of pagecache checksums to ma_test1 and ma_test2 More DBUG Fixed some DBUG_PRINT to be in line with rest of the code include/my_base.h: Added HA_ERR_INTERNAL_ERROR (used for flush with pinned pages) and HA_ERR_WRONG_CRC mysql-test/r/binlog_unsafe.result: Added missing DROP VIEW statement mysql-test/r/maria.result: Added TRANSACTIONAL=0 when testing with fulltext keys Added test that verifies we can't yet create transactional test with fulltext or spatial keys mysql-test/r/ps_maria.result: Added TRANSACTIONAL=0 when testing with fulltext keys mysql-test/t/binlog_unsafe.test: Added missing DROP VIEW statement mysql-test/t/maria.test: Added TRANSACTIONAL=0 when testing with fulltext keys Added test that verifies we can't yet create transactional test with fulltext or spatial keys mysql-test/t/ps_maria.test: Added TRANSACTIONAL=0 when testing with fulltext keys mysys/my_fopen.c: Fd: -> fd: mysys/my_handler.c: Added new error messages mysys/my_lock.c: Fd: -> fd: mysys/my_pread.c: Fd: -> fd: mysys/my_read.c: Fd: -> fd: mysys/my_seek.c: Fd: -> fd: mysys/my_sync.c: Fd: -> fd: mysys/my_write.c: Fd: -> fd: sql/mysqld.cc: Fixed wrong argument to my_uuid_init() sql/sql_plugin.cc: Unified DBUG_PRINT (for convert-dbug-for-diff) storage/maria/ma_bitmap.c: Fixed wrong lock method when writing bitmap Fixed valgrind error Use fast 'dummy' pagecheck callbacks for temporary tables Faster bitmap handling for non transational tables storage/maria/ma_blockrec.c: Fixed that bitmap reading is done with the correct filehandle Handle reading of pages with wrong CRC when page contect doesn't matter Use the page buffer also when we get WRONG CRC or FILE_TOO_SHORT. (Faster and fixed a couple of bugs) storage/maria/ma_check.c: Split long strings for readablity Fixed some wrong printf statements that caused core dumps Use bitmap.file for bitmaps Ignore pages with wrong CRC storage/maria/ma_close.c: More DBUG_PRINT storage/maria/ma_create.c: Give error (for now) if one tries to create a crash safe table with fulltext or spatial keys storage/maria/ma_key_recover.c: Ignore HA_ERR_WRONG_CRC for new pages info->s -> share Store number of bytes used for delete-linked key pages to be able to use standard index CRC for deleted key pages. storage/maria/ma_loghandler.c: Fixed argument to translog_page_validator() storage/maria/ma_open.c: Removed old VMS specific code Added function to setup pagecache callbacks Moved code around to set 'share->temporary' early Removed some not needed calls to pagecache_file_init() storage/maria/ma_page.c: Store number of bytes used for delete-linked key pages to be able to use standard index CRC for deleted key pages. storage/maria/ma_pagecache.c: Don't do readcheck callback on read error Reset PCBLOCK_ERROR in pagecache_unlock_by_link() if we write page Set my_errno to HA_ER_INTERNAL_ERROR if flush() finds pinned pages Don't die silently if flush finds pinned pages. Use correct file descriptor when flushing pages Fixed wrong hash key in 'files_in_flush'; This must be the file descriptor, not the PAGECACHE_FILE as there may be several PAGECACHE_FILE for same file descriptor More DBUG_PRINT storage/maria/ma_pagecrc.c: Removed inline from not tiny static function Set my_errno to HA_ERR_WRONG_CRC if we find page with wrong CRC (Otherwise my_errno may be 0, and a lot of other code will be confused) CRCerror -> error (to keep code uniform) Print crc with %lu, as in my_checksum() uchar* -> uchar * Check index page for length before calculating CRC to catch bad pages Added 'dummy' crc_check and filler functions that are used for temporary tables storage/maria/ma_recovery.c: More DBUG More message to users to give information what phase failed Better error message if recovery failed storage/maria/ma_test1.c: Added checking of page checksums (combined with 'c' to not have to add more test runs) storage/maria/ma_test2.c: Added checking of page checksums (combined with 'c' to not have to add more test runs) storage/maria/maria_chk.c: Fixed wrong argument to _ma_check_print_error() storage/maria/maria_def.h: Added format information to _ma_check_print_xxxx functions uchar* -> uchar * |
||
unknown
|
18d408a913 |
Merge desktop.sanja.is.com.ua:/home/bell/mysql/bk/mysql-maria
into desktop.sanja.is.com.ua:/home/bell/mysql/bk/work-maria-callback storage/maria/Makefile.am: Auto merged storage/maria/ma_blockrec.c: Auto merged storage/maria/ma_check.c: Auto merged storage/maria/ma_create.c: Auto merged storage/maria/ma_loghandler.h: Auto merged storage/maria/ma_open.c: Auto merged storage/maria/ma_page.c: Auto merged storage/maria/ma_pagecache.c: Auto merged storage/maria/maria_chk.c: Auto merged storage/maria/maria_def.h: Auto merged storage/maria/unittest/ma_test_loghandler-t.c: Auto merged storage/maria/unittest/ma_test_loghandler_first_lsn-t.c: Auto merged storage/maria/unittest/ma_test_loghandler_max_lsn-t.c: Auto merged storage/maria/unittest/ma_test_loghandler_multigroup-t.c: Auto merged storage/maria/unittest/ma_test_loghandler_multithread-t.c: Auto merged storage/maria/unittest/ma_test_loghandler_noflush-t.c: Auto merged storage/maria/unittest/ma_test_loghandler_pagecache-t.c: Auto merged storage/maria/unittest/ma_test_loghandler_purge-t.c: Auto merged storage/maria/ma_bitmap.c: Merge. storage/maria/ma_loghandler.c: Merge. storage/maria/unittest/Makefile.am: Merge. |
||
unknown
|
7b19ba34fc |
Pagecache callbacks support added.
Page CRC check based on pagecache support added. Loghandler pagecache callbacks support added. Loghandler filecache rewritten. Support of deletting all logs added. storage/maria/Makefile.am: New file with functions for CRC calculation. storage/maria/ma_bitmap.c: Page CRC support. storage/maria/ma_blockrec.c: Removed code replaced by pagecache callbacks. storage/maria/ma_check.c: Page CRC support. storage/maria/ma_create.c: Page CRC support. storage/maria/ma_loghandler.c: Pagecache callbacks support. New file cache support. Removing log files support. storage/maria/ma_loghandler.h: CRC_LENGTH replaced with CRC_SIZE storage/maria/ma_open.c: Page CRC support. storage/maria/ma_page.c: Page CRC support. storage/maria/ma_pagecache.c: Pagecache callbacks support. storage/maria/ma_pagecache.h: Pagecache callbacks support. storage/maria/ma_panic.c: Page CRC support. storage/maria/maria_chk.c: Page CRC support. storage/maria/maria_def.h: Page CRC support. storage/maria/unittest/Makefile.am: New test of removing logs. storage/maria/unittest/ma_maria_log_cleanup.c: Memory leack fixed. storage/maria/unittest/ma_pagecache_consist.c: Pagecache callbacks support. storage/maria/unittest/ma_pagecache_single.c: Pagecache callbacks support. storage/maria/unittest/ma_test_loghandler-t.c: Fixed the test error processing. storage/maria/unittest/ma_test_loghandler_first_lsn-t.c: Fixed the test error processing. storage/maria/unittest/ma_test_loghandler_max_lsn-t.c: Fixed the test error processing. storage/maria/unittest/ma_test_loghandler_multigroup-t.c: Fixed the test error processing. storage/maria/unittest/ma_test_loghandler_multithread-t.c: Fixed the test error processing. storage/maria/unittest/ma_test_loghandler_noflush-t.c: Fixed the test error processing. storage/maria/unittest/ma_test_loghandler_pagecache-t.c: Pagecache callbacks support. storage/maria/unittest/ma_test_loghandler_purge-t.c: Fixed the test error processing. storage/maria/unittest/test_file.c: Removed unneeded sync. |
||
unknown
|
1cc48d1629 |
WL#3072 Maria Recovery.
Updates to the bitmap flush/pin logic to prepare for when we support multiple writers. storage/maria/ma_bitmap.c: Read lock is less bad than write lock. Changing bitmap->flushable to a counter, to prepare for when multiple writers are allowed on a table. Using bitmap->flush_all_requested instead of share->in_checkpoint; the latter can be true for the time of a whole checkpoint even though the checkpoint is not yet handling our table, or has already handled it, so to decrease the number of broadcasts we use a dedicated my_bool which is true only when checkpoint is handling this table's bitmap. _ma_bitmap_flushable(share,+1) waits for a concurrent _ma_bitmap_flush_all() to finish before incrementing non_flushable; without this, with multiple writers there may always be one thread making the bitmap unflushable and thus checkpoint would stall. storage/maria/ma_blockrec.c: update to new prototype: "flushable is FALSE|TRUE" becomes "add 1|-1 to non_flushable". storage/maria/ma_blockrec.h: new prototype storage/maria/maria_def.h: MARIA_FILE_BITMAP::flushable becomes a counter. New MARIA_FILE_BITMAP::flush_all_requested. |
||
unknown
|
d72c22dee4 |
WL#3072 - Maria recovery.
* fix for bitmap vs checkpoint bug which could lead to corrupted tables in case of crashes at certain moments: a bitmap could be flushed to disk even though it was inconsistent with the log (it could be flushed before REDO-UNDO are written to the log). One bug remains, need code from others. Tests added. Fix is to pin unflushable bitmap pages, and let checkpoint wait for them to be flushable. * fix for long_trid!=0 assertion failure at Recovery. * less useless wakeups in the background flush|checkpoint thread. * store global_trid_generator in checkpoint record. mysql-test/r/maria-recovery.result: result update mysql-test/t/maria-recovery.test: make it easier to locate subtests storage/maria/ma_bitmap.c: When we send a bitmap to the pagecache, if this bitmap is not in a flushable state we keep it pinned and add it to a list, it will be unpinned when the bitmap is flushable again. A new function _ma_bitmap_flush_all() used by checkpoint. A new function _ma_bitmap_flushable() used by block format to signal when it starts modifying a bitmap and when it is done with it. storage/maria/ma_blockrec.c: When starting a row operation (insert/update/delete), mark that the bitmap is not flushable (because for example INSERT is going to over-allocate in the bitmap to prevent other threads from using our data pages). If a checkpoint comes at this moment it will wait for the bitmap to be flushable before flushing it. When the operation ends, bitmap becomes flushable again; that transition is done under the bitmap's mutex (needed for correct synchro with a concurrent checkpoint); but for INSERT/UPDATE this happens inside _ma_bitmap_release_unused() at a place where it already has the mutex, so the only penalty (mutex adding) is in DELETE and UNDO of INSERT. In case of errors after setting the bitmap unflushable, we must always set it back to flushable or checkpoint would block. Debug possibilities to force a sleep while the bitmap is over-allocated. In case of error in get_head_or_tail() in allocate_and_write_block_record(), we still need to unpin all pages. Bugfix: _ma_apply_redo_insert_row_blobs() produced wrong data_file_length. storage/maria/ma_blockrec.h: new bitmap calls. storage/maria/ma_checkpoint.c: filter_flush_indirect not needed anymore (flushing bitmap pages happens in _ma_bitmap_flush_all() now). So st_filter_param::is_data_file|pages_covered_by_bitmap not needed. Other filter_flush* don't need to flush bitmap anymore. Add debug possibility to flush all bitmap pages outside of a checkpoint, to simulate pagecache LRU eviction. When the background flush/checkpoint thread notices it has nothing to flush, it now sleeps directly until the next potential checkpoint moment instead of waking up every second. When in checkpoint we decide to not store a table in the checkpoint record (because it has logged no writes for example), we can also skip flushing this table. storage/maria/ma_commit.c: comment is out-of-date storage/maria/ma_key_recover.c: comment fix storage/maria/ma_loghandler.c: comment is out-of-date storage/maria/ma_open.c: comment is out-of-date storage/maria/ma_pagecache.c: comment for bug to fix. And we don't take checkpoints at end of REDO phase yet so can trust block->type. storage/maria/ma_recovery.c: Comments. Now-unneeded code for incomplete REDO-UNDO groups removed. When we forget about an old transaction we must really forget about it with bzero() (fixes the "long_trid!=0 assertion" recovery bug). When we delete a row with maria_delete() we turn on STATE_NOT_OPTIMIZED_ROWS so we do the same when we see a CLR_END for an UNDO_ROW_INSERT or when we execute an UNDO_ROW_INSERT (in both cases a row was deleted). Pick up max_long_trid from the checkpoint record. storage/maria/maria_chk.c: comment storage/maria/maria_def.h: MARIA_FILE_BITMAP gets new members: 'flushable', 'bitmap_cond' and 'pinned_pages'. storage/maria/trnman.c: I used to think that recovery only needs to know the maximum TrID of the lists of active and committed transactions. But no, sometimes both lists can even be empty and their TrID should not be reused. So Checkpoint now saves global_trid_generator in the checkpoint record. storage/maria/trnman_public.h: macros to read/store a TrID mysql-test/r/maria-recovery-bitmap.result: result is ok. Without the code fix, we would get a corruption message about the bitmap page in CHECK TABLE EXTENDED. mysql-test/t/maria-recovery-bitmap-master.opt: usual when we crash mysqld in tests mysql-test/t/maria-recovery-bitmap.test: test of recovery problems specific of the bitmap pages. |
||
unknown
|
13f45b160b |
WL#3072 Maria recovery:
fix for bug: if a crash happened right after writing a REDO like this: REDO - UNDO - REDO*, then recovery would ignore the last REDO* (ok), rollback: REDO - UNDO - REDO* - REDO - CLR, and a next recovery would thus execute REDO* instead of skipping it again. Recovery now logs LOGREC_INCOMPLETE_GROUP when it meets REDO* for the first time, to draw a boundary and ensure it is always skipped. Tested by hand. Note: ma_test_all fails "maria_chk: error: Key 1 - Found too many records" not due to this patch (failed before). BitKeeper/triggers/post-commit: no truncation of the commit mail, or how to review patches? mysql-test/include/maria_verify_recovery.inc: let caller choose the statement used to crash (sometimes we want the crash to happen at special places) mysql-test/t/maria-recovery.test: user of maria_verify_recovery.inc now specifies statement which the script should use for crashing. storage/maria/ma_bitmap.c: it's easier to search for all places using functions from the bitmap module (like in ma_blockrec.c) if those exported functions all start with "_ma_bitmap": renaming some of them. Assertion that when we read a bitmap page, overwriting bitmap->map, we are not losing information (i.e. bitmap->changed is false). storage/maria/ma_blockrec.c: update to new names. Adding code (disabled, protected by a #ifdef) that I use to test certain crash scenarios (more to come). storage/maria/ma_blockrec.h: update to new names storage/maria/ma_checkpoint.c: update to new names storage/maria/ma_extra.c: update to new names storage/maria/ma_loghandler.c: new LOGREC_INCOMPLETE_GROUP storage/maria/ma_loghandler.h: new LOGREC_INCOMPLETE_GROUP storage/maria/ma_recovery.c: When at the end of the REDO phase we have identified some transactions with incomplete REDO groups (REDOs without an UNDO or CLR_END), for each of them we log LOGREC_INCOMPLETE_GROUP. This way, the upcoming UNDO phase can write more records for such transaction, a future recovery won't pair the incomplete group with the CLR_END (as there is LOGREC_INCOMPLETE_GROUP to draw a boundary). |
||
unknown
|
4e0964cb04 |
Fixed repair_by_sort to work with BLOCK_RECORD
Fixed bugs in undo logging Fixed bug where head block was split before min_row_length (caused Maria to believe row was crashed on read) Reserved place for reference-transid on key pages (for packing of transids) ALTER TABLE and INSERT ... SELECT now uses fast creation of index Known bugs: ma_test_recovery fails because of a bug in redo handling when log is cut directly after a redo (Guilhem knows how to fix) ma_test_recovery.excepted is not totally correct, because of the above bug mysqld sometimes fails to restart; Fails with error "end_of_redo_phase: Assertion `long_trid != 0' failed"; Guilhem to investigate include/maria.h: Prototype changes Added current_filepos to st_maria_sort_info mysql-test/r/maria.result: Updated results that changes as alter table and insert ... select now uses fast creation of index mysys/mf_iocache.c: Reset variable to gurard against double invocation storage/maria/ma_bitmap.c: Added _ma_bitmap_reset_cache() (needed for repair) storage/maria/ma_blockrec.c: Simplify code More initial allocations Fixed bug where head block was split before min_row_length (caused Maria to believe row was crashed on read) storage/maria/ma_blockrec.h: Moved TRANSID_SIZE to maria_def.h Added prototype for new functions storage/maria/ma_check.c: Simplicy code Fixed repair_by_sort to work with BLOCK_RECORD - When using BLOCK_RECORD or UNPACK create new Maria handle - Use common initializer function - Align code with maria_repair() Made some changes to maria_repair_parallel() to use common initializer function Removed ASK_MONTY section by fixing noted problem storage/maria/ma_close.c: Moved check for readonly to _ma_state_info_write() storage/maria/ma_key_recover.c: Use different log entries if key root changes or not. This fixed some bugs when tree grows storage/maria/ma_key_recover.h: Added keynr to st_msg_to_write_hook_for_undo_key storage/maria/ma_loghandler.c: Added INIT_LOGREC_UNDO_KEY_INSERT_WITH_ROOT storage/maria/ma_loghandler.h: Added INIT_LOGREC_UNDO_KEY_INSERT_WITH_ROOT storage/maria/ma_open.c: Added TRANSID to all key pages (for future compressing of trans id's) For compressed records, alloc a bit bigger buffer to avoid valgrind warnings If table is opened readonly, don't update state storage/maria/ma_packrec.c: Allocate bigger array for bit unpacking to avoid valgrind errors storage/maria/ma_recovery.c: Added UNDO_KEY_INSERT_WITH_ROOT & UNDO_KEY_DELETE_WITH_ROOT storage/maria/ma_sort.c: More logging storage/maria/ma_test_all.sh: More tests storage/maria/ma_test_recovery.expected: Update results Note that this is not complete becasue of a bug in recovery storage/maria/ma_test_recovery: Removed recreation of index (not needed when we have redo for index pages) storage/maria/maria_chk.c: When using flag --read-only, don't update status for files When using --unpack, don't use REPAIR_BY_SORT if other repair option is given Enable repair_by_sort for BLOCK records Removed not needed newline at start of --describe storage/maria/maria_def.h: Support for TRANSID_SIZE to key pages storage/maria/maria_read_log.c: renamed --only-display to --display-only |
||
unknown
|
422375fc1b |
Merge bk-internal.mysql.com:/home/bk/mysql-maria
into mysql.com:/home/my/mysql-maria storage/maria/ha_maria.cc: Auto merged storage/maria/ma_bitmap.c: Auto merged storage/maria/ma_checkpoint.c: Auto merged storage/maria/ma_close.c: Auto merged storage/maria/ma_loghandler.c: Auto merged storage/maria/ma_loghandler.h: Auto merged storage/maria/ma_open.c: Auto merged storage/maria/ma_pagecache.h: Auto merged storage/maria/ma_write.c: Auto merged storage/maria/maria_def.h: Auto merged storage/maria/unittest/ma_pagecache_single.c: Auto merged storage/maria/ma_blockrec.c: Manual merge storage/maria/ma_page.c: Manual merge storage/maria/ma_pagecache.c: Manual merge storage/maria/ma_preload.c: Manual merge storage/maria/ma_recovery.c: Manual merge Add _ma_unpin_all_pages() to all new UNDO redo_exec_hook's |
||
unknown
|
086b34c935 |
WL#3071 Maria checkpoint
Fixing bad comments (I remember my maths' teacher "one late night you'll obey to the simplifications made by your tired neurons"; exactly what happened here). In Checkpoint, when we flush a table's state we must flush all log records (WAL), not only those before checkpoint started. storage/maria/ma_bitmap.c: there was a flaw in reasoning, bug does exist. storage/maria/ma_blockrec.c: moving piece of comment to ma_checkpoint.c storage/maria/ma_checkpoint.c: Comments. When checkpoint flushes a state, WAL imposes that all records up to this state have been flushed, not only up to checkpoint_start_log_horizon. storage/maria/ma_recovery.c: finishing comment. |
||
unknown
|
c2084d2a13 |
WL#3071 - Maria checkpoint
Observe WAL for the table's state: all log records needed for undoing uncommitted state must be in the log before we flush state. storage/maria/ha_maria.cc: comments storage/maria/ma_bitmap.c: Comment for why there is no bug storage/maria/ma_blockrec.c: comment for why there is no bug storage/maria/ma_checkpoint.c: Observe WAL for the table's state: all log records needed for undoing uncommitted state must be in the log before we flush state. I tested by hand that the bug existed (create table, insert one row into it but let that insert pause after increasing data_file_length, let checkpoint start but kill it after it has flushed state). Log contains nothing, table is not recovered though it has a too big data_file_length. With this bugfix, the log contains REDO so table is opened so data_file_length is corrected. storage/maria/ma_close.c: If table is read-only we must never write to it. Should be a no-change in fact, as if read-only, share->changed is normally always false. storage/maria/ma_recovery.c: documenting bug found by Monty. Print when fixing data_file_length. |
||
unknown
|
f3e957b7c1 |
Support of rec_lsn added to pagecache_write call.
storage/maria/ma_pagecache.c: Support of rec_lsn added to pagecache_write call. A function for setting rec_lsn made. |
||
unknown
|
301ee8d9a3 |
Merge bk-internal.mysql.com:/home/bk/mysql-maria
into mysql.com:/home/my/mysql-maria include/my_sys.h: Auto merged mysql-test/r/maria.result: Auto merged mysql-test/t/maria.test: Auto merged sql/handler.h: Auto merged sql/mysqld.cc: Auto merged storage/maria/ha_maria.cc: Auto merged storage/maria/ma_bitmap.c: Auto merged storage/maria/ma_blockrec.c: Auto merged storage/maria/ma_loghandler.c: Auto merged storage/maria/ma_pagecache.c: Auto merged storage/maria/ma_test1.c: Auto merged storage/maria/ma_test_recovery.expected: Auto merged storage/maria/ma_test_recovery: Auto merged sql/mysql_priv.h: manual merge storage/maria/ma_recovery.c: manual merge storage/maria/ma_test2.c: manual merge |
||
unknown
|
13d53bf657 |
Merge some changes from sql directory in 5.1 tree
Changed format for REDO_INSERT_ROWS_BLOBS Fixed several bugs in handling of big blobs Added redo_free_head_or_tail() & redo_insert_row_blobs() Added uuid to control file maria_checks now verifies that not used part of bitmap is 0 REDO_PURGE_BLOCKS -> REDO_FREE_BLOCKS Added REDO_FREE_HEAD_OR_TAIL Fixes problem when trying to read block outside of file during REDO include/my_global.h: STACK_DIRECTION is already set by configure mysql-test/r/maria.result: Updated results mysql-test/t/maria.test: Test shrinking of VARCHAR mysys/my_realloc.c: Fixed indentation mysys/safemalloc.c: Fixed indentation sql/filesort.cc: Removed some casts sql/mysqld.cc: Added missing setting of myisam_stats_method_str sql/uniques.cc: Removed some casts storage/maria/ma_bitmap.c: Added printing of bitmap (for debugging) Renamed _ma_print_bitmap() -> _ma_print_bitmap_changes() Added _ma_set_full_page_bits() Fixed bug in ma_bitmap_find_new_place() (affecting updates) when using big files storage/maria/ma_blockrec.c: Changed format for REDO_INSERT_ROWS_BLOBS Fixed several bugs in handling of big blobs Added code to fix some cases where redo when using blobs didn't produce idenital .MAD files as normal usage REDO_FREE_ROW_BLOCKS doesn't anymore change pages; We only mark things free in bitmap Remove TAIL and filler extents from REDO_FREE_BLOCKS log entry. (Fixed some asserts) REDO_PURGE_BLOCKS -> REDO_FREE_BLOCKS Delete tails in update. (Fixed bug when doing update that shrinks blob/varchar length) Fixed bug when doing insert in block outside of file size. Added redo_free_head_or_tail() & redo_insert_row_blobs() Added pagecache_unlock_by_link() when read fails. Much more comments, DBUG and ASSERT entries storage/maria/ma_blockrec.h: Prototypes of new functions Define of SUB_RANGE_SIZE & BLOCK_FILLER_SIZE storage/maria/ma_check.c: Verify that not used part of bitmap is 0 storage/maria/ma_control_file.c: Added uuid to control file storage/maria/ma_loghandler.c: REDO_PURGE_BLOCKS -> REDO_FREE_BLOCKS Added REDO_FREE_HEAD_OR_TAIL storage/maria/ma_loghandler.h: REDO_PURGE_BLOCKS -> REDO_FREE_BLOCKS Added REDO_FREE_HEAD_OR_TAIL storage/maria/ma_pagecache.c: If we write full block, remove error flag for block. (Fixes problem when trying to read block outside of file) storage/maria/ma_recovery.c: REDO_PURGE_BLOCKS -> REDO_FREE_BLOCKS Added REDO_FREE_HEAD_OR_TAIL storage/maria/ma_test1.c: Allow option after 'b' to be compatible with ma_test2 (This is just to simplify test scripts like ma_test_recovery) storage/maria/ma_test2.c: Default size of blob is now 1000 instead of 1 storage/maria/ma_test_all.sh: Added test for bigger blobs storage/maria/ma_test_recovery.expected: Updated results storage/maria/ma_test_recovery: Added test for bigger blobs |