- 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
Fixed error in Maria unittest
Fixes other issues found by test case for lp:700623 "Aria recovery: ma_blockrec.c:3930: _ma_update_at_original_place: Assertion `block->org_bitmap_value == .."
Fixes lp:670356 "Aria table "is marked as crashed and should be repaired"
mysql-test/lib/v1/mysql-test-run.pl:
Don't delete directory mysql-test/var if we use mysql-test-run --vardir=
mysql-test/mysql-test-run.pl:
Don't delete directory mysql-test/var if we use mysql-test-run --vardir=
(Needed to be able to run multiple concurrent mysql-test-run's/randgen on the same server)
Added extra supression
storage/maria/ma_pagecache.c:
Removed duplicate DBUG_PRINT information
Added KEYCACHE_PRINT for printing information that was already printed to DBUG log (to get rid of some duplicated output)
More comments
Fixed bug that caused page block to be used by two treads at the same time (with different page information)
Mark block->status with PCBLOCK_DIRECT_W independent of the block is changed or not. (Safety fix)
storage/maria/maria_chk.c:
Better --help
storage/maria/unittest/ma_test_recovery.pl:
Ignore differences in 'recover time'.
Fixed error in Maria unittest
- 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
- 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)
mysql-test/suite/handler/innodb.result:
Added test case
mysql-test/suite/handler/innodb.test:
Added test case
sql/handler.h:
Move setting/resetting of active_index to ha_index_init()/ha_index_end() to simplify handler functions index_init()/index_end()
Fixed that get_index() returns MAX_KEY if index is not inited (this fixed LP#697610)
storage/federated/ha_federated.cc:
Settting of active_index is not needed anymore
storage/maria/ma_pagecache.c:
Added error message if we have too little memory for Maria page cache
storage/maria/ma_pagecache.c:
- Ensure that we write also the last buffer in flush if buffer overflows.
- Don't set PCBLOCK_IN_FLUSH if we don't flush the page
- Added some new safety asserts.
- Don't delete pages without flushing that has had a tail or head information in pagecache_delete()
This fixes a case where REPAIR could find old deleted rows.
storage/maria/ha_maria.cc:
Remove calls to depricated function ha_statistic_increment
storage/maria/ma_blockrec.c:
Don't delete pages without flushing that has had a tail or head information in pagecache_delete()
storage/maria/ma_pagecache.c:
Added possibility to mark pages to not be deleted by pagecache_delete() without beeing flushed.
storage/maria/ma_pagecache.h:
Added new prototype
Fixed timing test failures.
Fixed a failure in the Aria engines page cache and log handler (found with maria.maria-big test)
- This could cause a core dump when deleting big blobs.
- Added test to end_pagecache() to verify that page cache was correctly used.
- inc_counter_for_resize_op and dec_counter_for_resize_op are called same number of times.
- All page cache blocks was properly deallocated (empty)
mysql-test/suite/innodb/t/innodb_bug38231.test:
Fixed timing issue (code comment says it all)
mysql-test/suite/innodb_plugin/t/innodb_bug38231.test:
Fixed timing issue (code comment says it all)
sql/debug_sync.cc:
Fixed compiler warning
storage/maria/ma_loghandler.c:
Fixed bug found by maria.maria-big test:
- Fixed race condition between update thread logging a very big blog and checkpoint thread.
storage/maria/ma_pagecache.c:
Added assert to ensure mutex was properly locked.
Added test to end_pagecache() to verify that page cache was correctly used.
- inc_counter_for_resize_op and dec_counter_for_resize_op are called same number of times.
- All page cache blocks was properly deallocated (empty)
In pagecache_delete_internal(), properly reset counters and pins if functions aborts.
Added missing inc_counter_for_resize_op() to pagecache_wait_lock().
Added missing dec_counter_for_resize_op() to pagecache_delete()
- 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()
storage/maria/unittest/ma_pagecache_single.c:
Check if we can flush write locked page for normal flush
Check that we can't flush read locked page with FLUSH_KEEP_LAZY (used by checkpoint)
- Changed default recovery mode from OFF to NORMAL to get automatic repair of not properly closed tables.
- Fixed a rase condition when two threads calls external_lock and thr_lock() in different order. When this happend the transaction that called external lock first
and thr_lock() last did not see see the rows from the other transaction, even if if it had to wait in thr_lock() for other to complete.
- Fixed that one can run maria_chk on an automatcally recovered tables without warnings about too small transaction id
- Don't give warning that crashed table could not be repaired if repair was disabled (and thus not run)
- Fixed a error result from flush_key_cache() which caused a DBUG_ASSERT() when one was using concurrent reads on non transactional tables that was updated.
client/mysqldump.c:
Add "" around error message to make it more readable
client/mysqltest.cc:
Free environment variables
mysql-test/r/mysqldump.result:
Updated results
mysql-test/r/openssl_1.result:
Updated results
mysql-test/suite/maria/r/maria-recover.result:
Updated results
mysql-test/suite/maria/r/maria3.result:
Updated results
mysql-test/suite/maria/t/maria3.test:
Added more test of temporary tables
storage/maria/ha_maria.cc:
Changed default recovery mode from OFF to NORMAL to get automatic repair of not properly closed tables.
Start transaction in ma_block_get_status() instead of in ha_maria::external_lock().
- This fixes a rase condition when two threads calls external lock and thr_lock() in different order. When this happend the transaction that called external lock first and thr_lock() last did not see see the rows from the other transaction, even if if it had to wait in thr_lock() for other to complete.
Store latest transaction id in controll file if recovery was done.
- This allows one to run maria_chk on an automatcally recovered tables without warnings about too small transaction id
storage/maria/ha_maria.h:
Don't give warning that crashed table could not be repaired if repair was disabled (and thus not run)
storage/maria/ma_blockrec.h:
Added new function "_ma_block_get_status_no_versioning()"
storage/maria/ma_init.c:
Added hook to create trn in ma_block_get_status() if we are using MariaDB
storage/maria/ma_open.c:
Ensure we call _ma_block_get_status_no_versioning() for transactional tables without versioning (like tables with fulltext)
storage/maria/ma_pagecache.c:
Allow one to flush blocks that are pinned for read.
This fixed a error result from flush_key_cache() which caused a DBUG_ASSERT() when one was using concurrent reads on non transactional tables that was updated.
storage/maria/ma_recovery.c:
Set maria_recovery_changed_data to 1 if recover changed something.
Set max_trid_in_control_file to max found trn if we found a bigger trn.
The allows will ensure that the control file is up to date after recovery which allows one to run maria_chk on the tables without warnings about too big trn
storage/maria/ma_state.c:
Call maria_create_trn_hook() in _ma_setup_live_state() instead of ha_maria::external_lock()
This ensures that 'state' and trn are in sync and thus fixes the race condition mentioned for ha_maria.cc
storage/maria/ma_static.c:
Added maria_create_trn_hook() and maria_recovery_changed_data
storage/maria/maria_def.h:
Added MARIA_HANDLER->external_ptr, which is used to hold MariaDB thd.
Added some new external variables
Removed reference to non existing function: maria_concurrent_inserts()
mysql-test/t/variables.test:
Reset delay_key_write, otherwise maria.maria test may fail
sql/set_var.cc:
Reset ha_open_options if one resets the delay_key_write variable.
Before there was no way to reset it without restarting mysqld, which caused some tests to fail
- 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
Added code to detect and give error when doing an insert into a view where we accessed fields in a not yet read table
Disabled test in subselect.test as the CHECK_OPTION for views doesn't work for insert.
This needs to be fixed properly later.
The problem with views are described in Bug #41760 Inserting into multiple-table views is not working
mysql-test/r/insert.result:
Fixed wrong usage of insert into view.
mysql-test/r/subselect.result:
Disabled wrong test (temporary)
mysql-test/suite/maria/r/maria.result:
Added test of size of table
mysql-test/suite/maria/t/maria.test:
Added test of size of table
mysql-test/t/insert.test:
Fixed wrong usage of insert into view
The bug is that during insert/update we currently don't read any of the referenced tables of the view.
This means that we can't get a value from another table to use as part of the update.
mysql-test/t/subselect.test:
Disabled not working test until someone has time to fix insert into view properly
Here we where refering to last used value in t2, which is wrong.
sql/sql_insert.cc:
Detect if we are trying to update one table in a view based on value in another, not yet read, table.
This fixes the problem discovered in insert.test
storage/maria/ma_blockrec.c:
Don't ignore not critical changes to the last page in the table.
We need to write the last page as otherwise we can during aborting of a row with a duplicate key get
state.data_file_length and the real length of file out of sync
storage/maria/ma_check.c:
Flush the page cache even if we got an error during zerofill.
(This fixes a call to assert() in case of a too short data file)
storage/maria/ma_pagecache.c:
Mark page as read when we do a write of a full page.
This fixes a bug when we got an error during read and then used direct write to page to update it
storage/maria/ma_state.c:
Restore info->lock.type after call to maria_versioning.
Fixed crash in maria_recover.test
storage/maria/maria_read_log.c:
Don't write thread id in debug log. (Not needed as maria_read_log is a single treaded program)
Scenario of the BUG#40731 ("Maria: hang (probably in page cache) under concurrency"):
T1: Disable logging for the table
T1: Start inserting into the table
T2: Tries to lock the table so waits.
T2: Tries unlock and relock during the process see that the table has disabled logging and reenables it
T1: Got DBUG_ASSERT because suddenly start use table with transaction switched on which is not expected during bulk insert
storage/maria/ma_pagecache.c:
Page type print added for debugging purposes.
storage/maria/ma_recovery.c:
Check that it was this thred which switched off logging (transactional mode).
storage/maria/maria_def.h:
Flag for controling which thread switched off transactiona mode for the table added.
storage/maria/ma_pagecache.c:
Fixed ability to read without read lock acquiring.
storage/maria/unittest/CMakeLists.txt:
New unit test which tests simple read and prolonged writes consistency added.
storage/maria/unittest/Makefile.am:
New unit test which tests simple read and prolonged writes consistency added.
storage/maria/unittest/ma_pagecache_rwconsist2.c:
New unit test which tests simple read and prolonged writes consistency added.
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
Fixed compiler warning
Ensure that pagecache returns correct error number
storage/maria/ma_pagecache.c:
Ensure that block->error contain error code from my_errno (not return value from pread/pwrite)
Went through usage of my_pread/my_pwrite and ensured that result was threated correctly
Fixed some wrong usage of my_bool
Ensure that pagecache gives correct error number even if error for block happend
mysys/my_pread.c:
Indentation fix
storage/maria/ha_maria.cc:
filenames changed to be of type LEX_STRING
storage/maria/ma_check.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_checkpoint.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_create.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_dbug.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_delete.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_info.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_keycache.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_locking.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_loghandler.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_open.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_pagecache.c:
Store error number for last failed operation in the page block
This should fix some asserts() when errno was not properly set after failure to read block in another thread
storage/maria/ma_recovery.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_update.c:
filenames changed to be of type LEX_STRING
storage/maria/ma_write.c:
filenames changed to be of type LEX_STRING
storage/maria/maria_def.h:
filenames changed to be of type LEX_STRING
storage/maria/maria_ftdump.c:
filenames changed to be of type LEX_STRING
storage/maria/maria_pack.c:
filenames changed to be of type LEX_STRING
Recovery of R-tree and fulltext indices.
Fix for BUG#35551 "Maria: crash in REPAIR TABLE/ENABLE KEYS if using
repair-with-keycache method".
Fix for bug (see ma_rt_index.c) where we could have a wrong
page_link pointer causing wrong memory access during some R-tree
index insert/delete.
Making ma_rt_test work again (it had been neglected over time) and
adding options (record type etc) to prepare it for integration into
ma_test_all-t (but there is BUG#36321 about "ma_rt_test -M" crash)
mysql-test/r/maria.result:
correct result
mysql-test/t/maria.test:
now we get no error
storage/maria/ma_blockrec.c:
delete_dir_entry() and delete_head_or_tail() don't use info->keyread_buff.
ma_get_length() does not change **packet, marking it with 'const' to
remove some casts in callers of this function. The
(const uchar**)&header casts will be removed when Monty changes 'header'
to const uchar*.
_ma_apply_redo_purge_row_head_or_tail() sets 'buff' from pagecache_read()
so its initialization was superfluous.
storage/maria/ma_check.c:
Fix for BUG#35551 "Maria: crash in REPAIR TABLE/ENABLE KEYS if using repair-with-keycache method"
(see comment in code)
storage/maria/ma_create.c:
FULLTEXT and SPATIAL indices have logging now, they are recoverable.
storage/maria/ma_delete.c:
Logging done by _ma_ck_delete() is moved to a function
(_ma_write_undo_key_delete()), for reusal by R-tree logging.
_ma_log_delete() is made non-static for same
reason, and some of its parameters are made pointers to const.
Removed wrong comment ("Note that for delete key" etc, contradicted by
code and comment "Log also position to row" a few lines above)
storage/maria/ma_ft_update.c:
unneeded cast, comment for future
storage/maria/ma_key_recover.c:
Comment about possible deadlock.
Write bad page to DBUG trace if KEY_OP_CHECK founds bad CRC.
Support operation KEY_OP_MULTI_COPY.
When we execute, in UNDO phase, UNDO_KEY_DELETE|INSERT, we must call
the proper key insertion|deletion depending on if this is R-tree
or B-tree.
Explanation of of _ma_[un]lock_key_del() work, maybe useful for
mortals like me.
storage/maria/ma_key_recover.h:
change of prototypes
storage/maria/ma_loghandler.h:
New operation which can be stored in REDO_INDEX log records: KEY_OP_MULTI_COPY
storage/maria/ma_page.c:
Comments
storage/maria/ma_pagecache.c:
typo
storage/maria/ma_rt_index.c:
Fix for bug: the page_link pointer in maria_rtree_insert_req()
could be wrong when we set its 'changed' member; for the solution
see ma_key_recover.h. It is needed only in cases when we manipulate
several pages.
Logging of changes done to pages by key insert/delete.
maria_rtree_delete()'s main work is moved to a new function
maria_rtree_real_delete(), which is used by maria_rtree_delete()
and by applying of UNDO_KEY_INSERT.
storage/maria/ma_rt_index.h:
new prototypes and macros for ma_rt_index.c
storage/maria/ma_rt_key.c:
Logging of maria_rtree_add_key() and maria_rtree_delete_key().
When inserting, split is necessary if there is not enough room for key:
take checksum's occupied space in this calculation.
storage/maria/ma_rt_key.h:
new prototypes (those functions need to know the page's id
because they do logging)
storage/maria/ma_rt_mbr.c:
Comments about what the functions change.
storage/maria/ma_rt_split.c:
maria_rtree_split_page() needs to know the page's id, because
it does logging.
Logging of what a split operation does to the split page (see
comment of _ma_log_rt_split(): moves of keys inside the page,
sometimes insertion of the new key, and shrinking of the page)
and to the new page (receives some keys from split page, and
sometimes the new key).
storage/maria/ma_rt_test.c:
ma_rt_test had been forgotten when maria_rkey() was changed some months ago
(0->HA_WHOLE_KEY change), and when calls to maria_rnd(,,HA_OFFSET_ERROR)
were rewritten to maria_scan() calls (which implies maria_scan_init()).
The 'max_i' change is to adapt to the fact that maria_scan() does
not return deleted records for BLOCK_RECORD but does so for other formats;
the initial code assumed a certain number of deleted records would be
returned, we change it to rather count only non-deleted ones.
We also add more features to this test, like ma_test1 (the plan
is to run ma_rt_test in ma_test_all-t):
options to choose records' format, table checksum, transactions,
checkpoints, end at specific stages, abort without committing,
and debug trace.
storage/maria/ma_test1.c:
MY_INIT() does my_init().
storage/maria/ma_write.c:
Logging done by _ma_ck_write_btree_with_log() is moved to a function
(_ma_write_undo_key_insert()), for reusal by R-tree logging.
_ma_log_new() and _ma_log_change() are made non-static for same
reason. Some parameters of logging functions are made pointers to const.
If EXTRA_DEBUG_KEY_CHANGES, we now log CRC in _ma_log_change() too
(better checks, bigger record).
storage/maria/maria_read_log.c:
Program takes no arguments, bail out if any, instead of silently discarding them
storage/myisam/rt_test.c:
rt_test had been forgotten when mi_rkey() was changed some months ago
(0->HA_WHOLE_KEY change).
The 'max_i' change is to make it symmetric with ma_rt_test.c
mysql-test/r/maria-gis-rtree-dynamic.result:
correct result
mysql-test/r/maria-gis-rtree-trans.result:
correct result
mysql-test/r/maria-recovery-rtree-ft.result:
almost correct result (hitting BUG# in the end)
mysql-test/t/maria-gis-rtree-dynamic.test:
test R-tree & dynamic row format
mysql-test/t/maria-gis-rtree-trans.test:
Test R-tree and page row format and transactional
mysql-test/t/maria-recovery-rtree-ft-master.opt:
usual options for recovery testing
mysql-test/t/maria-recovery-rtree-ft.test:
test of recovery of R-tree and fulltext indices.
the moment. (BUG#34634)
Fixed potential bug in pinning schema.
storage/maria/ma_pagecache.c:
Fixed problem of deleting blocks which are being evicted at
the moment.
Fixed potential bug in pinning schema.
fixes for ma_test_recovery.pl to work in release builds too:
- bugfix in maria_zerofill_index()
- applying of LOGREC_INSERT_ROW_BLOBS now zeroes unused end of non-full
blob page (a mutation of tail page when it takes >75% of maria_block_size)
like write_full_pages() does.
storage/maria/ma_blockrec.c:
When we write a non-full blob page at run-time, we zero the rest of
it (see write_full_pages()). We now do the same in
_ma_apply_redo_insert_row_blobs(): this is consistent and helps
having log-applying produce the same page as run-time.
storage/maria/ma_check.c:
maria_zerofill_index() was wrong: it didn't zero certain bytes
because it believed that the count of relevant bytes is
_ma_get_page_used(share, buff) + share->keypage_header,
whereas it's only the first term.
storage/maria/ma_pagecache.c:
typo
storage/maria/ma_pagecache.h:
typo
storage/maria/maria_chk.c:
enable --zerofill-keep-lsn in all builds
storage/maria/unittest/ma_test_recovery.pl:
now even release builds can run ma_test_recovery.pl, because zerofill
makes tables of this test (made by run-time and by log-applying)
identical.
into 88-214-96-46.dialup.umc.net.ua:/Users/bell/mysql/bk/work-maria-test
storage/maria/ma_pagecache.c:
Auto merged
storage/maria/unittest/Makefile.am:
merge
storage/maria/unittest/ma_pagecache_consist.c:
merge
scheme for the same thread locking).
include/my_pthread.h:
Added variable for lock diffirentiation.
include/wqueue.h:
New release call.
mysys/wqueue.c:
New release call in case of read/write lock.
storage/maria/ma_pagecache.c:
Locking for read and write made waitimg for each other.
storage/maria/unittest/Makefile.am:
New test added.
storage/maria/unittest/ma_pagecache_consist.c:
Fixed thread initialization in the test.
storage/maria/unittest/ma_pagecache_rwconsist.c:
New BitKeeper file ``storage/maria/unittest/ma_pagecache_rwconsist.c''
log handler).
storage/maria/ma_loghandler.c:
Buffers on the stack must be properly aligned as pagecache_read()
will use bmove512() on them. Fixes hang in maria-recovery.test
on Solaris 10 Sparc 64 bit.
storage/maria/ma_pagecache.c:
comment
a typo had not disable LOAD INDEX for Maria.
BUG#34161 "freeing maria tmp table after fetching rows using prepared statements - crashes"
running the testcase I was not able to repeat the same crash but
found a misplaced assertion giving false positive, fixed here.
storage/maria/ha_maria.cc:
important typo
storage/maria/ma_pagecache.c:
The assertion on block's type should be after read_block(). Otherwise
it can give false alarms.
into oleksandr-byelkins-powerbook-g4-15.local:/Users/bell/mysql/bk/work-maria-wrn
storage/maria/ma_blockrec.c:
Auto merged
storage/maria/ma_check.c:
Auto merged
storage/maria/ma_control_file.c:
Auto merged
storage/maria/ma_key_recover.c:
Auto merged
storage/maria/ma_page.c:
Auto merged
storage/maria/ma_pagecache.c:
Auto merged
storage/maria/ma_recovery.c:
Auto merged
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.
storage/maria/ma_control_file.c:
Even if the file is just created we have to lock it, otherwise some
other Maria instance may write to it.
storage/maria/ma_pagecache.c:
catch too big page numbers when they enter the pagecache; this helps
debugging BUG#34250.
Test for BUG#34106 "auto_increment is reset to 1 when table is recovered from crash"
(fixed by Monty yesterday)
mysql-test/r/maria-recovery.result:
result, which is correct (before pulling Monty's fix for BUG#34106,
we got a warning about auto_increment in CHECK TABLE (done in
maria-verify-recovery.inc), no AUTO_INCREMENT clause in
SHOW CREATE TABLE, and a failure of the last INSERT.
mysql-test/r/maria.result:
result
mysql-test/t/maria-recovery.test:
Test for BUG#34106
mysql-test/t/maria.test:
look at what is reported in SHOW ENGINES
mysys/my_pread.c:
changed my mind: if Count argument is >4GB, we'll surely see a segfault
in the pread() call when it tries to read 4GB from memory, so no need
to print it in ulonglong format (saves a function call).
mysys/my_read.c:
changed my mind: if Count argument is >4GB, we'll surely see a segfault
in the pread() call when it tries to read 4GB from memory, so no need
to print it in ulonglong format (saves a function call).
mysys/my_write.c:
changed my mind: if Count argument is >4GB, we'll surely see a segfault
in the pread() call when it tries to read 4GB from memory, so no need
to print it in ulonglong format (saves a function call).
storage/maria/ha_maria.cc:
Description representing the current reality. This can be changed later
storage/maria/ma_page.c:
When reading the new key_del from a page on disk, if there is a bug
(like BUG#34062) this key_del could be wrong, we try to catch if it's
out of the key file.
storage/maria/ma_pagecache.c:
- no truncation of page's number in DBUG_PRINT (useful for BUG#34062)
- page_korr instead of uint5korr
storage/maria/ma_recovery.c:
page_korr instead of uint5korr
storage/maria/plug.in:
Description representing the current reality. This can be changed later.
Fixed bug where return value 'error' was not set in case of error in pagecache
Documented the open LOAD INDEX bug
KNOWN_BUGS.txt:
Added the problem with LOAD INDEX as a known bugs. Will fix this bug later this week
storage/maria/ma_pagecache.c:
Fixed portability issue with comparing thread id
Fixed bug where return value 'error' was not set in case of error
Added support for delete by link.
Aded level ("hits") management functions.
storage/maria/ma_pagecache.h:
Added support for delete by link.
Aded level ("hits") management functions.
storage/maria/unittest/ma_pagecache_single.c:
Test of delete by link.
into gbichot4.local:/home/mysql_src/mysql-maria-monty
mysql-test/t/maria-recovery.test:
Auto merged
storage/maria/ha_maria.cc:
Auto merged
storage/maria/ma_loghandler.c:
Auto merged
storage/maria/ma_pagecache.c:
Auto merged
command-line" and BUG#34062 "Maria table corruption on master".
Use 5 bytes (instead of 4) to store page's number in the checkpoint
record, to allow bigger table (1PB with maria-block-size=1kB).
Help pushbuild not run out of memory by moving the portion of
maria-recovery.test which generates lots of data into a -big.test.
mysql-test/r/maria-recovery.result:
result moved
mysql-test/t/maria-recovery.test:
piece which generates much data moved to maria-recovery-big.test
mysys/my_pread.c:
To fix BUG#34062, where a 1.1TB file was generated due to a wrong
pwrite offset, it was useful to not lose precision on 'offset' in
DBUG_PRINT, so that the crazy value is visible.
mysys/my_read.c:
To fix BUG#34062, where a 1.1TB file was generated due to a wrong
pwrite offset, it was useful to not lose precision on 'offset' in
DBUG_PRINT, so that the crazy value is visible.
mysys/my_write.c:
To fix BUG#34062, where a 1.1TB file was generated due to a wrong
pwrite offset, it was useful to not lose precision on 'offset' in
DBUG_PRINT, so that the crazy value is visible.
storage/maria/ha_maria.cc:
When starting a bulk insert, we throw away dirty index pages from the
cache. Unique (non disabled) key insertions thus read out-of-date
pages from the disk leading to BUG#34062 "Maria table corruption on
master": a DELETE in procedure viewer_sp() had deleted all rows of
viewer_tbl2 one by one, putting index page 1 into key_del; that page
was thrown away at start of INSERT SELECT, then the INSERT SELECT
needed a page to insert keys, looked at key_del, found 1, read page 1
from disk, and its out-of-date content was used to set the new value of
key_del (crazy value of 1TB), then a later insertion needed another
index page, tried to read page at this crazy offset and failed, leading
to corruption mark.
The fix is to destroy out-of-date pages and make the state consistent
with that, i.e. call maria_delete_all_rows().
storage/maria/ma_blockrec.c:
Special hook for UNDO_BULK_INSERT
storage/maria/ma_blockrec.h:
special hook for UNDO_BULK_INSERT
storage/maria/ma_check.c:
Fix for BUG#34114 "maria_chk reports false error when several tables on
command-line": if the Nth (on the command line) table was BLOCK_RECORD
it would start checks by using the param->record_checksum computed by
checks of table N-1.
storage/maria/ma_delete_all.c:
comment
storage/maria/ma_loghandler.c:
special hook for UNDO_BULK_INSERT
storage/maria/ma_page.c:
comment
storage/maria/ma_pagecache.c:
page number is 5 bytes in checkpoint record now (allows bigger tables)
storage/maria/ma_recovery.c:
page number is 5 bytes in checkpoint record now
storage/maria/ma_recovery_util.c:
page number is 5 bytes now
storage/maria/ma_write.c:
typo
mysql-test/r/maria-recovery-big.result:
result is correct
mysql-test/t/maria-recovery-big-master.opt:
usual options for recovery tests
mysql-test/t/maria-recovery-big.test:
Moving out the big blob test to a -big test (it exhausts memory when
using /dev/shm on certain machines)
(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
- 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
and casts if not.
Add optional WITH_MARIA_TMP_TABLES parameter to configure.js. This
parameter defaults to true, if WITH_MARIA_STORAGE_ENGINE is present.
CMakeLists.txt:
Add WITH_MARIA_TMP_TABLES config parameter.
storage/maria/ma_blockrec.c:
Fix windows warning - use the correct datatype.
storage/maria/ma_loghandler.c:
Fix windows warnings by adding casts.
storage/maria/ma_pagecache.c:
Fix windows warning - use the correct datatype.
storage/maria/ma_recovery.c:
Fix windows warning by adding casts.
win/configure.js:
Add WITH_MARIA_TMP_TABLES. If WITH_MARIA_STORAGE_ENGINE is present,
it defaults to TRUE. To unset, pass WITH_MARIA_TMP_TABLES=FALSE to
configure.js
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
into mysql.com:/home/my/mysql-maria
sql/mysqld.cc:
Auto merged
storage/maria/ma_check.c:
Auto merged
storage/maria/ma_create.c:
Auto merged
storage/maria/ma_recovery.c:
Auto merged
storage/maria/ma_test2.c:
Auto merged
storage/maria/maria_def.h:
Auto merged
storage/maria/maria_pack.c:
Auto merged
storage/myisam/mi_test2.c:
Auto merged
storage/maria/ma_pagecache.c:
Auto merged
storage/maria/ha_maria.cc:
Manual (trival) merge
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
storage/maria/ma_pagecache.c:
Change mode to -rw-rw-r--
storage/maria/ma_open.c:
ignore 'moved' state if requested
storage/maria/maria_pack.c:
ignore 'moved' state in maria_open()
storage/maria/unittest/ma_test_all-t:
avoid a warning if $output is undefined
storage/maria/ma_pagecache.c:
Support of unpinning unlocked file.
storage/maria/unittest/ma_pagecache_single.c:
Fixed layout.
Added test of new schema of using pagecache:
unlocking without unpinning.
- 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
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
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
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
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
* 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
- 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 *
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.
* 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.
Don't give warnings when opening a wrong control file in ma_control_file_t (unit test)
BitKeeper/deleted/.del-ma_key_redo.c:
Delete: storage/maria/ma_key_redo.c
storage/maria/ma_blockrec.c:
Don't give warnings when reading blocks when we know the block may not exist
storage/maria/ma_pagecache.c:
Keep a convinience copy of readwrite_flags
storage/maria/ma_pagecache.h:
Keep a convinience copy of readwrite_flags
storage/maria/unittest/ma_control_file-t.c:
Don't give warnings when opening a wrong control file
Added debugger hook _my_dbug_put_break_here() that is called if we get a CRC that matches --debug-crc-break (my_crc_dbug_break)
Fixed REDO_REPAIR to use all repair modes (repair, repair_by_sort, repair_paralell
REDO_REPAIR now also logs used key map
Fixed some bugs in REDO logging of key pages
Better error messages from maria_read_log
Added my_readwrite_flags to init_pagecache() to be able to get better error messages and simplify code.
Don't allow pagecaches with less than 8 blocks (Causes strange crashes)
Added EXTRA_DEBUG_KEY_CHANGES. When this is defined some REDO_INDEX entries contains page checksums (these are calculated and checked in DBUG mode, ignored otherwise)
Fixed bug in ma_pagecache unit tests that caused program to sometimes fail
Added some missing calls to MY_INIT() that caused some unit tests to fail
Fixed that TRUNCATE works properly on temporary MyISAM files
Updates some result files to new table checksums results (checksum when NULL fields are ignored)
perl test-insert can be replayed with maria_read_log!
sql/share/Makefile.am:
Change mode to -rw-rw-r--
BitKeeper/etc/ignore:
added storage/maria/unittest/page_cache_test_file_1 storage/maria/unittest/pagecache_debug.log
include/maria.h:
Added maria_tmpdir
include/my_base.h:
Added error HA_ERR_FILE_TOO_SHORT
include/my_sys.h:
Added variable my_crc_dbug_check
Added function my_dbug_put_break_here()
include/myisamchk.h:
Added org_key_map (Needed for writing REDO record for REPAIR)
mysql-test/r/innodb.result:
Updated to new checksum algorithm (NULL ignored)
mysql-test/r/mix2_myisam.result:
Updated to new checksum algorithm (NULL ignored)
mysql-test/r/myisam.result:
Updated to new checksum algorithm (NULL ignored)
mysql-test/t/myisam.test:
Added used table
mysys/checksum.c:
Added DBUG for checksum results
Added debugger hook so that _my_dbug_put_break_here() is called if we get matching CRC
mysys/lf_alloc-pin.c:
Fixed compiler warning
mysys/my_handler.c:
Added new error message
mysys/my_init.c:
If my_progname is not given, use 'unknown' form my_progname_short
Added debugger function my_debug_put_break_here()
mysys/my_pread.c:
In case of too short file when MY_NABP or MY_FNABP is specified, give error HA_ERR_FILE_TO_SHORT
mysys/my_read.c:
In case of too short file when MY_NABP or MY_FNABP is specified, give error HA_ERR_FILE_TO_SHORT
sql/mysqld.cc:
Added debug option --debug-crc-break
sql/sql_parse.cc:
Trivial optimization
storage/maria/ha_maria.cc:
Renamed variable to be more logical
Ensure that param.testflag is correct when calling repair
Added extra argument to init_pagecache
Set default value for maria_tempdir
storage/maria/ma_blockrec.c:
Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/maria/ma_cache.c:
Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/maria/ma_check.c:
Set param->testflag to match how repair is run (needed for REDO logging)
Simple optimization
Moved flag if page is node from pagelength to keypage-flag byte
Log used key map in REDO log.
storage/maria/ma_delete.c:
Remember previous UNDO entry when writing undo (for future CLR records)
Moved flag if page is node from pagelength to keypage-flag byte
Fixed some bugs in redo logging
Added CRC for some translog REDO_INDEX entries
storage/maria/ma_dynrec.c:
Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/maria/ma_ft_update.c:
Fixed call to _ma_store_page_used()
storage/maria/ma_key_recover.c:
Added CRC for some translog REDO_INDEX entries
Removed not needed pagecache_write() in _ma_apply_redo_index()
storage/maria/ma_locking.c:
Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/maria/ma_loghandler.c:
Added used key map to REDO_REPAIR_TABLE
storage/maria/ma_loghandler.h:
Added operation for checksum of key pages
storage/maria/ma_open.c:
Allocate storage for undo lsn pointers
storage/maria/ma_pagecache.c:
Remove not needed include file
Change logging to use fd: for file descritors as other code
Added my_readwrite_flags to init_pagecache() to be able to get better error messages for maria_chk/maria_read_log
Don't allow pagecaches with less than 8 blocks
Remove wrong DBUG_ASSERT()
storage/maria/ma_pagecache.h:
Added readwrite_flags
storage/maria/ma_recovery.c:
Better error messages for maria_read_log:
- Added eprint() for printing error messages
- Print extra \n before error message if we are printing %0 %10 ...
Added used key_map to REDO_REPAIR log entry
More DBUG
Call same repair method that was used by mysqld
storage/maria/ma_rt_index.c:
Moved flag if page is node from pagelength to keypage-flag byte
storage/maria/ma_rt_key.c:
Fixed call to _ma_store_page_used()
storage/maria/ma_rt_split.c:
Moved flag if page is node from pagelength to keypage-flag byte
storage/maria/ma_static.c:
Added maria_tmpdir
storage/maria/ma_test1.c:
Updated call to init_pagecache()
storage/maria/ma_test2.c:
Updated call to init_pagecache()
storage/maria/ma_test3.c:
Updated call to init_pagecache()
storage/maria/ma_write.c:
Removed #ifdef NOT_YET
Moved flag if page is node from pagelength to keypage-flag byte
Fixed bug in _ma_log_del_prefix()
storage/maria/maria_chk.c:
Fixed wrong min limit for page_buffer_size
Updated call to init_pagecache()
storage/maria/maria_def.h:
Added EXTRA_DEBUG_KEY_CHANGES. When this is defined some REDO_INDEX entries contains page checksums
Moved flag if page is node from pagelength to keypage-flag byte
storage/maria/maria_ftdump.c:
Updated call to init_pagecache()
storage/maria/maria_pack.c:
Updated call to init_pagecache()
Reset share->state.create_rename_lsn & share->state.is_of_horizon
storage/maria/maria_read_log.c:
Better error messages
Added --tmpdir option (needed to set temporary directory for REDO_REPAIR)
Added --start-from-lsn
Changed option for --display-only to 'd' (wanted to use -o for 'offset')
storage/maria/unittest/lockman2-t.c:
Added missing call to MY_INIT()
storage/maria/unittest/ma_pagecache_consist.c:
Updated call to init_pagecache()
storage/maria/unittest/ma_pagecache_single.c:
Fixed bug that caused program to sometimes fail
Added some DBUG_ASSERTS()
Changed some calls to malloc()/free() to my_malloc()/my_free()
Create extra file to expose original hard-to-find bug
storage/maria/unittest/ma_test_loghandler-t.c:
Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
Updated call to init_pagecache()
storage/maria/unittest/ma_test_loghandler_purge-t.c:
Updated call to init_pagecache()
storage/maria/unittest/test_file.c:
Changed malloc()/free() to my_malloc()/my_free()
Fixed memory leak
Changd logic a bit while trying to find bug in reset_file()
storage/maria/unittest/trnman-t.c:
Added missing call to MY_INIT()
storage/myisam/mi_cache.c:
Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/myisam/mi_create.c:
Removed O_EXCL to get TRUNCATE to work for temporary files
storage/myisam/mi_dynrec.c:
Test for HA_ERR_FILE_TOO_SHORT instead for -1
storage/myisam/mi_locking.c:
Test for HA_ERR_FILE_TOO_SHORT instead for -1
mysql-test/r/old-mode.result:
New BitKeeper file ``mysql-test/r/old-mode.result''
mysql-test/t/old-mode-master.opt:
New BitKeeper file ``mysql-test/t/old-mode-master.opt''
mysql-test/t/old-mode.test:
New BitKeeper file ``mysql-test/t/old-mode.test''
into mysql.com:/home/my/mysql-maria
include/my_sys.h:
Auto merged
sql/mysqld.cc:
Auto merged
storage/maria/ma_checkpoint.c:
Auto merged
storage/maria/ma_pagecache.c:
Auto merged
storage/maria/ma_pagecache.h:
Auto merged
storage/maria/maria_chk.c:
Auto merged
storage/maria/ma_recovery.c:
SCCS merged
New extendable format for maria_log_control file
Fixed some compiler warnings
include/maria.h:
Added maria_disable_logging() and maria_enable_logging()
mysql-test/include/maria_verify_recovery.inc:
Updated tests now when key redo/undo works
mysql-test/r/maria-recovery.result:
Updated tests now when key redo/undo works
storage/maria/ma_blockrec.c:
Use unified CLR code
Added rec_lsn for full pages
Moved clr write hook to ma_key_recover.c
Changed REDO code to keep pages pinned until undo
Mark page_link's as changed
storage/maria/ma_blockrec.h:
Moved write_hook_for_clr_end() to ma_key_recover.c
storage/maria/ma_check.c:
Changed key check code to use PAGECACHE_READ_UNKNOWN_PAGE
Fixed wrong warning when checking files after maria_pack
When unpacking files, we have to use new keypos_to_recpos method
When doing repair, we can disregard index key file pages in page cache
storage/maria/ma_commit.c:
Added simple enable/disable logging functions
(Needed for recovery)
storage/maria/ma_control_file.c:
Make maria control file extendable without having to make it incompatible for older versions
storage/maria/ma_control_file.h:
New error messages
Added CONTROL_FILE_VERSION
storage/maria/ma_delete.c:
Added redo/undo for key pages
change_length -> changed_length to make things similar
More comments & more DBUG
storage/maria/ma_key_recover.c:
Unified CLR method
Moved here write_hook_for_clr_end() and common keypage log functions
Changed REDO to keep pages pinned until undo
Changed UNDO code to change key_root under log mutex
storage/maria/ma_key_recover.h:
New structures and functions
storage/maria/ma_loghandler.c:
Include needed files
storage/maria/ma_open.c:
Change maria_open() to use pread() instead of read()
storage/maria/ma_page.c:
Fixed bug in key_del handling
Clear pages if IDENTICAL_PAGES_AFTER_RECOVERY is defined
storage/maria/ma_pagecache.c:
Indentation and spelling fixes
More DBUG
Added helper function: pagecache_block_link_to_buffer()
storage/maria/ma_pagecache.h:
Added pagecache_block_link_to_buffer()
storage/maria/ma_recovery.c:
Fixed state.changed
Fixed that REDO keeps pages pinned until UNDO
Some bug fixes from previous commit
Fixes for UNDO/REDO of key pages
storage/maria/ma_search.c:
Fixed packing and storing of keys to provide more information to caller so
that we can do efficent REDO logging of the changes.
storage/maria/ma_test1.c:
Fixed bug with not initialized variable
storage/maria/ma_test2.c:
Removed not used code
storage/maria/ma_test_all.res:
Updated results
storage/maria/ma_test_all.sh:
Changed one test to test more
Removed timing tests as not relevant here
storage/maria/ma_test_recovery.expected:
Updated test result after redo/undo if key pages works
storage/maria/ma_test_recovery:
Updated test after redo/undo if key pages works
storage/maria/ma_write.c:
Moved some general log functions to ma_key_recover.c
Fixed some bugs in undo
Moved ma_log_split() to _ma_split_page()
Small changes in some function arguments to be able to do redo logging
storage/maria/maria_chk.c:
disable logging while doing repair table
storage/maria/maria_def.h:
New function prototypes
Move some structs and functions to ma_key_recover.c
storage/maria/unittest/ma_control_file-t.c:
Updated with patch from Sanja
NOTE: This is not complete and need to be updated to new control file format
storage/maria/unittest/ma_test_loghandler-t.c:
Fixed compiler warning
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
Added key_nr to st_maria_keydef for faster keyinfo->keynr conversion
For transactional tables, shift record number in keys up with 1 bit to have place to indicate if transid follows
Checksum for MyISAM now ignores NULL and not used part of VARCHAR
Renamed some variables that caused shadow compiler warnings
Moved extra() call when waiting for tables to not be used to after tables are removed from cache.
Fixed crashing bugs when using Maria TEMPORARY tables with TRUNCATE. Removed 'hack' code in sql directory to go around this bug.
pagecache_unlock_by_ulink() now has extra argument to say if page was changed.
Give error message if we fail to open control file
Mark page cache variables as not flushable
include/maria.h:
Made min page cache larger (needed for pinning key page)
Added key_nr to st_maria_keydef for faster keyinfo->keynr conversion
Added write_comp_flag to move some runtime code to maria_open()
include/my_base.h:
Added new error message to be used when handler initialization failed
include/my_global.h:
Renamed dummy to swap_dummy to avoid conflicts with local 'dummy' variables
include/my_handler.h:
Added const to some parameters
mysys/array.c:
More DBUG
mysys/my_error.c:
Fixed indentation
mysys/my_handler.c:
Added const to some parameters
Added missing error messages
sql/field.h:
Renamed variables to avoid variable shadowing
sql/handler.h:
Renamed parameter to avoid variable name conflict
sql/item.h:
Renamed variables to avoid variable shadowing
sql/log_event_old.h:
Renamed variables to avoid variable shadowing
sql/set_var.h:
Renamed variables to avoid variable shadowing
sql/sql_delete.cc:
Removed maria hack for temporary tables
Fixed indentation
sql/sql_table.cc:
Moved extra() call when waiting for tables to not be used to after tables are removed from cache.
This was needed to ensure we don't do a PREPARE_FOR_DROP or similar call while the table is still in use.
sql/table.cc:
Copy page_checksum from share
Removed Maria hack
storage/maria/Makefile.am:
Added new files
storage/maria/ha_maria.cc:
Renamed records -> record_count and info -> create_info to avoid variable name conflicts
Mark page cache variables as not flushable
storage/maria/ma_blockrec.c:
Moved _ma_unpin_all_pages() to ma_key_recover.c
Moved init of info->pinned_pages to ma_open.c
Moved _ma_finalize_row() to maria_key_recover.h
Renamed some variables to avoid variable name conflicts
Mark page_link.changed for blocks we change directly
Simplify handling of undo link when writing LOGREC_UNDO_ROW_INSERT (old code crashed when having redo for index)
storage/maria/ma_blockrec.h:
Removed extra empty line
storage/maria/ma_checkpoint.c:
Remove not needed trnman.h
storage/maria/ma_close.c:
Free pinned pages (which are now always allocated)
storage/maria/ma_control_file.c:
Give error message if we fail to open control file
storage/maria/ma_delete.c:
Changes for redo logging (first part, logging of underflow not yet done)
- Log undo-key-delete
- Log delete of key
- Updated arguments to _ma_fetch_keypage(), _ma_dispose(), _ma_write_keypage(), _ma_insert()
- Added new arguments to some functions to be able to write redo information
- Mark key pages as changed when we write with PAGECACHE_LOCK_LEFT_WRITELOCKED
Remove one not needed _ma_write_keypage() in d_search() when upper level will do the write anyway
Changed 2 bmove_upp() to bmove() as this made code easer to understand
More function comments
Indentation fixes
storage/maria/ma_ft_update.c:
New arguments to _ma_write_keypage()
storage/maria/ma_loghandler.c:
Fixed some DBUG_PRINT messages
Simplify code
Added new log entrys for key page redo
Renamed some variables to avoid variable name shadowing
storage/maria/ma_loghandler.h:
Moved some defines here
Added define for storing key number on key pages
Added new translog record types
Added enum for type of operations in LOGREC_REDO_INDEX
storage/maria/ma_open.c:
Always allocate info.pinned_pages (we need now also for normal key page usage)
Update keyinfo->key_nr
Added virtual functions to convert record position o number to be stored on key pages
Update keyinfo->write_comp_flag to value of search flag to be used when writing key
storage/maria/ma_page.c:
Added redo for key pages
- Extended _ma_fetch_keypage() with type of lock to put on page and address to used MARIA_PINNED_PAGE
- _ma_fetch_keypage() now pin's pages if needed
- Extended _ma_write_keypage() with type of locks to be used
- ma_dispose() now locks info->s->state.key_del from other threads
- ma_dispose() writes redo log record
- ma_new() locks info->s->state.key_del from other threads if it was used
- ma_new() now pins read page
Other things:
- Removed some not needed arguments from _ma_new() and _ma_dispose)
- Added some new variables to simplify code
- If EXTRA_DEBUG is used, do crc on full page to catch not unitialized bytes
storage/maria/ma_pagecache.h:
Applied patch from Sanja to add extra argument to pagecache_unlock_by_ulink() to mark if page was changed
Added some defines for pagecache priority levels that one can use
storage/maria/ma_range.c:
Added new arguments for call to _ma_fetch_keypage()
storage/maria/ma_recovery.c:
- Added hooks for new translog types:
REDO_INDEX, REDO_INDEX_NEW_PAGE, REDO_INDEX_FREE_PAGE, UNDO_KEY_INSERT, UNDO_KEY_DELETE and
UNDO_KEY_DELETE_WITH_ROOT.
- Moved variable declarations to start of function (portability fixes)
- Removed some not needed initializations
- Set only relevant state changes for each redo/undo entry
storage/maria/lockman.c:
Removed end space
storage/maria/ma_check.c:
Removed end space
storage/maria/ma_create.c:
Removed end space
storage/maria/ma_locking.c:
Removed end space
storage/maria/ma_packrec.c:
Removed end space
storage/maria/ma_pagecache.c:
Removed end space
storage/maria/ma_panic.c:
Removed end space
storage/maria/ma_rt_index.c:
Added new arguments for call to _ma_fetch_keypage(), _ma_write_keypage(), _ma_dispose() and _ma_new()
Fixed indentation
storage/maria/ma_rt_key.c:
Added new arguments for call to _ma_fetch_keypage()
storage/maria/ma_rt_split.c:
Added new arguments for call to _ma_new()
Use new keypage header
Added new arguments for call to _ma_write_keypage()
storage/maria/ma_search.c:
Updated comments & indentation
Added new arguments for call to _ma_fetch_keypage()
Made some variables and arguments const
Added virtual functions for converting row position to number to be stored in key
use MARIA_RECORD_POS of record position instead of my_off_t
Record in MARIA_KEY_PARAM how page was changed one key insert (needed for REDO)
storage/maria/ma_sort.c:
Removed end space
storage/maria/ma_statrec.c:
Updated arguments for call to _ma_rec_pos()
storage/maria/ma_test1.c:
Fixed too small buffer to init_pagecache()
Fixed bug when using insert_count and test_flag
storage/maria/ma_test2.c:
Use more resonable pagecache size
Remove not used code
Reset blob_length to fix wrong output message
storage/maria/ma_test_all.sh:
Fixed wrong test
storage/maria/ma_write.c:
Lots of new code to handle REDO of key pages
No logic changes because of REDO code, mostly adding new arguments and adding new code for logging
Added new arguments for calls to _ma_fetch_keypage(), _ma_write_keypage() and similar functions
Move setting of comp_flag in ma_ck_wrte_btree() from runtime to maria_open()
Zerofill new used pages for:
- To remove possible sensitive data left in buffer
- To get idenitical data on pages after running redo
- Better compression of pages if archived
storage/maria/maria_chk.c:
Added information if table is crash safe
storage/maria/maria_def.h:
New virtual function to convert between record position on key and normal record position
Aded mutex and extra variables to handle locking of share->state.key_del
Moved some structure variables to get things more aligned
Added extra arguments to MARIA_KEY_PARAM to be able to remember what was changed on key page on key insert
Added argument to MARIA_PINNED_PAGE to indicate if page was changed
Updated prototypes for functions
Added some structures for signaling changes in REDO handling
storage/maria/unittest/ma_pagecache_single.c:
Updated arguments for changed function calls
storage/myisam/mi_check.c:
Made calc_check_checksum virtual
storage/myisam/mi_checksum.c:
Update checksums to ignore null columns
storage/myisam/mi_create.c:
Mark if table has null column (to know when we have to use mi_checksum())
storage/myisam/mi_open.c:
Added virtual function for calculating checksum to be able to easily ignore NULL fields
storage/myisam/mi_test2.c:
Fixed bug
storage/myisam/myisamdef.h:
Added virtual function for calculating checksum during check table
Removed ha_key_cmp() as this is in handler.h
storage/maria/ma_key_recover.c:
New BitKeeper file ``storage/maria/ma_key_recover.c''
storage/maria/ma_key_recover.h:
New BitKeeper file ``storage/maria/ma_key_recover.h''
storage/maria/ma_key_redo.c:
New BitKeeper file ``storage/maria/ma_key_redo.c''
See test maria-recovery.test for a model; all include scripts have
an "API" section at start if they do take parameters from outside.
* Fixing bug reported by Jani and Monty (when two REDOs about the same
page in one group, see ma_blockrec.c).
* Fixing small bugs in recovery
mysql-test/include/wait_until_connected_again.inc:
be sure to enter the loop (the previous query by the caller may not have
failed: it could be
query;
mysqladmin shutdown;
call this script).
mysql-test/lib/mtr_process.pl:
* Through the "expect" file a test can tell mtr that a server crash
is expected. What the file contains is irrelevant. Now if its last
line starts with "wait", mtr will wait before restarting (it will
wait for the last line to not start with "wait"). This is for
tests which need to mangle files under the feet of a dead mysqld.
* Remove "expect" file before restarting; otherwise there could be a
race condition: tests sees server restarted, does something, writes
an "expect" file, and then mtr removes that file, then
test kills mysqld, and then mtr will never restart it.
storage/maria/ma_blockrec.c:
- when applying a REDO in recovery, we don't anymore put UNDO's LSN on the page
at once; indeed if in this REDO's group there comes another REDO
for the same page it would be wrongly skipped. Instead, we keep
pages pinned, don't change their LSN. When done with all REDOs
of the group we unpin them and stamp them with UNDO's LSN.
- fixing bug in applying of REDO_PURGE_BLOCKS in recovery: page_range
sometimes has TAIL_BIT set, need to turn it down to know the real page
range.
- Both bugs are covered in maria-recovery.test
storage/maria/ma_checkpoint.c:
Capability to, in debug builds only, do some special operations
(flush all bitmap and data pages, flush state, flush log)
and crash mysqld, to later test recovery.
Driven by some --debug=d, symbols.
storage/maria/ma_open.c:
debugging info
storage/maria/ma_pagecache.c:
Now that we can _ma_unpin_all_pages() during the REDO phase
to set page's LSN, the assertion needs to be relaxed.
storage/maria/ma_recovery.c:
- open trace file in append mode (useful when a test triggers several
recoveries, we see them all).
- fixing wrong error detection, it's possible that during recovery
we want to open an already open table.
- when applying a REDO in recovery, we don't anymore put UNDO's LSN on the page
at once; indeed if in this REDO's group there comes another REDO
for the same page it would be wrongly skipped. Instead, we keep
pages pinned, don't change their LSN. When done with all REDOs
of the group we unpin them and stamp them with UNDO's LSN.
- we verify that all log records of a group are about the same table,
for debugging.
mysql-test/r/maria-recovery.result:
result
mysql-test/t/maria-recovery-master.opt:
crash is expected, core file would take room, stack trace would
wake pushbuild up.
mysql-test/t/maria-recovery.test:
Test of recovery from mysql-test (it is already tested as unit tests
in ma_test_recovery) (WL#4137)
- test that, if recovery is made to start on an empty table it can
replay the effects of committed and uncommitted statements (having only
the committed ones in the end result). This should be the first test
for someone writing code of new REDOs.
- test that, if mysqld is crashed and recovery runs we have only
committed statements in the end result. Crashes are done in different
ways: flush nothing (so, uncommitted statement is often missing
from the log => no rollback to do); flush pagecache (implicitely flushes
log (WAL)) and flush log, both causes rollbacks; flush log can also
flush state (state.records etc) to test recovery of the state
(not tested well now as we repair the index anyway).
- test of bug found by Jani and Monty in recovery (two REDO about
the same page in one group).
mysql-test/include/maria_empty_logs.inc:
removes logs, to have a clean sheet for testing recovery.
mysql-test/include/maria_make_snapshot.inc:
copies a table to another directory, or back, or compares both
(comparison is not implemented as physical comparison is impossible
if an UNDO phase happened).
mysql-test/include/maria_make_snapshot_for_comparison.inc:
copies tables to another directory so that they can later
serve as a comparison reference (they are the good tables,
recovery should produce similar ones).
mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc:
When we want to force recovery to start on old tables, we prepare
old tables with this script: we put them in a spare directory.
They are later copied back over mysqltest tables while mysqld is dead.
We also need to copy back the control file, otherwise mysqld,
in recovery, would start from the latest checkpoint: latest
checkpoint plus old tables is not a recovery-possible scenario of course.
mysql-test/include/maria_verify_recovery.inc:
causes mysqld to crash, restores old tables if requested,
lets recovery run, compares resulting tables with reference tables
by using CHECKSUM TABLE.
We don't do any sanity checks on page's LSN in resulting tables, yet.
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
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
- serializing calls to flush_pagecache_blocks_int() on the same file
to avoid known concurrency bugs
- having that, we can now enable the background thread, as the
flushes it does are now supposedly safe in concurrent situations.
- new type of flush FLUSH_KEEP_LAZY: when the background checkpoint
thread is flushing a packet of dirty pages between two checkpoints,
it uses this flush type, indeed if a file is already being flushed
by another thread it's smarter to move on to the next file than wait.
- maria_checkpoint_frequency renamed to maria_checkpoint_interval.
include/my_sys.h:
new type of flushing for the page cache: FLUSH_KEEP_LAZY
mysql-test/r/maria.result:
result update
mysys/mf_keycache.c:
indentation. No FLUSH_KEEP_LAZY support in key cache.
storage/maria/ha_maria.cc:
maria_checkpoint_frequency was somehow a hidden part of the
Checkpoint API and that was not good. Now we have checkpoint_interval,
local to ha_maria.cc, which serves as container for the user-visible
maria_checkpoint_interval global variable; setting it calls
update_checkpoint_interval which passes the new value to
ma_checkpoint_init(). There is no hiding anymore.
By default, enable background thread which does checkpoints
every 30 seconds, and dirty page flush in between. That thread takes
a checkpoint when it ends, so no need for maria_hton_panic to take one.
The | is | and not ||, because maria_panic() must always be called.
frequency->interval.
storage/maria/ma_checkpoint.c:
Use FLUSH_KEEP_LAZY for background thread when it flushes packets of
dirty pages between two checkpoints: it is smarter to move on to
the next file than wait for it to have been completely flushed, which
may take long.
Comments about flush concurrency bugs moved from ma_pagecache.c.
Removing out-of-date comment.
frequency->interval.
create_background_thread -> (interval>0).
In ma_checkpoint_background(), some variables need to be preserved
between iterations.
storage/maria/ma_checkpoint.h:
new prototype
storage/maria/ma_pagecache.c:
- concurrent calls of flush_pagecache_blocks_int() on the same file
cause bugs (see @note in that function); we fix them by serializing
in this situation. For that we use a global hash of (file, wqueue).
When flush_pagecache_blocks_int() starts it looks into the hash,
using the file as key. If not found, it inserts (file,wqueue) into the
hash, flushes the file, and finally removes itself from the hash and
wakes up any waiter in the queue. If found, it adds itself to the
wqueue and waits.
- As a by-product, we can remove changed_blocks_is_incomplete
and replace it by scanning the hash, replace the sleep() by a queue wait.
- new type of flush FLUSH_KEEP_LAZY: when flushing a file, if it's
already being flushed by another thread (even partially), return
immediately.
storage/maria/ma_pagecache.h:
In pagecache, a hash of files currently being flushed (i.e. there
is a call to flush_pagecache_blocks_int() for them).
storage/maria/ma_recovery.c:
new prototype
storage/maria/ma_test1.c:
new prototype
storage/maria/ma_test2.c:
new prototype
Ability for flush_pagecache_blocks() to flush only certain pages of
a file, as instructed by an option "filter" pointer-to-function argument;
Checkpoint and background dirty page flushing use that to flush only
pages which have been dirty for long enough and bitmap pages.
Fix for a bug in flush_cached_blocks() (no idea if it could produce
a bug in real life, but theoretically it is).
Testing checkpoint in ma_test_recovery via ma_test1 and ma_test2.
Background checkpoint & dirty pages flush thread is still disabled
by default in ha_maria.
mysql-test/r/maria.result:
result update
storage/maria/ha_maria.cc:
blank after function comment
storage/maria/ma_checkpoint.c:
Using an enum instead of 0/1/2 (applying Sanja's review comments).
The comment about "this is an horizon" can be removed as Sanja
created translog_next_LSN() which parse_checkpoint_record() uses.
Variables in ma_checkpoint_background() cannot be declared in the
for() as their value must not be reset at each iteration!
storage/maria/ma_pagecache.c:
adding to flush_pagecache_blocks() optional arguments 'filter'
(pointer to function) and 'filter_arg'; if filter!=NULL this function
will be called for each block of the file and will reply if this
block and following ones should be flushed or not (3 possible
replies).
Fixing a bug when flush_cached_blocks() skips a pinned page: it has
to unset PCBLOCK_IN_FLUSH set by flush_pagecache_blocks_int().
storage/maria/ma_pagecache.h:
flush_pagecache_blocks() is changed to take "filter" and "filter_arg"
arguments. "filter", if it is not NULL, may return one value
among enum pagecache_flush_filter_result.
storage/maria/ma_recovery.c:
open_count=0 when closing tables at the end of recovery.
storage/maria/ma_test1.c:
Optional checkpoints (-H#) at various stages (stages similar
to --testflag), for testing of checkpoints.
storage/maria/ma_test2.c:
Optional checkpoints (-H#) at various stages (stages similar
to -t), for testing of checkpoints.
storage/maria/ma_test_recovery.expected:
Result update: the results of the additional test run with -H#
(checkpoints) are added here. They are exactly identical to without
checkpoints except that the index's Root (printed by maria_chk)
is more correct when using checkpoints. This is because checkpoint
flushed the state, so it happens to be correct, while no-checkpoint
does not flush the state, and recovery does not recover indexes
so Root is never fixed. When we recover indices, this will go away.
storage/maria/ma_test_recovery:
We duplicate the loop of tests to add an additional run with
checkpoints at various stages, to see if maria_read_log
uses them fine.
- fixes (in recovery, checkpoint, log handler) of bugs found
during testing.
- new option --check for maria_read_log: with --only-display (which only
reads the header) it reads the full record, for debugging.
storage/maria/ma_loghandler.c:
importing patch from Sanja for bug of translog_next_LSN() found
during recovery
storage/maria/ma_loghandler_lsn.h:
better types (0L is 4 bytes on some platforms, it causes problems
when used into lsn_store(): right shift >= width of type.
storage/maria/ma_pagecache.c:
work around infamous "PAGECACHE_PLAIN_PAGE used for transactional
tables in specialm case"; REDO phase disables logging and this causes
pages to be PAGECACHE_PLAIN_PAGE, thus ignored wrongly by the
checkpoint taken at the end of the REDO phase.
storage/maria/ma_recovery.c:
- a #ifdef which broke maria_read_log in non-debug builds (no output!)
- support for maria_read_log --check
- detect record corruption before opening the table
- updating is_of_horizon requires writing the state
- fix for wrong parsing of checkpoint record by recovery
storage/maria/ma_recovery.h:
support for maria_read_log --check
storage/maria/maria_read_log.c:
Option --check: --only-display only looks at the header;
adding --check tries a translog_read_record() to see if record can
be fully read (this is to find bugs).
Debug output information fixed.
Fixed direct page referencing in write mode.
storage/maria/ma_loghandler.c:
TODO added.
storage/maria/ma_pagecache.c:
Debug output information fixed.
Fixed direct page referencing in write mode.
storage/maria/ma_pagecache.c:
pagecache->blocks is now long, takes 8 bytes on some platforms.
The cast to ulonglong in int8store is for those platforms where
ulong is 32-bit and int8store uses some << shifts, if there are
(x<<40 is undefined if x is 32-bit).
storage/maria/ma_recovery.c:
this change corresponds to the one done in ma_pagecache.c: number
of dirty pages is stored in 8 bytes.
* Recovery of the table's live checksum (CREATE TABLE ... CHECKSUM=1)
is achieved in this patch. The table's live checksum
(info->s->state.state.checksum) is updated in inwrite_rec_hook's
under the log mutex when writing UNDO_ROW_INSERT|UPDATE|DELETE
and REDO_DELETE_ALL. The checksum variation caused by the operation
is stored in these UNDOs, so that the REDO phase, when it sees such
UNDOs, can update the live checksum if it is older (state.is_of_lsn is
lower) than the record. It is also used, as a nice add-on with no
cost, to do less row checksum computation during the UNDO phase
(as we have it in the record already).
Doing this work, it became pressing to move in-write hooks
(write_hook_for_redo() et al) to ma_blockrec.c.
The 'parts' argument of inwrite_rec_hook is unpredictable (it comes
mangled at this stage, for example by LSN compression) so it is
replaced by a 'void* hook_arg', which is used to pass down information,
currently only to write_hook_for_clr_end() (previous undo_lsn and
type of undone record).
* If from ha_maria, we print to stderr how many seconds (with one
fractional digit) the REDO phase took, same for UNDO phase and for
final table close. Just to give an indication for debugging and maybe
also for Support.
storage/maria/ha_maria.cc:
question for Monty
storage/maria/ma_blockrec.c:
* log in-write hooks (write_hook_for_redo() etc) move from
ma_loghandler.c to here; this is natural: the hooks are coupled
to their callers (functions in ma_blockrec.c).
* translog_write_record() now has a new argument "hook_arg";
using it to pass down to write_hook_for_clr_end() the transaction's
previous_undo_lsn and the type of the being undone record, and also
to pass down to all UNDOs the live checksum variation caused by the
operation.
* If table has live checksum, store in UNDO_ROW_INSERT|UPDATE|DELETE
and in CLR_END the checksum variation ("delta") caused by the
operation. For example if a DELETE caused the table's live checksum
to change from 123 to 456, we store in the UNDO_ROW_DELETE, in 4 bytes,
the value 333 (456-123).
* Instead of hard-coded "1" as length of the place where we store
the undone record's type in CLR_END, use a symbol CLR_TYPE_STORE_SIZE;
use macros clr_type_store and clr_type_korr.
* write_block_record() has a new parameter 'old_record_checksum'
which is the pre-computed checksum of old_record; that value is used
to update the table's live checksum when writing UNDO_ROW_UPDATE|CLR_END.
* In allocate_write_block_record(), if we are executing UNDO_ROW_DELETE
the row's checksum is already computed.
* _ma_update_block_record2() now expect the new row's checksum into
cur_row.checksum (was already true) and the old row's checksum into
new_row.checksum (that's new). Its two callers, maria_update() and
_ma_apply_undo_row_update(), honour this.
* When executing an UNDO_ROW_INSERT|UPDATE|DELETE in UNDO phase, pick
up the checksum delta from the log record. It is then used to update
the table's live checksum when writing CLR_END, and saves us a
computation of record.
storage/maria/ma_blockrec.h:
in-write hooks move from ma_loghandler.c
storage/maria/ma_check.c:
more straightforward size of buffer
storage/maria/ma_checkpoint.c:
<= is enough
storage/maria/ma_commit.c:
new prototype of translog_write_record()
storage/maria/ma_create.c:
new prototype of translog_write_record()
storage/maria/ma_delete.c:
The row's checksum must be computed before calling(*delete_record)(),
not after, because it must be known inside _ma_delete_block_record()
(to update the table's live checksum when writing UNDO_ROW_DELETE).
If deleting from a transactional table, live checksum was already updated
when writing UNDO_ROW_DELETE.
storage/maria/ma_delete_all.c:
@todo is now done (in ma_loghandler.c)
storage/maria/ma_delete_table.c:
new prototype of translog_write_record()
storage/maria/ma_loghandler.c:
* in-write hooks move to ma_blockrec.c.
* translog_write_record() gets a new argument 'hook_arg' which is
passed down to pre|inwrite_rec_hook. It is more useful that 'parts'
for those hooks, because when those hooks are called, 'parts' has
possibly been mangled (like with LSN compression) and is so
unpredictable.
* fix for compiler warning (unused buffer_start when compiling without
debug support)
* Because checksum delta is stored into UNDO_ROW_INSERT|UPDATE|DELETE
and CLR_END, but only if the table has live checksum, these records
are not PSEUDOFIXEDLENGTH anymore, they are now VARIABLE_LENGTH (their
length is X if no live checksum and X+4 otherwise).
* add an inwrite_rec_hook for UNDO_ROW_UPDATE, which updates the
table's live checksum. Update it also in hooks of UNDO_ROW_INSERT|
DELETE and REDO_DELETE_ALL and CLR_END.
* Bugfix: when reading a record in translog_read_record(), it happened
that "length" became negative, because the function assumed that
the record extended beyond the page's end, whereas it may be shorter.
storage/maria/ma_loghandler.h:
* Instead of hard-coded "1" and "4", use symbols and macros
to store/retrieve the type of record which the CLR_END corresponds
to, and the checksum variation caused by the operation which logs the
record
* translog_write_record() gets a new argument 'hook_arg' which is
passed down to pre|inwrite_rec_hook. It is more useful that 'parts'
for those hooks, because when those hooks are called, 'parts' has
possibly been mangled (like with LSN compression) and is so
unpredictable.
storage/maria/ma_open.c:
fix for "empty body in if() statement" (when compiling without safemutex)
storage/maria/ma_pagecache.c:
<= is enough
storage/maria/ma_recovery.c:
* print the time that each recovery phase (REDO/UNDO/flush) took;
this is enabled only when recovering from ha_maria. Is it printed
n seconds with a fractional part of one digit (like 123.4 seconds).
* In the REDO phase, update the table's live checksum by using
the checksum delta stored in UNDO_ROW_INSERT|DELETE|UPDATE and CLR_END.
Update it too when seeing REDO_DELETE_ALL.
* In the UNDO phase, when executing UNDO_ROW_INSERT, if the table does
not have live checksum then reading the record's header (as done by
the master loop of run_undo_phase()) is enough; otherwise we
do a translog_read_record() to have the checksum delta ready
for _ma_apply_undo_row_insert().
* When at the end of the REDO phase we notice that there is an unfinished
group of REDOs, don't assert in debug binaries, as I verified that it
can happen in real life (with kill -9)
* removing ' in #error as it confuses gcc3
storage/maria/ma_rename.c:
new prototype of translog_write_record()
storage/maria/ma_test_recovery.expected:
Change in output of ma_test_recovery: now all live checksums of
original tables equal those of tables recreated by the REDO phase
and those of tables fixed by the UNDO phase. I.e. recovery of
the live checksum looks like working (which was after all the only
goal of this changeset).
I checked by hand that it's not just all live checksums which are
now 0 and that's why they match. They are the old values like
3757530372. maria.test has hard-coded checksum values in its result
file so checks this too.
storage/maria/ma_update.c:
* It's useless to put up HA_STATE_CHANGED in 'key_changed',
as we put up HA_STATE_CHANGED in info->update anyway.
* We need to compute the old and new rows' checksum before calling
(*update_record)(), as checksum delta must be known when logging
UNDO_ROW_UPDATE which is done by _ma_update_block_record(). Note that
some functions change the 'newrec' record (at least _ma_check_unique()
does) so we cannot move the checksum computation too early in the
function.
storage/maria/ma_write.c:
If inserting into a transactional table, live's checksum was
already updated when writing UNDO_ROW_INSERT. The multiplication
is a trick to save an if().
storage/maria/unittest/ma_test_loghandler-t.c:
new prototype of translog_write_record()
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
new prototype of translog_write_record()
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
new prototype of translog_write_record()
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
new prototype of translog_write_record()
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
new prototype of translog_write_record()
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
new prototype of translog_write_record()
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
new prototype of translog_write_record()
storage/maria/unittest/ma_test_loghandler_purge-t.c:
new prototype of translog_write_record()
storage/myisam/sort.c:
fix for compiler warnings in pushbuild (write_merge_key* functions
didn't have their declaration match MARIA_HA::write_key).
REDO optimization (Bascily avoid moving blocks from/to pagecache)
More command line arguments to maria_read_log
Fixed recovery bug when recreating table
sql/opt_range.cc:
Remove SAFE_MODE for opt_range as it disables UPDATE to use keys
storage/maria/ma_blockrec.c:
REDO optimization
Use new interface for pagecache_reads to avoid copying page buffers
storage/maria/ma_loghandler.c:
Patch from Sanja:
- Added new parameter to translog_get_page to use direct links to pagecache
- Changed scanner to be able to use direct links
This avoids a lot of calls to bmove512() in page cache.
storage/maria/ma_loghandler.h:
Added direct link to pagecache objects
storage/maria/ma_open.c:
Added const to parameter
Added missing braces
storage/maria/ma_pagecache.c:
From Sanja:
- Added direct links to pagecache (from pagecache_read())
Dirrect link means that on pagecache_read we get back a pointer to the pagecache buffer
From Monty:
- Fixed arguments to init_page_cache to handle big page caches
- Fixed compiler warnings
- Replaced PAGECACHE_PAGE_LINK with PAGECACHE_BLOCK_LINK * to catch errors
storage/maria/ma_pagecache.h:
Changed block numbers from int to long to be able to handle big page caches
Changed some PAGECACHE_PAGE_LINK to PAGECACHE_BLOCK_LINK
storage/maria/ma_recovery.c:
Fixed recovery bug when recreating table (table was kept open)
Moved some variables to function start (portability)
Added space to some print messages
storage/maria/maria_chk.c:
key_buffer_size -> page_buffer_size
storage/maria/maria_def.h:
Changed default page_buffer_size to 10M
storage/maria/maria_read_log.c:
Added more startup options:
--version
--undo (apply undo)
--page_cache_size (to run with big cache sizes)
--silent (to not get any output from --apply)
storage/maria/unittest/ma_control_file-t.c:
Fixed compiler warning
storage/maria/unittest/ma_test_loghandler-t.c:
Added new argument to translog_init_scanner()
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
Added new argument to translog_init_scanner()
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
Added new argument to translog_init_scanner()
storage/maria/ma_checkpoint.c:
The new macro for easier printing LSN added.
storage/maria/ma_loghandler.c:
The assertion returned.
The new macro for easier printing LSN added.
storage/maria/ma_loghandler_lsn.h:
The new macro for easier printing LSN added.
storage/maria/ma_pagecache.c:
The new macro for easier printing LSN added.
storage/maria/ma_recovery.c:
Recovery checks empty log state.
RECHEADER_READ_ERROR means some real error.
storage/maria/maria_read_log.c:
Read log starts from real beggining of the log and precess
error and empty log states.
The new macro for easier printing LSN added.
storage/maria/unittest/ma_test_loghandler-t.c:
The new macro for easier printing LSN added.
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
The new macro for easier printing LSN added.
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
The new macro for easier printing LSN added.
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
The new macro for easier printing LSN added.
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
The new macro for easier printing LSN added.
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
The new macro for easier printing LSN added.