Also, implement MDEV-11027 a little differently from 5.5 and 10.0:
recv_apply_hashed_log_recs(): Change the return type back to void
(DB_SUCCESS was always returned).
Report progress also via systemd using sd_notifyf().
it was race condition prone. instead use either a pair of my_delete()
calls with already resolved paths, or a safe high-level function
my_handler_delete_with_symlink(), like MyISAM and Aria already do.
- Used same fix as for MyISAM: High level collation byte stored in unused
bit_end position.
- Moved language from header to base_info
- Removed unused bit_end part in HA_KEY_SEG
This is port of fix for MySQL BUG#17647863.
revno: 5572
revision-id: jon.hauglid@oracle.com-20131030232243-b0pw98oy72uka2sj
committer: Jon Olav Hauglid <jon.hauglid@oracle.com>
timestamp: Thu 2013-10-31 00:22:43 +0100
message:
Bug#17647863: MYSQL DOES NOT COMPILE ON OSX 10.9 GM
Rename test() macro to MY_TEST() to avoid conflict with libc++.
Increase default pointer length for Aria tables to be able to handle big files without having to specify MAX_ROWS
mysql-test/suite/maria/icp.result:
Updated result
mysql-test/suite/maria/maria-preload.result:
More pages are needed with longer pointer length
mysql-test/suite/maria/maria.result:
Added more tests
mysql-test/suite/maria/maria.test:
Added more tests
storage/maria/ma_create.c:
Increase default pointer length for Aria tables to be able to handle big files without having to specify MAX_ROWS
storage/maria/ma_range.c:
Optimize records_in_range() to be more exact
storage/maria/ma_static.c:
Increase default pointer size
storage/maria/ma_test2.c:
Allow a bit larger errors in records_in_range
includes:
* remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING"
* introduce LOCK_share, now LOCK_ha_data is strictly for engines
* rea_create_table() always creates .par file (even in "frm-only" mode)
* fix a 5.6 bug, temp file leak on dummy ALTER TABLE
- Optimize away calls to hp_rec_hashnr() by cashing hash
- Try to get more rows / block (to minimize overhead of HP_PTRS) in HEAP tables.
storage/heap/_check.c:
Optimize away calls to hp_rec_hashnr() by cashing hash.
Print cleanups
storage/heap/heapdef.h:
Added place to hold calculated hash value for row
storage/heap/hp_create.c:
Try to get more rows / block (to minimize overhead of HP_PTRS)
storage/heap/hp_delete.c:
Optimize away calls to hp_rec_hashnr() by cashing hash.
storage/heap/hp_hash.c:
Optimize away calls to hp_rec_hashnr() by cashing hash.
Remove some not needed DBUG_PRINT
storage/heap/hp_test2.c:
Increased max table size as now heap tables takes a bit more space (a few %)
storage/heap/hp_write.c:
Optimize away calls to hp_rec_hashnr() by cashing hash.
Remove duplicated code
More DBUG_PRINT
storage/maria/ma_create.c:
More DBUG_PRINT
Honor unique/not unique when creating keys for internal tempory tables.
Added new variables to be used to limit how keys are created for internal temporary tables.
include/maria.h:
Added maria_max_key_length() and maria_max_key_segments()
include/myisam.h:
Added myisam_max_key_length() and myisam_max_key_segments()
mysql-test/r/mysql.result:
Drop all used tables
mysql-test/r/subselect4.result:
Added test case for lp:879939
mysql-test/t/mysql.test:
Drop all used tables
mysql-test/t/subselect4.test:
Added test case for lp:879939
sql/mysql_priv.h:
Added internal_tmp_table_max_key_length and internal_tmp_table_max_key_segments to be used to limit how keys for derived tables are created.
sql/mysqld.cc:
Added internal_tmp_table_max_key_length and internal_tmp_table_max_key_segments to be used to limit how keys for derived tables are created.
sql/share/errmsg.txt:
Added new error message for internal errors
sql/sql_select.cc:
Give error if we try to create a wrong key (this error should never happen)
Honor unique/not unique when creating keys for internal tempory tables.
storage/maria/ha_maria.cc:
Added change_table_ptr() to ensure that external_ref points always to the correct table.
(Not having this caused an assert in the included test)
storage/maria/ha_maria.h:
Added change_table_ptr() to ensure that external_ref points always to the correct table.
storage/maria/ma_check.c:
Fixed bug in Duplicate key error printing (now row position is printed correctly)
storage/maria/ma_create.c:
maria_max_key_length() -> _ma_max_key_length()
storage/maria/ma_info.c:
Added extern function maria_max_key_length() to calculate the max key length based on current block size.
storage/maria/ma_open.c:
maria_max_key_length() -> _ma_max_key_length()
storage/maria/maria_def.h:
maria_max_key_length() -> _ma_max_key_length()
storage/myisam/ha_myisam.cc:
Added change_table_ptr() to ensure that external_ref points always to the correct table.
(Not having this caused an assert in the included test)
storage/myisam/ha_myisam.h:
Added change_table_ptr() to ensure that external_ref points always to the correct table.
sql/sql_insert.cc:
CREATE ... IF NOT EXISTS may do nothing, but
it is still not a failure. don't forget to my_ok it.
******
CREATE ... IF NOT EXISTS may do nothing, but
it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
small cleanup
******
small cleanup
Fixed lp:814237: Wrong mutex usage in Aria
storage/maria/ma_bitmap.c:
Added call to _ma_bitmap_mark_file_changed() when flushing bitmap. This fixes lp:814237
The bug happens when one uses MAX_ROWS=# with Aria & row_format=page and one insert more than # rows.
mysql-test/mysql-test-run.pl:
Ignore table is full error messages
mysql-test/suite/maria/r/max_length.result:
Test case for 'Table is full'
mysql-test/suite/maria/t/max_length.test:
Test case for 'Table is full'
storage/maria/ma_bitmap.c:
Ensure that we don't allocate bits outside of max_data_file_size.
Adjust max_data_file_size based on bitmap alignments.
Backport fix to adjust wrong first_bitmap_with_space.
storage/maria/ma_blockrec.c:
Calculate value of max_data_file_length
storage/maria/ma_blockrec.h:
Updated prototype for _ma_bitmap_init()
storage/maria/ma_check.c:
Give warnings if file sizes are above max file sizes.
Give more warnings in case of errors.
Have maria_chk write if table is recreated.
storage/maria/ma_create.c:
Better calculation of max_data_file_length and thus data pointer length.
Fixes some wrong pointer lengths when using MAX_ROWS=#
storage/maria/ma_open.c:
Removed duplicate assigment.
Use block size from file instead of global variable.
storage/maria/maria_chk.c:
Remove -1 from printed file length
storage/maria/maria_def.h:
Update struct st_maria_file_bitmap
- Fixed multi-user problem with one thread doing inserts and another doing scans that gave error 175
- Fixed bug that caused assert in move_to_next_bitmap() & _ma_read_bitmap_page()
- Much more DBUG_ASSERT(!maria_assert_if_crashed_table) to detect errors early
- EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
storage/maria/ma_bitmap.c:
More secure handling of first_bitmap_with_space (now we also take care of wrong values)
Don't set page to -1; This fixed unlikely bug that caused assert in move_to_next_bitmap() & _ma_read_bitmap_page()
storage/maria/ma_blockrec.c:
More DBUG_ASSERT()'s
Fixed multi-user problem with one thread doing inserts and another doing scans that gave error 175
(We should use data_file_length from start of scan, not new value as new bitmap page may not yet be in page cache)
storage/maria/ma_check.c:
EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere)
storage/maria/ma_checkpoint.c:
Made maria_checkpoint_min_activity static so that one can change it in debugger while testing.
Fixed long standing performance problem that caused write of state info at checkpoint for any file that was ever changed since open.
storage/maria/ma_create.c:
EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
storage/maria/ma_dynrec.c:
Added missing MARIA_EXTERNAL_LOCKING (minor performance improvement)
storage/maria/ma_locking.c:
EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
storage/maria/ma_open.c:
EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
storage/maria/ma_pagecache.c:
Added assert to detect reads outside of data file
storage/maria/maria_def.h:
Added checkpoint_state to cache state writes in checkpoint
Fixed reference to not initialized memory detected by valgrind
sql/sql_select.cc:
A bit better fix for tmp-table problem:
Use only dynamic_record format for group by and distinct.
storage/maria/ma_create.c:
DYNAMIC_RECORD format doesn't pack VARCHAR fields.
This change fixes a non-fatal uninitialized memory copy.
- 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)
This makes the keys smaller (no row pointer) and gives us proper errors if we
use the table wrongly.
sql/sql_select.cc:
Use NO_RECORD for tables that doesn't need row data.
storage/maria/Makefile.am:
Added ma_norec.c
storage/maria/ma_check.c:
Added support for NO_RECORD record format (don't store any row data)
storage/maria/ma_norec.c:
Added support for NO_RECORD record format
storage/maria/ma_open.c:
Added support for NO_RECORD record format
storage/maria/ma_search.c:
Added support for 0 size row pointers (used with NO_RECORD)
storage/maria/ma_test1.c:
Added testing of NO_RECORD record format.
storage/maria/maria_chk.c:
Added support for NO_RECORD
storage/maria/maria_def.h:
Added support for NO_RECORD
storage/maria/unittest/ma_test_all-t:
Added testing of NO_RECORD record format
Fix wrong cast of time()
include/my_pthread.h:
Safety fix that also removes compiler warnings
sql/handler.h:
Changed timestamp columns to be of type time_t
storage/maria/ma_check.c:
Removed wrong cast
storage/maria/ma_create.c:
Removed wrong cast
storage/myisam/mi_check.c:
Removed wrong cast
storage/myisam/mi_create.c:
Removed wrong cast
storage/xtradb/handler/ha_innodb.cc:
Removed compiler warning on windows
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
mysql-test/suite/maria/r/maria-recovery3.result:
result update
mysql-test/suite/maria/t/maria-recovery3.test:
Test for BUG#42112; before the bugfix, recovery would assert like this:
ma_blockrec.c:6051: _ma_apply_redo_insert_row_head_or_tail: Assertion `rownr == 0 && new_page' failed.
storage/maria/ma_create.c:
Fix for BUG#42112; plus some intentional crashes to test the fix. The bug was that if crash happened during
TRUNCATE TABLE, in maria_create(), after the index file's state has been written but before its LSNs
have been updated (so, if crash happened between _ma_state_info_write_sub() and _ma_update_state__lsns_sub()),
then that would leave a table with create_rename_lsn==0. Recovery would then try old pre-TRUNCATE REDOs
on this table, and fail as this table is already partly shortened. Fix is to write create_rename_lsn==LSN_MAX
as soon as TRUNCATE touches the index file, so that Recovery ignores this table. This allows Maria to start;
the table is still corrupted but the user can successfully repeat TRUNCATE TABLE (which required Maria to start).
storage/maria/ma_delete_all.c:
A comment.
Added DBUG_ASSERT() to unlikely error senario
Don't use errno == 0 in maria_create() / myisam_create()
sql/sql_insert.cc:
Added DBUG_ASSERT() for case that should never happen in real life
Added my_error() to avoid assert if mysql_lock() or postlock() doesn't call my_error()
storage/maria/ha_maria.cc:
Log queries to maria_log if compiled with EXTRA_DEBUG
storage/maria/ma_create.c:
Don't use errno == 0
storage/maria/ma_loghandler.c:
Added logging of debug info to maria_log
storage/maria/ma_loghandler.h:
Added logging of debug info to maria_log
storage/maria/ma_recovery.c:
Added printing of debug info from maria_log
storage/maria/trnman.c:
Added functions to read/store state in TRN
storage/maria/trnman.h:
Added functions to read/store state in TRN
storage/maria/trnman_public.h:
Added state in TRN to remmeber if we have already logged the query
storage/myisam/mi_create.c:
Don't use errno == 0
- 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
Don't fsync() index file when closing Maria table if not transactional.
mysql-test/suite/maria/r/maria.result:
piece moved
mysql-test/suite/maria/r/maria_partition.result:
result
mysql-test/suite/maria/t/maria.test:
- reset default storage engine at end of test, not in the middle
- move piece which requires partitioning, to maria_partition.test, otherwise test fails
on builds without partitioning compiled in
mysql-test/suite/maria/t/maria_partition.test:
new test for those Maria bugs which are specific of partitioning
mysys/my_uuid.c:
compiler warning fix (fix imported from latest 5.1-main)
storage/maria/ma_close.c:
don't fsync() index file when closing table if not transactional
(same test as in _ma_once_end_block_record() when fsync-ing data file)
storage/maria/ma_create.c:
compiler warning fix (char* assigned to uchar*)
storage/maria/ma_loghandler.c:
compiler warning fix (char* assigned to uchar*)
MARIA_MAX_MSG_BUF -> HA_MAX_MSG_BUF
include/maria.h:
Remove MARIA_MAX_MSG_BUF; We are now using HA_MAX_MSG_BUF
Added maria_test_invalid_symlink
storage/maria/ha_maria.cc:
MARIA_MAX_MSG_BUF -> HA_MAX_MSG_BUF
storage/maria/ma_check.c:
Removed tab in string constant
Add extra argument to ma_open_datafile()
storage/maria/ma_create.c:
Set error number if table is in use
storage/maria/ma_open.c:
Added name argument to open functions for security check if filename is linked to another file in database directory
storage/maria/ma_static.c:
Default functions for checking if wrong symlink
storage/maria/maria_chk.c:
Add extra argument to _ma_open_datafile()
storage/maria/maria_def.h:
Add extra argument to _ma_open_datafile()
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
- after auto-zerofill (ha_maria::check_and_repair()) kepts its state's LSNs unchanged, which could
be the same as the create_rename_lsn of another pre-existing table, which would break versioning as this LSN
serves as unique identifier in the versioning code (in maria_open()). Even the state pieces which
maria_zerofill() did change were lost (because they didn't go to disk).
- after this fix, if two tables were auto-zerofilled at the same time (by _ma_mark_changed())
they could receive the same create_rename_lsn, which would break versioning again. Fix is to write a log
record each time a table is imported.
- Print state's LSNs (create_rename_lsn, is_of_horizon, skip_redo_lsn) and UUID in maria_chk -dvv.
mysql-test/r/maria-autozerofill.result:
result
mysql-test/t/maria-autozerofill.test:
Test for auto-zerofilling
storage/maria/ha_maria.cc:
The state changes done by auto-zerofilling never reached disk.
storage/maria/ma_check.c:
When zerofilling a table, including its pages' LSNs, new state LSNs are needed next time the table
is imported into a Maria instance.
storage/maria/ma_create.c:
Write LOGREC_IMPORTED_TABLE when importing a table. This is informative and ensures
that the table gets a unique create_rename_lsn even though multiple tables
are imported by concurrent threads (it advances the log's end LSN).
storage/maria/ma_key_recover.c:
comment
storage/maria/ma_locking.c:
instead of using translog_get_horizon() for state's LSNs of imported table,
use the LSN of to-be-written LOGREC_IMPORTED_TABLE.
storage/maria/ma_loghandler.c:
New type of log record
storage/maria/ma_loghandler.h:
New type of log record
storage/maria/ma_loghandler_lsn.h:
New name for constant as can be used not only by maria_chk but auto-zerofill now too.
storage/maria/ma_open.c:
instead of using translog_get_horizon() for state's LSNs of imported table,
use the LSN of to-be-written LOGREC_IMPORTED_TABLE.
storage/maria/ma_recovery.c:
print content of LOGREC_IMPORTED_TABLE in maria_read_log.
storage/maria/maria_chk.c:
print info about LSNs of the table's state, and UUID, when maria_chk -dvv
storage/maria/maria_pack.c:
new name for constant
storage/maria/unittest/ma_test_recovery.pl:
Now that maria_chk -dvv shows state LSNs and UUID those need to be filtered out,
as maria_read_log -a does not use the same as at original run.