summaryrefslogtreecommitdiff
path: root/mysys
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-12261 build failure without P_SSergei Golubchik2017-03-151-8/+6
| | | | | restore mysql_file_delete_with_symlink() but let it use new my_handler_delete_with_symlink() mysys helper.
* Merge branch '5.5' into 10.0Vicențiu Ciorbaru2017-03-081-1/+2
|\
| * mysql_client_test_nonblock fails when compiled with clangVicențiu Ciorbaru2017-03-081-1/+2
| | | | | | | | | | | | | | mysql_client uses some inline assembly code to switch thread stacks. This works, however tools that perform backtrace get confused to fix this we write a specific constant to signify bottom of stack. This constant is needed when compiling with CLang as well.
* | Post MDEV-11902 Fix test failures in maria and myisam storage enginesVicențiu Ciorbaru2017-03-031-1/+9
| | | | | | | | | | | | my_readline can fail due to missing file. Make my_readline report this condition separately so that we can catch it and report an appropriate error message to the user.
* | Merge branch '5.5' into 10.0Vicențiu Ciorbaru2017-03-0312-83/+194
|\ \ | |/
| * bugfix: remove my_delete_with_symlink()Sergei Golubchik2017-02-271-21/+0
| | | | | | | | | | | | 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.
| * race-condition safe implementation of mi_delete_table/maria_delete_tableSergei Golubchik2017-02-272-1/+29
| |
| * support MY_NOSYMLINKS in my_delete()Sergei Golubchik2017-02-274-84/+118
| |
| * MDEV-11902 mi_open race conditionSergei Golubchik2017-02-271-2/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TOCTOU bug. The path is checked to be valid, symlinks are resolved. Then the resolved path is opened. Between the check and the open, there's a window when one can replace some path component with a symlink, bypassing validity checks. Fix: after we resolved all symlinks in the path, don't allow open() to resolve symlinks, there should be none. Compared to the old MyISAM/Aria code: * fastpath. Opening of not-symlinked files is just one open(), no fn_format() and lstat() anymore. * opening of symlinked tables doesn't do fn_format() and lstat() either. it also doesn't to realpath() (which was lstat-ing every path component), instead if opens every path component with O_PATH. * share->data_file_name stores realpath(path) not readlink(path). So, SHOW CREATE TABLE needs to do lstat/readlink() now (see ::info()), and certain error messages (cannot open file "XXX") show the real file path with all symlinks resolved.
| * cleanup: NO_OPEN_3 was never definedSergei Golubchik2017-02-271-3/+1
| |
| * cleanup: mysys_test_invalid_symlinkSergei Golubchik2017-02-271-0/+9
| | | | | | | | | | Remove maria_test_invalid_symlink() and myisam_test_invalid_symlink(), introduce mysys_test_invalid_symlink(). Other engines might need it too
| * cleanup: my_register_filename()Sergei Golubchik2017-02-274-48/+19
| | | | | | | | | | | | | | | | | | Don't let my_register_filename() fail because strdup() failed. Better to have NULL for a filename, then to fail the already successful open(). Filenames are only used for error reporting and there was already code to ignore OOMs (my_fdopen()) and to cope with missing filenames (my_filename()).
| * cleanup: fn_format, remove dead codeSergei Golubchik2017-02-271-6/+1
| | | | | | | | my_realpath() ignores MY_xxx flags anyway
| * Fix for memory leak in applications, like QT,that callsMonty2017-01-272-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | my_thread_global_init() + my_thrad_global_end() repeatadily. This caused THR_KEY_mysys to be allocated multiple times. Deletion of THR_KEY_mysys was originally in my_thread_global_end() but was moved to my_end() as DBUG uses THR_KEY_mysys and DBUG is released after my_thread_global_end() is called. Releasing DBUG before my_thread_global_end() and move THR_KEY_mysys back into my_thread_global_end() could be a solution, but as safe_mutex and other things called by my_thread_global_end is using DBUG it may not be completely safe. To solve this, I used the simple solution to add a marker that THR_KEY_mysys is created and not re-create it in my_thread_global_init if it already exists.
* | Added a separate lock for start/stop/reset slave.Monty2017-02-281-2/+10
| | | | | | | | | | This solves some possible dead locks when one calls stop slave while slave is starting.
* | MDEV-9573 'Stop slave' hangs on replication slaveMonty2017-02-281-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for this is that stop slave takes LOCK_active_mi over the whole operation while some slave operations will also need LOCK_active_mi which causes deadlocks. Fixed by introducing object counting for Master_info and not taking LOCK_active_mi over stop slave or even stop_all_slaves() Another benefit of this approach is that it allows: - Multiple threads can run SHOW SLAVE STATUS at the same time - START/STOP/RESET/SLAVE STATUS on a slave will not block other slaves - Simpler interface for handling get_master_info() - Added some missing unlock of 'log_lock' in error condtions - Moved rpl_parallel_inactivate_pool(&global_rpl_thread_pool) to end of stop_slave() to not have to use LOCK_active_mi inside terminate_slave_threads() - Changed argument for remove_master_info() to Master_info, as we always have this available - Fixed core dump when doing FLUSH TABLES WITH READ LOCK and parallel replication. Problem was that waiting for pause_for_ftwrl was not done when deleting rpt->current_owner after a force_abort.
* | MDEV-4774 Strangeness with max_binlog_stmt_cache_size SettingsSachin Setiya2017-01-201-12/+60
| | | | | | | | | | | | | | | | | | | | Problem:- When setting max_binlog_stmt_cache_size=18446744073709547520 from either command line or .cnf file, server fails to start. Solution:- Added one more function eval_num_suffix_ull , which uses strtoull to get unsigned ulonglong from string. And getopt_ull calls this function instead of eval_num_suffix. Also changed previous eval_num_suffix to eval_num_suffix_ll to remain consistent.
* | Merge branch 'bb-10.0-vicentiu' into 10.0mariadb-10.0.29Vicențiu Ciorbaru2017-01-122-1/+83
|\ \ | | | | | | | | | | | | Extra merge commit due to intermediate commits pushed to 10.0 while merge was done.
| * \ Merge remote-tracking branch 'origin/5.5' into 10.0vicentiu2017-01-062-1/+83
| |\ \ | | |/
| | * MDEV-11676 Starting service with mysqld_safe_helper fails in SELINUX ↵Sergei Golubchik2017-01-041-1/+2
| | | | | | | | | | | | | | | | | | "enforcing" mode correct the error message in case of setuid/setgid failures
| | * move check_user/set_user from mysqld.cc to mysysSergei Golubchik2016-12-222-2/+83
| | |
* | | MDEV-11087 Search path for my.ini is wrong for default installationVladislav Vaintroub2017-01-061-1/+6
|/ / | | | | | | | | Add <install_root>/data/my.ini to the search path - this my.ini location is used since MariaDB 5.2
* | Merge branch '5.5' into 10.0Sergei Golubchik2016-09-291-3/+3
|\ \ | |/
| * MDEV-10907 MTR and server writes can interleave in the error logVladislav Vaintroub2016-09-271-3/+3
| | | | | | | | | | Ensure atomic appends to the error log by using CreateFile with FILE_APPEND_DATA flag to open error log file (both MTR and server)
* | Merge branch '5.5' into 10.0Sergei Golubchik2016-09-272-3/+5
|\ \ | |/
| * don't use my_copystat in the serverSergei Golubchik2016-09-122-3/+5
| | | | | | | | | | | | | | it was supposed to be used in command-line tools only. Different fix for 4e5473862e: Bug#24388746: PRIVILEGE ESCALATION AND RACE CONDITION USING CREATE TABLE
* | Fixed compiler error and some warnings on windowsMonty2016-08-231-1/+1
| |
* | Merge branch '5.5' into 10.0Sergei Golubchik2016-08-101-10/+7
|\ \ | |/
| * MDEV-10357 my_context_continue() does not store current fiber on WindowsVladislav Vaintroub2016-08-031-10/+7
| | | | | | | | | | Make sure current fiber is saved in my_context::app_fiber in both my_context_spawn() and my_context_continue()
* | [MDEV-9127] Crash reporter often fails to show the query that crashedVicențiu Ciorbaru2016-07-121-4/+26
| | | | | | | | | | | | | | | | Addreses are not necessarily between heap_start && heap_end. Malloc calls using mmap can place pointers outside these bounds. In this case, we'll warn the user that the query pointer is potentially invalid. However, we'll attempt to print the data anyway after we're done printing everything else.
* | Merge branch '5.5' into bb-10.0Sergei Golubchik2016-06-215-6/+10
|\ \ | |/
| * MDEV-9433: [PATCH} cppcheck reported a number of minor coding errorsDaniel Black2016-06-141-0/+1
| | | | | | | | | | | | Fix cppwarning of va_args being opened but not closed. Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
| * MDEV-9433: [PATCH] cppcheck reported a number of minor coding errorsDaniel Black2016-06-141-1/+3
| | | | | | | | | | | | | | | | Fix a bug in testhash.c that caused an out of bounds memory access when command line parameters specified 0 records to be inserted in the hashtable. Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
| * Merge branch 'mysql/5.5' into 5.5Sergei Golubchik2016-06-143-4/+6
| |\
| | * Bug#23251517: SEMISYNC REPLICATION HANGINGmysql-5.5.50Sujatha Sivakumar2016-05-162-16/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert following bug fix: Bug#20685029: SLAVE IO THREAD SHOULD STOP WHEN DISK IS FULL Bug#21753696: MAKE SHOW SLAVE STATUS NON BLOCKING IF IO THREAD WAITS FOR DISK SPACE This fix results in a deadlock between slave IO thread and SQL thread. (cherry picked from commit e3fea6c6dbb36c6ab21c4ab777224560e9608b53)
| | * Bug#22897202: RPL_IO_THD_WAIT_FOR_DISK_SPACE HAS OCCASIONALSujatha Sivakumar2016-04-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FAILURES Analysis: ========= Test script is not ensuring that "assert_grep.inc" should be called only after 'Disk is full' error is written to the error log. Test checks for "Queueing master event to the relay log" state. But this state is set before invoking 'queue_event'. Actual 'Disk is full' error happens at a very lower level. It can happen that we might even reset the debug point before even the actual disk full simulation occurs and the "Disk is full" message will never appear in the error log. In order to guarentee that we must have some mechanism where in after we write "Disk is full" error messge into the error log we must signal the test to execute SSS and then reset the debug point. So that test is deterministic. Fix: === Added debug sync point to make script deterministic.
| | * BUG#22594514: HANDLE_FATAL_SIGNAL (SIG=11) INNisha Gopalakrishnan2016-03-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UNIQUE::~UNIQUE | SQL/UNIQUES.CC:355 Analysis ======== Enabling the sort_buffer_size with a large value can cause operations utilizing the sort buffer like DELETE as mentioned in the bug report to fail. 5.5 and 5.6 versions reports OOM error while in 5.7+, the server crashes. While initializing the mem_root for the sort buffer tree, the block size for the mem_root is determined from the 'sort_buffer_size' value. This unsigned long value is typecasted to unsigned int, hence it becomes zero. Further block_size computation while initializing the mem_root results in a very large block_size value. Hence while trying to allocate a block during the DELETE operation, an OOM error is reported. In case of 5.7+, the PFS instrumentation for memory allocation, overshoots the unsigned value and allocates a block of just one byte. While trying to free the block of the mem_root, the original block_size is used. This triggers the crash since the server tries to free unallocated memory. Fix: ==== In order to restrict usage of such unreasonable sort_buffer_size, the typecast of block size to 'unsigned int' is removed and hence reports OOM error across all versions for sizes exceeding unsigned int range.
| | * Bug#20685029: SLAVE IO THREAD SHOULD STOP WHEN DISK ISSujatha Sivakumar2016-03-012-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FULL Bug#21753696: MAKE SHOW SLAVE STATUS NON BLOCKING IF IO THREAD WAITS FOR DISK SPACE Problem: ======== Currently SHOW SLAVE STATUS blocks if IO thread waits for disk space. This makes automation tools verifying server health block on taking relevant action. Finally this will create SHOW SLAVE STATUS piles. Analysis: ========= SHOW SLAVE STATUS hangs on mi->data_lock if relay log write is waiting for free disk space while holding mi->data_lock. mi->data_lock is needed to protect the format description event (mi->format_description_event) which is accessed by the clients running FLUSH LOGS and slave IO thread. Note relay log writes don't need to be protected by mi->data_lock, LOCK_log is used to protect relay log between IO and SQL thread (see MYSQL_BIN_LOG::append_event). The code takes mi->data_lock to protect mi->format_description_event during relay log rotate which might get triggered right after relay log write. Fix: ==== Release the data_lock just for the duration of writing into relay log. Made change to ensure the following lock order is maintained to avoid deadlocks. data_lock, LOCK_log data_lock is held during relay log rotations to protect the description event.
| | * Bug#21770366 backport bug#21657078 to 5.5 and 5.6Jon Olav Hauglid2016-01-261-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Post-push fix: The problem was that condition variable timeouts could in some cases (slow machines and/or short timeouts) be infinite. When the number of milliseconds to wait is computed, the end time is computed before the now() time. This can result in the now() time being later than the end time, leading to negative timeout. Which after conversion to unsigned becomes ~infinite. This patch fixes the problem by explicitly checking if we get negative timeout and then using 0 if this is the case.
* | | MDEV-10001 my_b_seek() may not work correctly after my_b_read() hits EOFSergei Golubchik2016-06-151-0/+3
| | | | | | | | | | | | applied the patch from David Gow
* | | Merge branch 'mdev9991' into mdev9991-10.0Kristian Nielsen2016-06-081-2/+2
|\ \ \ | |/ /
| * | Fix compiler check for stack unwind hintKristian Nielsen2016-06-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The check inserts a DWARF directive to tell stack unwinding that the bottom of the (co-routine) stack has been reached. Without this, stack traces may attempt to continue past the bottom of the stack. The GCC version check was incorrect, and failed to trigger for GCC version 5.[0123].
* | | Merge branch '5.5' into 10.0Sergei Golubchik2016-04-261-1/+0
|\ \ \ | |/ /
| * | MDEV-9748 Include Twin (mysys_err.h is included twice in mysys/my_copy.c)Sergei Golubchik2016-04-191-1/+0
| | |
* | | MDEV-9773: Memory corruption in mariadb_dyncol_unpackOleksandr Byelkin2016-03-241-1/+1
| | | | | | | | | | | | Fixed calculating pointer to memory allocated for names in numeric format in unpacking procedure.
* | | Merge branch '5.5' into 10.0Sergei Golubchik2016-03-211-1/+8
|\ \ \ | |/ /
| * | MDEV-9733 Server crashes in lf_pinbox_real_free on replication slavesSergei Golubchik2016-03-171-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | don't allocate all the stack, leave some stack for function calls. To test I added the following line: alloca_size = available_stack_size() - X at X=4096 or less mysqld crashed, at 8192 mtr test passed.
* | | Fix spelling: occurred, execute, which etcOtto Kekäläinen2016-03-045-6/+6
| | |
* | | Merge branch '5.5' into 10.0Sergei Golubchik2016-02-155-12/+14
|\ \ \ | |/ /
| * | fix my_gethwaddr() for solarisSergei Golubchik2016-02-151-1/+1
| | | | | | | | | | | | it caused feedback plugin tests to fail