summaryrefslogtreecommitdiff
path: root/storage/maria/trnman.c
Commit message (Collapse)AuthorAgeFilesLines
* Lintian complains on spelling errorFaustin Lammler2019-12-021-1/+1
| | | | | The lintian check complains on spelling error: https://salsa.debian.org/mariadb-team/mariadb-10.3/-/jobs/95739
* Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
|\
| * Update FSF addressMichal Schorm2019-05-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is based on the work of Michal Schorm, rebased on the earliest MariaDB version. Th command line used to generate this diff was: find ./ -type f \ -exec sed -i -e 's/Foundation, Inc., 59 Temple Place, Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \ -exec sed -i -e 's/Foundation, Inc. 59 Temple Place.* Suite 330, Boston, /Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, /g' {} \; \ -exec sed -i -e 's/MA.*.....-1307.*USA/MA 02110-1335 USA/g' {} \; \ -exec sed -i -e 's/Foundation, Inc., 59 Temple/Foundation, Inc., 51 Franklin/g' {} \; \ -exec sed -i -e 's/Place, Suite 330, Boston, MA.*02111-1307.*USA/Street, Fifth Floor, Boston, MA 02110-1335 USA/g' {} \; \ -exec sed -i -e 's/MA.*.....-1307/MA 02110-1335/g' {} \;
* | Merge remote-tracking branch 'origin/10.0' into 10.1Monty2018-05-241-0/+1
|\ \
| * | Fixes for Aria transaction handling with lock tablesMonty2018-05-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-10130 Assertion `share->in_trans == 0' failed in storage/maria/ma_close.c MDEV-10378 Assertion `trn' failed in virtual int ha_maria::start_stmt The problem was that maria_handler->trn was not properly reset at commit/rollback and ha_maria::exernal_lock() could get confused because. There was some old code in ha_maria::implicit_commit() that tried to take care of this, but it was not bullet proof. Fixed by adding list of all tables that is part of the maria transaction to TRN. A nice side effect was of the fix is that loops in ha_maria::implict_commit() got to be much simpler. Other things: - Fixed a bug in mysql_admin_table() where argument open_for_modify was wrongly reset for the next table in the chain - rollback admin command also in case of fatal error. - Split _ma_set_trn_for_table() to three version to simplify code and debugging. - Several new asserts to detect the original problem (that file was not properly removed from trn before calling ma_close())
* | | Correct FSF addressiangilfillan2017-03-101-1/+1
| | |
* | | MDEV-7437 remove suport for "atomics" with rwlocksSergei Golubchik2015-01-131-13/+0
|/ /
* | 10.0-base mergeSergei Golubchik2014-02-031-2/+2
|\ \
| * \ 5.5 mergeSergei Golubchik2014-02-011-2/+2
| |\ \ | | |/
| | * Fixed MDEV-4970: Wrong result with Aria table populated with disabled keysMichael Widenius2014-01-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem was that ALTER TABLE DISABLE KEYS incremented create_trid for the table, which made the new index entries invisible until the global trid catched up. Fixed by only updating create_trid if we are rewriting all rows and indexes. mysql-test/suite/maria/alter.result: Added test case mysql-test/suite/maria/alter.test: Added test case storage/maria/ha_maria.cc: Only updating create_trid if we are doing a full repair (and thus rewriting all rows and indexes). storage/maria/trnman.c: More DBUG_PRINT
* | | 10.0-monty mergeSergei Golubchik2013-07-211-1/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Temporary commit of 10.0-mergeMichael Widenius2013-03-261-1/+1
| | | |
* | | | 10.0-base mergeSergei Golubchik2013-07-181-2/+0
|\ \ \ \ | |/ / / |/| / / | |/ /
| * | cleanup: remove LF_REQUIRE_PINS, use compile_time_assert() instead of ↵Sergei Golubchik2013-06-241-2/+0
| |/ | | | | | | reimplementing it
* | workaround for gcc 4.3.2 bug on lenny-x86 at -O3Sergei Golubchik2012-10-291-0/+3
|/ | | | | | | | | | | | | | | The following piece of code in trnman.c: 345 trn->min_read_from= active_list_min.next->trid; ... 351 active_list_max.prev= trn->prev->next= trn; 352 trid_min_read_from= active_list_min.next->min_read_from; on 345 gcc stores active_list_min.next in %ebx (and trn->min_read_from=[%ebx]->trid) and on 352 it does trid_min_read_from= [%ebx]->min_read_from; BUT active_list_min.next was changed on the line 351. gcc doesn't notice it and continues to use the cached value.
* Cleanups:Michael Widenius2012-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | - Don't use SAFEMALLOC on valgrind builds (slows things down) - Added back lost option from 5.3: debug-mutex-deadlock-detector - Flush pages before taking lock mutex (speeds up closing of Aria tables). BUILD/SETUP.sh: - Don't use SAFEMALLOC on valgrind builds (slows things down) sql/lock.cc: Make default argument explicit (improves readability) sql/mysqld.cc: Removed compiler warnings Sorted debug options alphabetically Added back lost option from 5.3: debug-mutex-deadlock-detector storage/maria/ma_close.c: Flush pages before taking lock mutex (speeds up closing of Aria tables). storage/maria/ma_open.c: More DBUG_PRINT storage/maria/maria_def.h: Better DBUG_PRINT storage/maria/trnman.c: Better DBUG_PRINT
* 5.3->5.5 mergeSergei Golubchik2011-11-221-0/+1
|\
| * Added variable ARIA_CHECKPOINT_LOG_ACTIVITY to allow one to specify how ↵Michael Widenius2011-09-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | often we should do a checkpoint. Added more error printing to log if log_warnings > 2 Give an error if checkpoint record is not correct, mysql-test/suite/maria/r/compat_aliases.result: Added ARIA_CHECKPOINT_LOG_ACTIVITY mysql-test/suite/maria/r/maria3.result: Added ARIA_CHECKPOINT_LOG_ACTIVITY storage/maria/ha_maria.cc: Added ARIA_CHECKPOINT_LOG_ACTIVITY Added more error printing to log if log_warnings > 2 Added db and table name to error message when printing to log storage/maria/ma_check.c: Fixed bug where we didn't reset some variables between repair() calls storage/maria/ma_checkpoint.c: Made maria_checkpoint_min_activity global. Don't do checkpoint if no data logged. Changed test for if we should do checkpoint to test separately for if log has grown or if we have had a lot of of cache writes. storage/maria/ma_recovery.c: Give an error if checkpoint record is not correct storage/maria/trnman.c: Don't print not needed long_transaction_id entries for checkpoints.
* | use PSI wrappers in aria and other non-MySQL codeSergei Golubchik2011-07-131-41/+41
| |
* | lots of post-merge changesSergei Golubchik2011-04-251-2/+2
|/
* Fix for LP#634943 "marked as crashed", "zerofilling" and "wrong data in ↵Michael Widenius2010-09-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bitmap" when recovering Aria tables This was an interaction of several bugs: - Tables marked as opened was not properly unmarked on recovery if there was not changes since checkpoint - zerofill of tables put wrong data in bitmap if directory for page was full - Tables was thought as 'moved' during recovery if they had a create_lsn bigger than the lsn in the control file. storage/maria/ha_maria.cc: If table is moved and crashed, threat it as crashed. (Not a related to this bug, but still good to have fixed) storage/maria/ma_blockrec.c: Make enough_free_entries_on_page() global storage/maria/ma_blockrec.h: Make enough_free_entries_on_page() global storage/maria/ma_check.c: If directory is full, mark page full. Fixes bug in zerofill storage/maria/ma_open.c: Don't marke files as MOVED during recovery if create_trid > trnman_max_trid, as this fails for tables created after checkpoint. storage/maria/ma_recovery.c: Reset open_count in file that was open during crash and was part of checkpoint. Fixed wrong warning of 'open count' after recovery of files that was not touched since checkpoint. storage/maria/maria_chk.c: Changed not documented option --log-dir to --logdir Document more of the options. Clean up output for --help storage/maria/trnman.c: Added DBUG_PRINT
* Fixed bug that 'maria_read_log -a' didn't set max_trid when reparing tables.Michael Widenius2010-09-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug in Aria when replacing short keys with long keys and a key tree both overflow and underflow at same time. Fixed several bugs when generating recovery logs when using RGQ with replacing long keys with short keys and vice versa. Lots of new DBUG_ASSERT()'s Added more information to recovery log to make it easier to know from where log entry orginated. Introduced MARIA_PAGE->org_size that tells what the size of the page was in last log entry. This allows us to find out if all key changes for index page was logged. Small code cleanups: - Introduced _ma_log_key_changes() to log crc of key page changes - Added share->max_index_block_size as max size of data one can put in key block (block_size - KEYPAGE_CHECKSUM_SIZE) This will later simplify adding a directory to index pages. - Write page number instead of page postition to DBUG log mysql-test/lib/v1/mysql-test-run.pl: Use --general-log instead of --log to disable warning when using RQG sql/mysqld.cc: If we have already sent ok to client when we get an error, log this to stderr Don't disable option --log-output if CSV engine is not supported. storage/maria/ha_maria.cc: Log queries to recovery log also in LOCK TABLES storage/maria/ma_check.c: If param->max_trid is set, use this value instead of max_trid_in_system(). This is used by recovery to set max_trid to max seen trid so far. keyinfo->block_length - KEYPAGE_CHECKSUM_SIZE -> max_index_block_size (Style optimization) storage/maria/ma_delete.c: Mark tables crashed early Write page number instead of page position to debug log. Added parameter to ma_log_delete() and ma_log_prefix() that is logged so that we can find where wrong log entries where generated. Fixed bug where a page was not proplerly written when same key tree had both an overflow and underflow when deleting a key. keyinfo->block_length - KEYPAGE_CHECKSUM_SIZE => max_index_block_size (Style optimization) ma_log_delete() now has extra parameter of how many bytes from end of page should be appended to log for page (for page overflows) storage/maria/ma_key_recover.c: Added extra parameter to ma_log_prefix() to indicate what caused log entry. Update MARIA_PAGE->org_size when logging info about page. Much more DBUG_ASSERT()'s. Fix some bugs in maria_log_add() to handle page overflows. Added _ma_log_key_changes() to log crc of key page changes. If EXTRA_STORE_FULL_PAGE_IN_KEY_CHANGES is defines, log the resulting pages to log so one can trivally see how the resulting page should have looked like (for errors in CRC values) storage/maria/ma_key_recover.h: Added _ma_log_key_changes() which is only called if EXTRA_DEBUG_KEY_CHANGES is defined. Updated function prototypes. storage/maria/ma_loghandler.h: Added more values to en_key_debug, to get more exact location where things went wrong when logging to recovery log. storage/maria/ma_open.c: Initialize share->max_index_block_size storage/maria/ma_page.c: Added updating and testing of MARIA_PAGE->org_size Write page number instead of page postition to DBUG log Generate error if we read page with wrong data. Removed wrong assert: key_del_current != share->state.key_del. Simplify _ma_log_compact_keypage() storage/maria/ma_recovery.c: Set param.max_trid to max seen trid before running repair table (used for alter table to create index) storage/maria/ma_rt_key.c: Update call to _ma_log_delete() storage/maria/ma_rt_split.c: Use _ma_log_key_changes() Update MARIA_PAGE->org_size storage/maria/ma_unique.c: Remove casts storage/maria/ma_write.c: keyinfo->block_length - KEYPAGE_CHECKSUM_SIZE => share->max_index_block_length. Updated calls to _ma_log_prefix() Changed code to use _ma_log_key_changes() Update ma_page->org_size Fixed bug in _ma_log_split() for pages that overflow Added KEY_OP_DEBUG logging to functions Log KEYPAGE_FLAG in all log entries storage/maria/maria_def.h: Added SHARE->max_index_block_size Added MARIA_PAGE->org_size storage/maria/trnman.c: Reset flags for new transaction.
* This patch fixes LP#613408 Memory corruption with (M)aria storage engine ↵Michael Widenius2010-08-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and virtual columns in MariaDB 5.2 Fixed compiler warnings Disabled some tests that doesn't work on windows (uses shell tools or strange characters) client/mysqlshow.c: Fixed compiler warnings client/mysqlslap.c: Fixed compiler warnings mysql-test/mysql-test-run.pl: Use an error file instead of /dev/null (Fixes problem on Windows and the output may be usefull) mysql-test/suite/maria/r/maria.result: Test case for bug LP#613408 (not complete) mysql-test/suite/maria/t/maria.test: Test case for bug LP#613408 (not complete) mysql-test/suite/percona/percona_log_slow_slave_statements-and-use_global_long_query_time.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_log_slow_slave_statements.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-control_global_slow.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-log_slow_filter.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-log_slow_verbosity.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-long_query_time.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-microseconds_in_slow_query_log.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-min_examined_row_limit.test: This test doesn't work one windows (needs shell tools) mysql-test/suite/percona/percona_slow_query_log-use_global_long_query_time.test: This test doesn't work one windows (needs shell tools) mysql-test/t/ctype_filesystem.test: This test doesn't work one windows (problem with character sets) mysql-test/t/events_time_zone.test: Use longer times to get predictable tests mysql-test/t/show_check-master.opt: set long query time to get more predictable tests storage/maria/ma_check.c: Restore info->s->lock_key_trees after repair. Disable logging to temp tables for all repair cases (safety fix) storage/maria/ma_state.c: Ensurethat info->state_start doesn't point to freed memory. (Could happen after running an internal repair to fast create indexes) storage/maria/trnman.c: Added longer comment
* Fix for LP#602604: RQG: ma_blockrec.c:6187: ↵Michael Widenius2010-07-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _ma_apply_redo_insert_row_head_or_tail: Assertion `0' failed on Maria engine recovery More DBUG_PRINT (to simplify future debugging) Aria: Added STATE_IN_REPAIR, which is set on start of repair. This allows us to see if 'crashed' flag was set intentionally. Aria: Some trivial speedup optimization Aria: Better warning if table was marked crashed by unfinnished repair mysql-test/lib/v1/mysql-test-run.pl: Fix so one can run RQG mysql-test/suite/maria/r/maria-recovery2.result: Update for new error message. mysys/stacktrace.c: Fixed compiler warning storage/maria/ha_maria.cc: More DBUG_PRINT Added STATE_IN_REPAIR flag, which is set on start of repair. This allows us to see if 'crashed' flag was set intentionally. Don't log query for dropping temporary table. storage/maria/ha_maria.h: Added prototype for drop_table() storage/maria/ma_blockrec.c: More DBUG_PRINT Make read_long_data() inline for most cases. (Trivial speedup optimization) storage/maria/ma_check.c: Better warning if table was marked crashed by unfinnished repair storage/maria/ma_open.c: More DBUG_PRINT storage/maria/ma_recovery.c: Give warning if found crashed table. Changed warning for tables that can't be opened. storage/maria/ma_recovery_util.c: Write warnings to DBUG file storage/maria/maria_chk.c: Added STATE_IN_REPAIR flag, which is set on start of repair. This allows us to see if 'crashed' flag was set intentionally. storage/maria/maria_def.h: Added maria_mark_in_repair(x) storage/maria/maria_read_log.c: Added option: --character-sets-dir storage/maria/trnman.c: By default set min_read_from to max value. This allows us to remove TRN:s from rows during recovery to get more space. This fixes bug LP#602604: RQG: ma_blockrec.c:6187: _ma_apply_redo_insert_row_head_or_tail: Assertion `0' failed on Maria engine recovery
* Remove compiler warnings (Including some warnings from -Wstrict-aliasing)Michael Widenius2009-11-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use static link by default (in compile-pentium) as some new systems doesn't have all static libraries available Change type for functions in plugin.h:str_mysql_ftparser_param() to const unsigned char and string lengths to size_t. One effect of the above change is that one needs to include mysql_global.h or define size_t before including plugin.h This fixes a case where mysql_client_test failed with newer gcc that enables strict-aliasing by default BUILD/compile-pentium: Don't use static link by default as some new systems doesn't have all static libraries available client/mysql_upgrade.c: Remove not used variable cmd-line-utils/readline/config_readline.h: Define some constants to get rid of compiler warnings on Linux cmd-line-utils/readline/display.c: Get rid of compiler warnings cmd-line-utils/readline/history.c: Got rid of compiler warnings: - Defining some strings as const - Added cast cmd-line-utils/readline/rlmbutil.h: Added cast to get rid of compiler warnings cmd-line-utils/readline/text.c: Remove not needed initialization to get rid of compiler warnings cmd-line-utils/readline/xmalloc.c: Changed types to 'const char* to get rid of compiler warnings configure.in: Ensure that we use MariaDB as suffix include/mysql/plugin.h: Changed types to 'const unsigned char* to get rid of compiler warnings (in other parts of the code) Change length for not \0 terminated string to size_t include/mysql/plugin.h.pp: Update related to plugin.h libmysql/libmysql.c: Fixed bug that caused core dump with newer gcc when strict aliasing is not turned off mysql-test/t/information_schema.test: Test is depending on innodb mysql-test/t/not_partition.test: Fixed wrong directory name (Not noticed before as we don't ususally run this test) mysys/lf_hash.c: Got rid of compiler warnings from -Wstrict-aliasing mysys/my_redel.c: Removed not used variable regex/engine.c: Changed types to 'const char* to get rid of compiler warnings regex/engine.ih: Changed types to 'const char* to get rid of compiler warnings sql/sp_head.cc: Got rid of compiler warning from -Wstrict-aliasing sql/sql_base.cc: Got rid of compiler warnings from -Wstrict-aliasing (The original code was probably wrong as nj_col->table_field was sql/sql_builtin.cc.in: plugin.h needs to have size_t defined sql/sql_parse.cc: Remove used variable sql/sql_select.cc: Got rid of compiler warnings from -Wstrict-aliasing sql/sql_show.cc: Added #ifdef to get rid of compiler warning when not using partition engine sql/table.cc: Got rid of compiler warning from -Wstrict-aliasing storage/maria/ha_maria.cc: Got rid of compiler warnings from -Wstrict-aliasing: - Use the thd_killed() API function storage/maria/lockman.c: Got rid of compiler warnings from -Wstrict-aliasing storage/maria/ma_check.c: Got rid of compiler warnings from -Wstrict-aliasing Change to use new version of _ma_killed_ptr; Don't call it as often as before storage/maria/ma_check_standalone.h: Update to compatible _ma_killed_ptr() from ha_maria.cc storage/maria/ma_ft_boolean_search.c: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/maria/ma_ft_nlq_search.c: Got rid of compiler warnings from -Wstrict-aliasing Ensure that 'subkeys' is 32 bit storage/maria/ma_ft_parser.c: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/maria/ma_ftdefs.h: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/maria/ma_sort.c: Change to use new version of _ma_killed_ptr; Don't call it as often as before storage/maria/ma_state.c: Got rid of compiler warnings from -Wstrict-aliasing storage/maria/maria_def.h: Redefine ma_killed_ptr() storage/maria/maria_ftdump.c: Got rid of compiler warnings from -Wstrict-aliasing storage/maria/trnman.c: Got rid of compiler warnings from -Wstrict-aliasing storage/myisam/ft_boolean_search.c: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/myisam/ft_nlq_search.c: Got rid of compiler warnings from -Wstrict-aliasing storage/myisam/ft_parser.c: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/myisam/ft_stopwords.c: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/myisam/ftdefs.h: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/myisam/ha_myisam.cc: Got rid of compiler warnings from -Wstrict-aliasing: - Use the thd_killed() API function storage/myisam/mi_check.c: Use new killed_ptr() function storage/myisam/myisam_ftdump.c: Got rid of compiler warnings from -Wstrict-aliasing storage/myisam/myisamchk.c: Update to compatible killed_ptr() from ha_myisam.cc storage/myisam/myisamdef.h: Redefine killed_ptr() storage/myisam/myisamlog.c: Got rid of compiler warnings from -Wstrict-aliasing storage/myisam/sort.c: Change to use new version of killed_ptr; Don't call it as often as before storage/xtradb/fil/fil0fil.c: Fixedc ompiler warning storage/xtradb/trx/trx0i_s.c: Include mysql_plugin.h later to ensure that size_t is defined
* Fix for BUG#42180 "Maria: maria-recovery-bitmap.test fails repeatedly"Guilhem Bichot2009-03-051-9/+12
| | | | | | | | | | | | | | | | storage/maria/ma_loghandler.c: Normally, when we log LOGREC_LONG_TRANSACTION_ID, undo_lsn should be 0: assert this. storage/maria/ma_test_force_start.pl: this script does not work with mtr2, make it use mtr1 storage/maria/trnman.c: The bug's cause was that: transaction would log LOGREC_LONG_TRANSACTION_ID, then Checkpoint would run and skip it (because its undo_lsn is still 0), then transaction would log REDO+UNDO, then crash. At Recovery, REDO phase would start from Checkpoint's record LSN, so wouldn't see LOGREC_LONG_TRANSACTION_ID, and as Checkpoint record does not mention transaction, transaction would be unknown, so its REDO+UNDO would be thrown away (assumed to belong to a transaction committed long ago as unknown), so transaction would not be rolled back, which is wrong. Fix is: it was wrong to skip a transaction if undo_lsn is 0; as soon as LOGREC_LONG_TRANSACTION_ID has been logged, it becomes potentially invisible to the REDO phase, and so we must include this transaction in the checkpoint record.
* mergedSergei Golubchik2009-01-161-0/+12
|\ | | | | | | | | trnman_get_state/trnman_set_state renamed to trnman_get/set_flags TRN::state - to TRN::flags accordingly
| * Log queries to maria_log if compiled with EXTRA_DEBUGMichael Widenius2009-01-161-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | post-review fixesSergei Golubchik2009-01-151-12/+30
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | include/atomic/generic-msvc.h: prevent possible compiler warnings include/lf.h: comments, better definition for LF_HASH_OVERHEAD include/maria.h: define MARIA_CANNOT_ROLLBACK here include/my_pthread.h: avoid possible name clash include/waiting_threads.h: comments, const, move WT_RESOURCE to waiting_threads.c mysql-test/suite/maria/r/maria_notembedded.result: new test mysql-test/suite/maria/t/maria_notembedded.test: new test - 5-way deadlock mysys/lf_hash.c: better definition for LF_HASH_OVERHEAD mysys/my_static.c: comment mysys/my_thr_init.c: casts mysys/waiting_threads.c: comments, asserts, etc server-tools/instance-manager/parse.cc: fix my_init_dynamic_array() to follow new calling conventions sql/mysqld.cc: call wt_init after set_proper_floating_point_mode sql/sql_class.h: comment storage/maria/ha_maria.cc: move MARIA_CANNOT_ROLLBACK to a common header storage/maria/ma_commit.c: comment storage/maria/ma_write.c: comments, check for HA_ERR_FOUND_DUPP_KEY storage/maria/trnman.c: comments, assert storage/maria/trnman.h: comments storage/maria/unittest/trnman-t.c: be paranoid unittest/mysys/lf-t.c: comments unittest/mysys/waiting_threads-t.c: comments, safety, memory leak
* Fix for Bug#40311 Assert in MARIA_RECORD_POS during pushbuild 2 test:Michael Widenius2008-12-221-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug when removing a newly inserted record (in case of duplicate key). The bug caused a crash for rows with several blobs and the first blob was small enough to fit into the head page. Don't change state_history if nothing changed (speed optimization that also simplifies logic). Reset state_history if we added/deleted or updated rows without versioning. Fixed wrong test in trnman_exists_active_transactions() if state is visible or not. Other bugs fixed: Fixed wrong argument to (lock->get_status) when we had to wait for TL_WRITE_CONCURRENT_INSERT. Item_equal::update_used_tables() didn't calculate const_item_cache properly. Added assert's to detect if join_read_const_table() was called under wrong assumptions.. Fixed that _ma_setup_live_state() is called from thr_lock() instead of handler::external_lock(). This was needed to get versioning information to be setup correctly. Fixed error in debug binaries during a call to _ma_check_table_is_closed() when another thread was opening/closing a table. Fixed wrong test when finding right history_state to use. mysql-test/suite/maria/r/maria.result: Added test for Bug#40311 Assert in MARIA_RECORD_POS during pushbuild 2 test mysql-test/suite/maria/t/maria.test: Added test for Bug#40311 Assert in MARIA_RECORD_POS during pushbuild 2 test mysys/thr_lock.c: Fixed wrong argument to (lock->get_status) when we had to wait for TL_WRITE_CONCURRENT_INSERT sql/item_cmpfunc.cc: Item_equal::update_used_tables() didn't calculate const_item_cache properly, which later caused a wrong result for item->const_item() sql/sql_base.cc: In debug mode, Initilize record buffer with unexpected data to catch usage of uninitialized memory sql/sql_select.cc: Fixed indentation Added assert's to detect if join_read_const_table() was called under wrong assumptions. One assert() is disabled for now as Item_equal() doesn't behave as expected. storage/maria/ha_maria.cc: Move calling to _ma_setup_live_state() to ma_state.c::_ma_block_get_status() This was needed as _ma_setup_live_state() needed to know if the table will be used concurrently or not storage/maria/ma_blockrec.c: Fixed bug when removing a newly inserted record (in case of duplicate key). The bug caused a crash for rows with several blobs and the first blob was small enough to fit into the head page. storage/maria/ma_dbug.c: Added mutex to protect the open table list during _ma_check_table_is_closed(). Without the protection we could get a error in debug binaries during a call to _ma_check_table_is_closed() storage/maria/ma_delete_table.c: Removed not used code storage/maria/ma_rename.c: Removed not used code storage/maria/ma_state.c: Fixed wrong test when finding right history_state to use Mark in tables->state_current.no_transid if we are using transid's or not. Don't change state_history if nothing changed (speed optimization that also simplifies logic) Reset state_history if we added/deleted or updated rows without versioning. More DBUG_ASSERT's and more DBUG Updated maria_versioning() to initialize environment before calling _ma_blok_get_status(). This was needed because of the new logic in _ma_block_get_status() storage/maria/ma_state.h: Added flags to detect if table changed and/or if we changed table without versioning storage/maria/ma_write.c: Simple cleanups (No logic changes) storage/maria/trnman.c: Fixed wrong test in trnman_exists_active_transactions() if state is visible or not.
* Merge with main Maria treeMichael Widenius2008-12-091-0/+12
|\
| * mergeunknown2008-12-081-0/+12
| |\
| | * Fixed mutexes lock order in maria_close(): LOCK_trn_list -> ↵unknown2008-12-081-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MARIA_SHARE::intern_lock (then will be WL to revert the order). (BUG#40981 Maria: deadlock between checkpoint and maria_close() when freeing state info) storage/maria/ma_checkpoint.c: The argument added to the function to use it in maria_close(). storage/maria/ma_close.c: Locking/unlocking MARIA_SHARE::intern_lock added to use correct order of the mutexes taking. storage/maria/ma_state.c: Removed assert becase now we have externally locked mutex in maria_close(). The argument added to the _ma_remove_not_visible_states_with_lock() to use it in maria_close(). _ma_remove_not_visible_states_with_lock() fixed tio be usable from maria_chk where transaction manager is not initialized. storage/maria/ma_state.h: The argument added to the function to use it in maria_close(). storage/maria/maria_def.h: Fixed comment to the variable. storage/maria/trnman.c: The debugging assert added. New function to detect transaction manager initialization added (maria_chk do not initialize it). storage/maria/trnman_public.h: New function to detect transaction manager initialization added (maria_chk do not initialize it).
* | | Merge with base Maria treeMichael Widenius2008-12-091-9/+16
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove warnings from test logs about depricated options mysql-test/t/events_logs_tests-master.opt: Remove warnings from test logs about depricated options mysql-test/t/log_tables-big-master.opt: Remove warnings from test logs about depricated options mysql-test/t/log_tables-master.opt: Remove warnings from test logs about depricated options mysql-test/t/multi_statement-master.opt: Remove warnings from test logs about depricated options mysql-test/t/ps-master.opt: Remove warnings from test logs about depricated options mysql-test/t/show_check-master.opt: Remove warnings from test logs about depricated options mysql-test/t/slow_query_log_file_basic-master.opt: Remove warnings from test logs about depricated options mysql-test/t/slow_query_log_file_func-master.opt: Remove warnings from test logs about depricated options mysql-test/t/union-master.opt: Remove warnings from test logs about depricated options sql/mysqld.cc: Don't give warnings for empty log file names
| * | merge with latest 5.1-mariaGuilhem Bichot2008-12-051-1/+0
| |\ \
| | * | Fix for BUG#41037 "Maria: recovery failure (pushbuild2)" (checkpoint bug).Guilhem Bichot2008-12-051-1/+0
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysql-test/suite/maria/r/maria-recovery3.result: result. mysql-test/suite/maria/t/maria-recovery3-master.opt: usual recovery test options mysql-test/suite/maria/t/maria-recovery3.test: Test for BUG#41037. Without the bugfix, the test would hang because Recovery would fail with "undo_key_insert got error 126": Recovery would believe INSERT of 2 is uncommitted, try to execute its UNDO_KEY_INSERT, fail to find the key to delete because DELETE deleted it. That failure of _ma_ck_real_delete() would mark table as corrupted (see in d_search()) which is error 126 (HA_ERR_CRASHED). storage/maria/ma_blockrec.c: set trn->rec_lsn to LSN of commit record, when writing it. storage/maria/ma_blockrec.h: new function storage/maria/ma_commit.c: when committing or rolling back, rec_lsn should be LSN_IMPOSSIBLE: assertion is moved here from trnman_end_trn(), because now ma_commit() can set rec_lsn and so when we reach trnman_end_trn() it's not LSN_IMPOSSIBLE anymore. Adding debug possibility to pause between COMMIT record write and trnman_commit_trn(), to be able to fire checkpoint in between. storage/maria/ma_loghandler.c: in-write hook for COMMIT records storage/maria/ma_recovery.c: More debugging info in maria_recovery.trace, to see how the starting point of REDO phase is determined storage/maria/trnman.c: assertion cannot be here anymore see ma_commit.c
| * | compilation warningsSergei Golubchik2008-12-051-1/+1
| | |
| * | bug#41024 maria: Server crashes in sysbench OLTP_RW test at lf_hash.c:94Sergei Golubchik2008-12-051-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bug#41023 maria: Server asserts in sysbench OLTP_RO test bug#40888 maria: Server crashes in sysbench OLTP_RW test at lf_alloc-pin.c:513 bug#40892 maria: Livelock in sysbench OLTP_RW test bug#40895 maria: Server crashes in sysbench OLTP_RO test at lf_alloc-pin.c:367 bug#40890 maria: Server crashes in sysbench OLTP_RW test at ctype-bin.c:8 Yet another strict aliasing issue
| * | bug#40416 - Maria: Memory allocated at trnman.c:129 was underrun.Sergei Golubchik2008-12-051-5/+11
| | | | | | | | | | | | we cannot access a trn after we put it in the pool
| * | dbug fix: only do safemalloc checks if a function is selectedSergei Golubchik2008-12-021-0/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | mysqlslap: fix a crash when mysql_store_result() fails client/mysqlslap.c: fix a crash dbug/dbug.c: only do safemalloc checks if a function is selected mysql-test/mysql-test-run.pl: it's easier to add new gdb parameters this way storage/maria/ma_open.c: typo in a comment
* | Fixed problem with crash in Maria _ma_setup_live_state() where history link ↵Michael Widenius2008-12-081-1/+6
|/ | | | | | | | | | | didn't include needed state mysql-test/mysql-test-run.pl: Remove warnings in log about depricated mysqld options storage/maria/ma_state.c: More DBUG_PRINT storage/maria/trnman.c: Fixed wrong test if commit_trid is visible
* During Maria's checkpoint, use the proper mutex to read transaction's short_idGuilhem Bichot2008-11-201-1/+4
| | | | | storage/maria/trnman.c: During Maria's checkpoint, we walk the list of active transactions; in this list we may find a transaction with a short_id of 0 which means "uninitialized" (is being created right now) and want to ignore this transaction. Such short_id is set under trn->state_lock, so use this mutex to reliably read short_id during checkpoint.
* Fix for bug: Bug #40391 Maria deadlock in trnman_get_min_trid , trnman_end_trnMichael Widenius2008-11-051-15/+16
| | | | | | | | storage/maria/trnman.c: Store min used trid in a global variable and change trnman_get_min_trid() to return this variable without using a mutex. This is safe as trnman_get_min_trid() is used for trid optimization and all algoritms will work even if it returns a slightly older trid. Also ensure that LOCK_trn_list is unlocked in trnman_new_trn() in the very unlikely case that lf_hash_get_pins() fails
* Bug#40416 Maria: Memory allocated at trnman.c:129 was underrunSergei Golubchik2008-10-301-1/+1
| | | | | | | fix a bug that was introduced in one of the infamous "cleanups" storage/maria/trnman.c: restore the correct precedence
* wt: don't support a key as a union { ulonglong, void* }. Although convenient,Sergei Golubchik2008-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | it forces the user to bzero a key before setting it as a pointer, otherwise it'll have random content on architectures where sizeof(void*) < sizeof(ulonglong). Declaring a key as ulonglong only (not a union) makes this user mistake impossible. include/waiting_threads.h: WT_RESOURCE_ID::value is an ulonglong, not a union mysys/waiting_threads.c: WT_RESOURCE_ID::value is an ulonglong, not a union storage/maria/ma_write.c: WT_RESOURCE_ID::value is an ulonglong, not a union storage/maria/trnman.c: WT_RESOURCE_ID::value is an ulonglong, not a union unittest/mysys/waiting_threads-t.c: WT_RESOURCE_ID::value is an ulonglong, not a union
* wt: comments, OOM checks, test case for deadlock detectionSergei Golubchik2008-08-281-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | include/waiting_threads.h: make wt_thd_dontwait private mysql-test/r/maria.result: deadlock example mysql-test/t/maria.test: deadlock example mysys/waiting_threads.c: comments, OOM checks sql/mysqld.cc: fix variables sql/sql_class.cc: move wt_lazy_init to THD constructor sql/sql_class.h: move wt_lazy_init to THD constructor storage/maria/ha_maria.cc: backport from 6.0 storage/maria/ma_write.c: poset-review fixes, set thd->proc_info storage/maria/trnman.c: bugfixing storage/myisam/mi_check.c: warnings storage/myisam/mi_page.c: warnings storage/myisam/mi_search.c: warnings storage/myisammrg/myrg_create.c: warnings unittest/mysys/waiting_threads-t.c: fixes
* move wt* maintainance from maria to the serverSergei Golubchik2008-08-071-14/+21
| | | | | | | | | | | | | | include/waiting_threads.h: C_MODE_START/END mysys/waiting_threads.c: relax the checks - auto init thd in will_wait_for, allow to destroy uninited thd (=noop), allow a "release" an unexistent resource (=noop), sql/sql_class.cc: move wt* maintainance from maria to the server. do THD::cleanup after ha_close_connection() and plugin_thdvar_cleanup(). storage/maria/unittest/trnman-t.c: update to new prototype
* fixes for failing test suiteSergei Golubchik2008-08-061-1/+1
| | | | | | | | | storage/maria/ma_write.c: select ... group by ... - take temporary tables into account, they have TRN->pins == 0 storage/maria/trnman.c: one cannot modify TRN->trid, it's a key in the trid_to_trn hash, if trid is modified, TRN won't be found (and deleted in trnman_free_trn) from the hash.
* maria: deadlock detection when waiting on unique key (useless until we can ↵Sergei Golubchik2008-08-061-11/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | rollback) include/my_pthread.h: cleanup include/waiting_threads.h: header guard mysys/waiting_threads.c: bug - kill strategy were not applied to deadlocks of length 1. cast timeout to ulonglong. storage/maria/ma_static.c: declare WT_RESOURCE_TYPE ma_rc_dup_unique storage/maria/ma_write.c: deadlock detection when waiting on unique key (useless until we can rollback) storage/maria/maria_def.h: deadlock detection when waiting on unique key (useless until we can rollback) storage/maria/trnman.c: use deadlock detector. protect state transitions of a TRN with a mutex. trnman_trid_to_trn() function. storage/maria/trnman.h: trnman_trid_to_trn() function protect state transitions of a TRN with a mutex use deadlock detector. storage/maria/trnman_public.h: trnman_trid_to_trn()
* compiler warningsSergei Golubchik2008-08-041-78/+21
| | | | | | | | | | | | | | | | | | | | | | | | trnman: remove old lockman code trnman: replace trid_to_committed_trn hash with trid_to_trn storage/maria/ma_blockrec.c: compiler warnings storage/maria/ma_loghandler.c: compiler warnings storage/maria/ma_write.c: compiler warnings storage/maria/trnman.c: remove old lockman code replace trid_to_committed_trn hash with trid_to_trn storage/maria/trnman.h: remove old lockman code replace trid_to_committed_trn hash with trid_to_trn storage/maria/unittest/ma_test_loghandler-t.c: compiler warnings storage/maria/unittest/ma_test_loghandler_multigroup-t.c: compiler warnings storage/maria/unittest/ma_test_loghandler_multithread-t.c: compiler warnings