summaryrefslogtreecommitdiff
path: root/sql/debug_sync.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.5 into 10.6Marko Mäkelä2023-04-111-1/+1
|\
| * Merge branch '10.4' into 10.5Oleksandr Byelkin2023-04-031-1/+1
| |\
| | * ensure that STRING_WITH_LEN is only used with string literalsSergei Golubchik2023-04-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is allowed: STRING_WITH_LEN("string literal") This is not: char *str = "pointer to string"; ... STRING_WITH_LEN(str) .. In C++ this is also allowed: const char str[] = "string literal"; ... STRING_WITH_LEN(str) ...
* | | Update comments to match new debug_sync implementationVicențiu Ciorbaru2023-02-151-3/+4
| | |
* | | debug_sync: Print all current active signals within the trace file during waitVicențiu Ciorbaru2023-02-031-5/+50
| | | | | | | | | | | | | | | | | | | | | When running with DBUG trace enabled, print all current active signals. The output looks like this with the signals present in curr: T@6 ... debug_sync_exec: wait for 'nothing' at: 'now', curr: 'something,from_function,from_myvar'
* | | Implement DEBUG_SYNC multiple signal firing capabilityVicențiu Ciorbaru2023-02-031-12/+29
| | | | | | | | | | | | | | | | | | | | | One can now do: set DEBUG_SYNC='... SIGNAL s1,s2,s3...' Multiple signals can be fired, they need to be split by commas.
* | | debug_sync: Implement NO_CLEAR_EVENT syntaxVicențiu Ciorbaru2023-02-031-2/+16
| | | | | | | | | | | | | | | When waiting on a signal, NO_CLEAR_EVENT allows one to not clear the signal, effectively allowing other threads to wait for the same signal.
* | | Implement multiple-signal debug_syncVicențiu Ciorbaru2023-02-031-25/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch is inspired from MySQL. Instead of using a single String to hold the current active debug_sync signal, use a Hash_set to store LEX_STRINGS. This patch ensures that a signal can not be lost, by being overwritten by another thread via set DEBUG_SYNC = '... SIGNAL ...'; All signals are kepts "alive" until they are consumed by a wait event. This requires updating test cases that assume the GLOBAL signal is never consumed. Follow-up work needed: Port the additional syntax that allows one to set multiple signals and also conditionally deactivate signals when waiting.
* | | Merge branch '10.5' into 10.6Sergei Golubchik2022-09-301-1/+1
|\ \ \ | |/ /
| * | debug_sync: ignore "sort" kills and disconnectsSergei Golubchik2022-09-291-1/+1
| | | | | | | | | | | | | | | only "hard" kills will now interrupt debug_sync waits. this is needed to have debug_sync points that work during disconnect
* | | Merge 10.5 into 10.6Marko Mäkelä2022-09-261-11/+14
|\ \ \ | |/ /
| * | Merge 10.4 into 10.5Marko Mäkelä2022-09-261-11/+14
| |\ \ | | |/
| | * MDEV-29613 Improve WITH_DBUG_TRACE=OFFMarko Mäkelä2022-09-231-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 28325b08633372cc343dfcbc41fe252020cf6e6e a compile-time option was introduced to disable the macros DBUG_ENTER and DBUG_RETURN or DBUG_VOID_RETURN. The parameter name WITH_DBUG_TRACE would hint that it also covers DBUG_PRINT statements. Let us do that: WITH_DBUG_TRACE=OFF shall disable DBUG_PRINT() as well. A few InnoDB recovery tests used to check that some output from DBUG_PRINT("ib_log", ...) is present. We can live without those checks. Reviewed by: Vladislav Vaintroub
* | | Fixed debug_sync timeout in deadlock_drop_tableMonty2021-06-191-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | The issue was that we sent two different signals to different threads after each other. The DEBUG_SYNC functionality cannot handle this (as the signal is stored in a global variable) and the first one can get lost. Fixed by using the same signal for both threads.
* | | Move debug_crash_here to it's own source filesMonty2021-05-191-71/+0
| | |
* | | MDEV-23842 Atomic RENAME TABLEMonty2021-05-191-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Major rewrite of ddl_log.cc and ddl_log.h - ddl_log.cc described in the beginning how the recovery works. - ddl_log.log has unique signature and is dynamic. It's easy to add more information to the header and other ddl blocks while still being able to execute old ddl entries. - IO_SIZE for ddl blocks is now dynamic. Can be changed without affecting recovery of old logs. - Code is more modular and is now usable outside of partition handling. - Renamed log file to dll_recovery.log and added option --log-ddl-recovery to allow one to specify the path & filename. - Added ddl_log_entry_phase[], number of phases for each DDL action, which allowed me to greatly simply set_global_from_ddl_log_entry() - Changed how strings are stored in log entries, which allows us to store much more information in a log entry. - ddl log is now always created at start and deleted on normal shutdown. This simplices things notable. - Added probes debug_crash_here() and debug_simulate_error() to simply crash testing and allow crash after a given number of times a probe is executed. See comments in debug_sync.cc and rename_table.test for how this can be used. - Reverting failed table and view renames is done trough the ddl log. This ensures that the ddl log is tested also outside of recovery. - Added helper function 'handler::needs_lower_case_filenames()' - Extend binary log with Q_XID events. ddl log handling is using this to check if a ddl log entry was logged to the binary log (if yes, it will be deleted from the log during ddl_log_close_binlogged_events() - If a DDL entry fails 3 time, disable it. This is to ensure that if we have a crash in ddl recovery code the server will not get stuck in a forever crash-restart-crash loop. mysqltest.cc changes: - --die will now replace $variables with their values - $error will contain the error of the last failed statement storage engine changes: - maria_rename() was changed to be more robust against crashes during rename.
* | | Less noise in the error logMonty2021-05-191-7/+6
|/ / | | | | | | | | - Updated error messages for recovery - Changed printing of debug sync point information to make it fit 80 char
* | Merge 10.4 into 10.5Marko Mäkelä2020-09-041-1/+2
|\ \ | |/
| * Merge 10.2 into 10.3Marko Mäkelä2020-09-031-1/+3
| |\
| | * Merge 10.1 into 10.2Marko Mäkelä2020-09-031-1/+3
| | |\
| | | * MDEV-22387: Do not pass null pointer to some memcpy()Marko Mäkelä2020-09-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing a null pointer to a nonnull argument is not only undefined behaviour, but it also grants the compiler the permission to optimize away further checks whether the pointer is null. GCC -O2 at least starting with version 8 may do that, potentially causing SIGSEGV. These problems were caught in a WITH_UBSAN=ON build with the Bug#7024 test in main.view.
* | | | Merge branch '10.4' into 10.5Oleksandr Byelkin2020-08-041-2/+2
|\ \ \ \ | |/ / /
| * | | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-08-031-2/+2
| |\ \ \ | | |/ /
| | * | Merge branch '10.1' into 10.2Oleksandr Byelkin2020-08-021-2/+2
| | |\ \ | | | |/
| | | * Code comment spellfixesIan Gilfillan2020-07-221-2/+2
| | | |
* | | | Extended debug_sync_control life timeSergey Vojtovich2020-03-131-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It now lives from THD constructor to THD destructor. Reset before THD is released to a cache. Change user doesn't reset debug_sync_control anymore. Needed to be able to make use of DEBUG_SYNC() at later stages like ha_close_connection().
* | | | perfschema mdl related instrumentation changesSergei Golubchik2020-03-101-3/+22
| | | |
* | | | perfschema memory related instrumentation changesSergei Golubchik2020-03-101-2/+3
| | | |
* | | | MDEV-21581 Helper functions and methods for CHARSET_INFOAlexander Barkov2020-01-281-7/+5
| | | |
* | | | Using more of Sql_mode_save. Adding a similar class for THD::abort_on_warnings.Alexander Barkov2019-05-281-3/+1
|/ / /
* | | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
|\ \ \ | |/ /
| * | Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| |\ \ | | |/
| | * Update FSF addressVicențiu Ciorbaru2019-05-111-1/+1
| | |
* | | Merge branch '10.2' into 10.3Sergei Golubchik2019-03-171-3/+3
|\ \ \ | |/ /
| * | Merge branch '10.1' into 10.2Sergei Golubchik2019-03-151-3/+3
| |\ \ | | |/
| | * fix gcc 8 compiler warningsSergei Golubchik2019-03-141-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two newly enabled warnings: 1. cast for a function pointers. Affected sql_analyse.h, mi_write.c and ma_write.cc, mf_iocache-t.cc, mysqlbinlog.cc, encryption.cc, etc 2. memcpy/memset of nontrivial structures. Fixed as: * the warning disabled for InnoDB * TABLE, TABLE_SHARE, and TABLE_LIST got a new method reset() which does the bzero(), which is safe for these classes, but any other bzero() will still cause a warning * Table_scope_and_contents_source_st uses `TABLE_LIST *` (trivial) instead of `SQL_I_List<TABLE_LIST>` (not trivial) so it's safe to bzero now. * added casts in debug_sync.cc and sql_select.cc (for JOIN) * move assignment method for MDL_request instead of memcpy() * PARTIAL_INDEX_INTERSECT_INFO::init() instead of bzero() * remove constructor from READ_RECORD() to make it trivial * replace some memcpy() with c++ copy assignments
* | | Add likely/unlikely to speed up executionMonty2018-05-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Added to: - if (error) - Lex - sql_yacc.yy and sql_yacc_ora.yy - In header files to alloc() calls - Added thd argument to thd_net_is_killed()
* | | MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from ↵Vladislav Vaintroub2018-02-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'size_t' to 'type', possible loss of data) Handle string length as size_t, consistently (almost always:)) Change function prototypes to accept size_t, where in the past ulong or uint were used. change local/member variables to size_t when appropriate. This fix excludes rocksdb, spider,spider, sphinx and connect for now.
* | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-10-041-4/+4
|\ \ \ | |/ /
| * | MDEV-13384 - misc Windows warnings fixedVladislav Vaintroub2017-09-281-2/+2
| | |
| * | MDEV-13844 : Fix Windows warnings. Fix DBUG_PRINT.Vladislav Vaintroub2017-09-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix win64 pointer truncation warnings (usually coming from misusing 0x%lx and long cast in DBUG) - Also fix printf-format warnings Make the above mentioned warnings fatal. - fix pthread_join on Windows to set return value.
* | | Merge branch 'bb-10.2-ext' into 10.3Sergei Golubchik2017-08-261-1/+1
|\ \ \ | |/ /
| * | Merge branch '10.1' into 10.2Sergei Golubchik2017-08-171-1/+1
| |\ \ | | |/
| | * MDEV-13179 main.errors fails with wrong errnoMonty2017-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that the introduction of max-thread-mem-used can cause an allocation error very early, even before mysql_parse() is called. As mysql_parse() calls thd->reset_for_next_command(), which called clear_error(), the error number was lost. Fixed by adding an option to have unique messages for each KILL signal and change max-thread-mem-used to use this new feature. This removes a lot of problems with the original approach, where one could get errors signaled silenty almost any time. ixed by moving clear_error() from reset_for_next_command() to do_command(), before any memory allocation for the thread. Related changes: - reset_for_next_command() now have an optional parameter if we should call clear_error() or not. By default it's called, but not anymore from dispatch_command() which was the original problem. - Added optional paramater to clear_error() to force calling of reset_diagnostics_area(). Before clear_error() only called reset_diagnostics_area() if there was no error, so we normally called reset_diagnostics_area() twice. - This change removed several duplicated calls to clear_error() when starting a query. - Reset max_mem_used on COM_QUIT, to protect against kill during quit. - Use fatal_error() instead of setting is_fatal_error (cleanup) - Set fatal_error if max_thead_mem_used is signaled. (Same logic we use for other places where we are out of resources)
* | | Remove dumping of some not needed core's when running test suiteMichael Widenius2017-08-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before this patch running full mtr generated some 70 cores (at least on systemd). Now no cores should be generated. - Changed DBUG_ABORT()'s used by mysql-test-run to DBUG_SUICIDE() - Changed DBUG_ABORT() used to crash server with core to DBUG_ASSERT(0) - DBUG_ASSERT now flushes DBUG files
* | | Enusure that my_global.h is included firstMichael Widenius2017-08-241-1/+1
|/ / | | | | | | | | | | | | | | | | | | - Added sql/mariadb.h file that should be included first by files in sql directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables that must be done before my_global.h is included) - Removed a lot of include my_global.h from include files - Removed include's of some files that my_global.h automatically includes - Removed duplicated include's of my_sys.h - Replaced include my_config.h with my_global.h
* | MDEV-6353 my_ismbchar() and my_mbcharlen() refactoringAlexander Barkov2016-05-171-27/+30
|/
* - Renaming variables so that they don't shadow others (After this patch one ↵Monty2015-07-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | can compile with -Wshadow and get much fewer warnings) - Changed ER(ER_...) to ER_THD(thd, ER_...) when thd was known or if there was many calls to current_thd in the same function. - Changed ER(ER_..) to ER_THD_OR_DEFAULT(current_thd, ER...) in some places where current_thd is not necessary defined. - Removing calls to current_thd when we have access to thd Part of this is optimization (not calling current_thd when not needed), but part is bug fixing for error condition when current_thd is not defined (For example on startup and end of mysqld) Notable renames done as otherwise a lot of functions would have to be changed: - In JOIN structure renamed: examined_rows -> join_examined_rows record_count -> join_record_count - In Field, renamed new_field() to make_new_field() Other things: - Added DBUG_ASSERT(thd == tmp_thd) in Item_singlerow_subselect() just to be safe. - Removed old 'tab' prefix in JOIN_TAB::save_explain_data() and use members directly - Added 'thd' as argument to a few functions to avoid calling current_thd.
* MDEV-6650 - LINT_INIT emits code in non-debug buildsSergey Vojtovich2015-03-161-2/+1
| | | | | Replaced all references to LINT_INIT with UNINIT_VAR and LINT_INIT_STRUCT. Removed LINT_INIT macro.
* MDEV-6582: DEBUG_SYNC does not reset mysys_var->current_mutex, causes ↵Kristian Nielsen2014-11-261-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | assertion "Trying to unlock mutex that wasn't locked" The bug was in DEBUG_SYNC. When waiting, debug_sync_execute() temporarily sets thd->mysys_var->current_mutex to a new value while waiting. However, if the old value of current_mutex was NULL, it was not restored, current_mutex remained set to the temporary value (debug_sync_global.ds_mutex). This made possible the following race: Thread T1 goes to KILL thread T2. In THD::awake(), T1 loads T2->mysys_var->current_mutex, it is set to ds_mutex, T1 locks this mutex. Now T2 runs, it does ENTER_COND, it sets T2->mysys_var->current_mutex to LOCK_wait_commit (for example). Then T1 resumes, it reloads mysys_var->current_mutex, now it is set to LOCK_wait_commit, T1 unlocks this mutex instead of the ds_mutex that it locked previously. This causes safe_mutex to assert with the message: "Trying to unlock mutex LOCK_wait_commit that wasn't locked". The fix is to ensure that DEBUG_SYNC also will restore mysys_var->current_mutex in the case where the original value was NULL.