summaryrefslogtreecommitdiff
path: root/mysys
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-29613 Improve WITH_DBUG_TRACE=OFFMarko Mäkelä2022-09-231-3/+3
| | | | | | | | | | | | | | | 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
* Merge branch '10.3' into 10.4Oleksandr Byelkin2022-07-271-7/+6
|\
| * MDEV-28746 Wrong error code ER_BAD_DB_ERROR for long filenamesVladislav Vaintroub2022-07-071-7/+6
| | | | | | | | Add check for path length if CreateFile fails with ERROR_PATH_NOT_FOUND.
* | Merge 10.3 into 10.4Marko Mäkelä2022-06-271-1/+1
|\ \ | |/
| * MDEV-22590 SIGSEGV in flush_all_key_blocks when changing key_buffer_size / ↵Oleksandr Byelkin2022-06-241-1/+1
| | | | | | | | | | | | | | | | ASAN: heap-use-after-free in flush_all_key_blocks Take into account that in preparation of a simple key cache for resizing no disk blocks might be assigned to it. Reviewer: IgorBabaev <igor@mariadb.com>
* | Merge 10.3 into 10.4Marko Mäkelä2022-03-291-3/+6
|\ \ | |/
| * MDEV-28178 Windows : sporadic ER_ERROR_ON_RENAME .. (errno: 13 "Permission ↵Vladislav Vaintroub2022-03-281-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | denied") On affected machine, the error happens sporadically in innodb.instant_alter_limit. Procmon shows SetRenameInformationFile failing with ERROR_ACCESS_DENIED. In this case, the destination file was previously opened rsp oplocked by Windows defender antivirus. The fix is to retry MoveFileEx on ERROR_ACCESS_DENIED.
| * Merge branch 10.2 into 10.3Julius Goryavsky2021-12-231-2/+24
| |\
| | * MDEV-23175: my_timer_milliseconds clock_gettime for multiple platfomrsbb-10.2-MDEV-23175-backportDaniel Black2021-12-221-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Small postfix to MDEV-23175 to ensure faster option on FreeBSD and compatibility to Solaris that isn't high resolution. ftime is left as a backup in case an implementation doesn't contain any of these clocks. FreeBSD $ ./unittest/mysys/my_rdtsc-t 1..11 # ----- Routine --------------- # myt.cycles.routine : 5 # myt.nanoseconds.routine : 11 # myt.microseconds.routine : 13 # myt.milliseconds.routine : 11 # myt.ticks.routine : 17 # ----- Frequency ------------- # myt.cycles.frequency : 3610295566 # myt.nanoseconds.frequency : 1000000000 # myt.microseconds.frequency : 1000000 # myt.milliseconds.frequency : 899 # myt.ticks.frequency : 136 # ----- Resolution ------------ # myt.cycles.resolution : 1 # myt.nanoseconds.resolution : 1 # myt.microseconds.resolution : 1 # myt.milliseconds.resolution : 7 # myt.ticks.resolution : 1 # ----- Overhead -------------- # myt.cycles.overhead : 26 # myt.nanoseconds.overhead : 19140 # myt.microseconds.overhead : 19036 # myt.milliseconds.overhead : 578 # myt.ticks.overhead : 21544 ok 1 - my_timer_init() did not crash ok 2 - The cycle timer is strictly increasing ok 3 - The cycle timer is implemented ok 4 - The nanosecond timer is increasing ok 5 - The nanosecond timer is implemented ok 6 - The microsecond timer is increasing ok 7 - The microsecond timer is implemented ok 8 - The millisecond timer is increasing ok 9 - The millisecond timer is implemented ok 10 - The tick timer is increasing ok 11 - The tick timer is implemented
* | | MDEV-23175: my_timer_milliseconds clock_gettime for multiple platfomrsbb-10.4-MDEV-23175-backportDaniel Black2021-12-221-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Small postfix to MDEV-23175 to ensure faster option on FreeBSD and compatibility to Solaris that isn't high resolution. ftime is left as a backup in case an implementation doesn't contain any of these clocks. FreeBSD $ ./unittest/mysys/my_rdtsc-t 1..11 # ----- Routine --------------- # myt.cycles.routine : 5 # myt.nanoseconds.routine : 11 # myt.microseconds.routine : 13 # myt.milliseconds.routine : 11 # myt.ticks.routine : 17 # ----- Frequency ------------- # myt.cycles.frequency : 3610295566 # myt.nanoseconds.frequency : 1000000000 # myt.microseconds.frequency : 1000000 # myt.milliseconds.frequency : 899 # myt.ticks.frequency : 136 # ----- Resolution ------------ # myt.cycles.resolution : 1 # myt.nanoseconds.resolution : 1 # myt.microseconds.resolution : 1 # myt.milliseconds.resolution : 7 # myt.ticks.resolution : 1 # ----- Overhead -------------- # myt.cycles.overhead : 26 # myt.nanoseconds.overhead : 19140 # myt.microseconds.overhead : 19036 # myt.milliseconds.overhead : 578 # myt.ticks.overhead : 21544 ok 1 - my_timer_init() did not crash ok 2 - The cycle timer is strictly increasing ok 3 - The cycle timer is implemented ok 4 - The nanosecond timer is increasing ok 5 - The nanosecond timer is implemented ok 6 - The microsecond timer is increasing ok 7 - The microsecond timer is implemented ok 8 - The millisecond timer is increasing ok 9 - The millisecond timer is implemented ok 10 - The tick timer is increasing ok 11 - The tick timer is implemented
* | | Merge branch '10.3' into 10.4Sergei Golubchik2021-12-072-5/+9
|\ \ \ | |/ /
| * | Merge branch '10.2' into 10.3Sergei Golubchik2021-12-062-5/+9
| |\ \ | | |/
| | * MDEV-27088: Server crash on ARM (WMM architecture) due to missing barriers ↵Martin Beck2021-11-302-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in lf-hash MariaDB server crashes on ARM (weak memory model architecture) while concurrently executing l_find to load node->key and add_to_purgatory to store node->key = NULL. l_find then uses key (which is NULL), to pass it to a comparison function. The specific problem is the out-of-order execution that happens on a weak memory model architecture. Two essential reorderings are possible, which need to be prevented. a) As l_find has no barriers in place between the optimistic read of the key field lf_hash.cc#L117 and the verification of link lf_hash.cc#L124, the processor can reorder the load to happen after the while-loop. In that case, a concurrent thread executing add_to_purgatory on the same node can be scheduled to store NULL at the key field lf_alloc-pin.c#L253 before key is loaded in l_find. b) A node is marked as deleted by a CAS in l_delete lf_hash.cc#L247 and taken off the list with an upfollowing CAS lf_hash.cc#L252. Only if both CAS succeed, the key field is written to by add_to_purgatory. However, due to a missing barrier, the relaxed store of key lf_alloc-pin.c#L253 can be moved ahead of the two CAS operations, which makes the value of the local purgatory list stored by add_to_purgatory visible to all threads operating on the list. As the node is not marked as deleted yet, the same error occurs in l_find. This change three accesses to be atomic. * optimistic read of key in l_find lf_hash.cc#L117 * read of link for verification lf_hash.cc#L124 * write of key in add_to_purgatory lf_alloc-pin.c#L253 Reviewers: Sergei Vojtovich, Sergei Golubchik Fixes: MDEV-23510 / d30c1331a18d875e553f3fcf544997e4f33fb943
* | | Merge 10.3 into 10.4Marko Mäkelä2021-10-281-2/+2
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2021-10-281-2/+2
| |\ \ | | |/
| | * Safemalloc typo fix found by clang.Oleksandr Byelkin2021-10-261-2/+2
| | |
* | | Merge 10.3 into 10.4Marko Mäkelä2021-10-211-0/+4
|\ \ \ | |/ /
| * | Link with libatomic to enable C11 atomics supportVicențiu Ciorbaru2021-10-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some architectures (mips) require libatomic to support proper atomic operations. Check first if support is available without linking, otherwise use the library. Contributors: James Cowgill <jcowgill@debian.org> Jessica Clarke <jrtc27@debian.org> Vicențiu Ciorbaru <vicentiu@mariadb.org>
* | | Merge 10.3 into 10.4Marko Mäkelä2021-10-131-0/+7
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2021-10-131-0/+7
| |\ \ | | |/
| | * Xcode compatibility updateSergei Krivonos2021-10-121-0/+7
| | |
* | | Merge branch '10.3' into 10.4Vladislav Vaintroub2021-09-242-1/+117
|\ \ \ | |/ /
| * | MDEV-11499 mysqltest, Windows : improve diagnostics if server fails to shutdownVladislav Vaintroub2021-09-242-2/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create minidump when server fails to shutdown. If process is being debugged, cause a debug break. Moves some code which is part of safe_kill into mysys, as both safe_kill, and mysqltest produce minidumps on different timeouts. Small cleanup in wait_until_dead() - replace inefficient loop with a single wait.
* | | MDEV-26601: mysys - O_TMPFILE ^ O_CREATDaniel Black2021-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Thanks to Fabian Vogt for noticing the mutual exclusions of these open flags on tmpfs caused by mariadb opening it incorrectly. As such we clear the O_CREAT flag while opening it as O_TMPFILE.
* | | Merge 10.3 into 10.4Marko Mäkelä2021-08-311-3/+3
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2021-08-311-3/+3
| |\ \ | | |/
| | * Fix GCC 11 -Wmaybe-uninitialized for PLUGIN_PERFSCHEMAMarko Mäkelä2021-08-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | init_mutex_v1_t: Stop lying that the mutex parameter is const. GCC 11.2.0 assumes that it is and could complain about any mysql_mutex_t being uninitialized even after mysql_mutex_init() as long as PLUGIN_PERFSCHEMA is enabled. init_rwlock_v1_t, init_cond_v1_t: Remove untruthful const qualifiers. Note: init_socket_v1_t is expecting that the socket fd has already been created before PSI_SOCKET_CALL(init_socket), and therefore that parameter really is being treated as a pointer to const.
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2021-07-311-1/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2021-07-271-1/+1
| |\ \ | | |/
| | * fix clang build: check alignment the other wayEugene Kosov2021-07-261-1/+1
| | |
* | | Merge 10.3 into 10.4Marko Mäkelä2021-06-211-2/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2021-06-211-2/+1
| |\ \ | | |/
| | * fix clang buildEugene Kosov2021-06-151-2/+1
| | | | | | | | | | | | a new warning -Wunused-but-set-variable was introduced recently to clang
* | | Merge branch bb-10.3-release into bb-10.4-releaseNikita Malyavin2021-05-051-6/+27
|\ \ \ | |/ /
| * | Merge branch bb-10.2-release into bb-10.3-releaseNikita Malyavin2021-05-041-6/+27
| |\ \ | | |/
| | * MDEV-25584 Implement posix semantics file deletion for Windows 10Vladislav Vaintroub2021-05-031-6/+27
| | |
* | | MDEV-22227 Assertion `state_ == s_exec' failed in ↵bb-10.4-MDEV-22227mkaruza2021-04-281-127/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wsrep::client_state::start_transaction Removed redundant code for BF abort transaction in `thr_lock.cc`. TOI operations will ignore provided lock_wait_timeout and use `LONG_TIMEOUT` until operation is finished. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
* | | Merge 10.3 into 10.4Marko Mäkelä2021-04-211-1/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2021-04-211-1/+1
| |\ \ | | |/
| | * MDEV-15064: IO_CACHE mysys read_pos, not libmaria rc_posbb-10.2-danielblack-MDEV-15064-IO_CACHE-read_posRainer Orth2021-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | It seems some overly tolerant compilers (gcc) allow the structure of IO_CACHE that is defined differently in libmaria to have members equalivance to the iocache in mysys. More strict Solaris compilers recognise that rc_pos really isn't a structure member and won't compile.
* | | Fix all warnings given by UBSANMonty2021-04-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The easiest way to compile and test the server with UBSAN is to run: ./BUILD/compile-pentium64-ubsan and then run mysql-test-run. After this commit, one should be able to run this without any UBSAN warnings. There is still a few compiler warnings that should be fixed at some point, but these do not expose any real bugs. The 'special' cases where we disable, suppress or circumvent UBSAN are: - ref10 source (as here we intentionally do some shifts that UBSAN complains about. - x86 version of optimized int#korr() methods. UBSAN do not like unaligned memory access of integers. Fixed by using byte_order_generic.h when compiling with UBSAN - We use smaller thread stack with ASAN and UBSAN, which forced me to disable a few tests that prints the thread stack size. - Verifying class types does not work for shared libraries. I added suppression in mysql-test-run.pl for this case. - Added '#ifdef WITH_UBSAN' when using integer arithmetic where it is safe to have overflows (two cases, in item_func.cc). Things fixed: - Don't left shift signed values (byte_order_generic.h, mysqltest.c, item_sum.cc and many more) - Don't assign not non existing values to enum variables. - Ensure that bool and enum values are properly initialized in constructors. This was needed as UBSAN checks that these types has correct values when one copies an object. (gcalc_tools.h, ha_partition.cc, item_sum.cc, partition_element.h ...) - Ensure we do not called handler functions on unallocated objects or deleted objects. (events.cc, sql_acl.cc). - Fixed bugs in Item_sp::Item_sp() where we did not call constructor on Query_arena object. - Fixed several cast of objects to an incompatible class! (Item.cc, Item_buff.cc, item_timefunc.cc, opt_subselect.cc, sql_acl.cc, sql_select.cc ...) - Ensure we do not do integer arithmetic that causes over or underflows. This includes also ++ and -- of integers. (Item_func.cc, Item_strfunc.cc, item_timefunc.cc, sql_base.cc ...) - Added JSON_VALUE_UNITIALIZED to json_value_types and ensure that value_type is initialized to this instead of to -1, which is not a valid enum value for json_value_types. - Ensure we do not call memcpy() when second argument could be null. - Fixed that Item_func_str::make_empty_result() creates an empty string instead of a null string (safer as it ensures we do not do arithmetic on null strings). Other things: - Changed struct st_position to an OBJECT and added an initialization function to it to ensure that we do not copy or use uninitialized members. The change to a class was also motived that we used "struct st_position" and POSITION randomly trough the code which was confusing. - Notably big rewrite in sql_acl.cc to avoid using deleted objects. - Changed in sql_partition to use '^' instead of '-'. This is safe as the operator is either 0 or 0x8000000000000000ULL. - Added check for select_nr < INT_MAX in JOIN::build_explain() to avoid bug when get_select() could return NULL. - Reordered elements in POSITION for better alignment. - Changed sql_test.cc::print_plan() to use pointers instead of objects. - Fixed bug in find_set() where could could execute '1 << -1'. - Added variable have_sanitizer, used by mtr. (This variable was before only in 10.5 and up). It can now have one of two values: ASAN or UBSAN. - Moved ~Archive_share() from ha_archive.cc to ha_archive.h and marked it virtual. This was an effort to get UBSAN to work with loaded storage engines. I kept the change as the new place is better. - Added in CONNECT engine COLBLK::SetName(), to get around a wrong cast in tabutil.cpp. - Added HAVE_REPLICATION around usage of rgi_slave, to get embedded server to compile with UBSAN. (Patch from Marko). - Added #ifdef for powerpc64 to avoid a bug in old gcc versions related to integer arithmetic. Changes that should not be needed but had to be done to suppress warnings from UBSAN: - Added static_cast<<uint16_t>> around shift to get rid of a LOT of compiler warnings when using UBSAN. - Had to change some '/' of 2 base integers to shift to get rid of some compile time warnings. Reviewed by: - Json changes: Alexey Botchkov - Charset changes in ctype-uca.c: Alexander Barkov - InnoDB changes & Embedded server: Marko Mäkelä - sql_acl.cc changes: Vicențiu Ciorbaru - build_explain() changes: Sergey Petrunia
* | | Merge 10.3 into 10.4Marko Mäkelä2021-03-201-1/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2021-03-191-1/+1
| |\ \ | | |/
| | * myseek: AIX has no "tell"bb-10.2-danielblack-aix-notellDaniel Black2021-03-191-1/+1
| | | | | | | | | | | | | | | | | | AIX detects tell in the configure however it really isn't there. Use the my_seek aka lseek implementation.
* | | Merge 10.3 into 10.4Marko Mäkelä2021-03-051-21/+34
|\ \ \ | |/ /
| * | MENT-1098 Crash during update on 10.4.17 after upgrade from 10.4.10Monty2021-02-251-21/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for the crash was that there was not a write lock to protect against file rotations in the server_audit plugin after an audit plugin patch to changed audit mutexes to read & write locks. The fixes are: * Moving server_audit.c to use read & write locks (which improves performance). * Added functionality in file_logger.c to not do file rotations until it is allowed by the caller (done without any interface changes for the logging service). * Move checking of file size limit to server_audit.c and if it is time to do a rotation change the read lock to a write lock and tell file_logger that it is now allowed to rotate the log files.
* | | Merge branch '10.3' into 10.4Daniel Black2021-02-251-1/+1
|\ \ \ | |/ /
| * | mysys: lf_hash - fix l_search size_t keylenDaniel Black2021-02-251-1/+1
| | | | | | | | | | | | Correcting an incorrect merge from 10.2
* | | Merge branch '10.3' into 10.4Daniel Black2021-02-251-15/+15
|\ \ \ | |/ /
| * | Merge remote-tracking branch 'origin/10.2' into 10.3Daniel Black2021-02-251-15/+15
| |\ \ | | |/