This fixed the MySQL bug# 20338 about misuse of double underscore
prefix __WIN__, which was old MySQL's idea of identifying Windows
Replace it by _WIN32 standard symbol for targeting Windows OS
(both 32 and 64 bit)
Not that connect storage engine is not fixed in this patch (must be
fixed in "upstream" branch)
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.
If compiling a non DBUG binary with
-DDBUG_ASSERT_AS_PRINTF asserts will be
changed to printf + stack trace (of stack
trace are enabled).
- Changed #ifndef DBUG_OFF to
#ifdef DBUG_ASSERT_EXISTS
for those DBUG_OFF that was just used to enable
assert
- Assert checking that could greatly impact
performance where changed to DBUG_ASSERT_SLOW which
is not affected by DBUG_ASSERT_AS_PRINTF
- Added one extra option to my_print_stacktrace() to
get more silent in case of stack trace printing as
part of assert.
- 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
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.
in cmake tests let's treat clang like gcc (same options,
same builtins) in many cases.
* don't check the compiler when
* testing for -fvisibility=hidden support
* testing for HAVE_ABI_CXA_DEMANGLE
* testing for HAVE_GCC_ATOMIC_BUILTINS
* when removing options with string(replace)
* when running ${CC} --version (ignore the error instead)
* run ABI checks for clang
* use "canonical" gcc flags for clang
* fix groonga too
Also:
* add cmake detection for gcc __atomic_* builtins. they might be
supported (__ATOMIC_SEQ_CST is defined), but not for all operand
sizes. In particular, 64-bit atomic load is problematic on i386
* cache check results for Windows
* remove the test for HAVE_CXXABI_H (HAVE_ABI_CXA_DEMANGLE is
suffifient)
Fixed compilation problem on windows.
configure.cmake:
Added test for pthread_attr_getguardsize
include/my_stacktrace.h:
Define dummy my_init_stacktrace() to allow one to call it without #ifdef HAVE_STACKTRACE
sql/mysqld.cc:
Move my_setstacksize() to fix compilation problem on windows
Don't disable core on signal just becasue platform doesn't handle stack trace
Fixed README with link to source
Merged InnoDB change to XtraDB
README:
Added information of where to find MariaDB code
storage/archive/ha_archive.cc:
Removed memset() of rows, a MariaDB checksum's doesn't touch not used data.
fix safemalloc to compile w/o libbfd.
CMakeLists.txt:
NOT_FOR_DISTRIBUTION option
cmake/readline.cmake:
simplify libedit/readline detection.
never use bundled libedit.
use system readline v6 only if NOT_FOR_DISTRIBUTION=1
configure.cmake:
use libbfd only if NOT_FOR_DISTRIBUTION=1
include/my_stacktrace.h:
link with libbfd even w/o safemalloc.
handle_segfault is the signal handler code of mysqld. however, it makes
calls to potentially unsafe functions localtime_r, fprintf, fflush.
include/my_stacktrace.h:
Add safe versions of itoa() write() and snprintf().
libmysqld/CMakeLists.txt:
Move signal handler to separate file.
mysys/stacktrace.c:
Remove unsafe function calls.
sql/CMakeLists.txt:
Move signal handler to separate file.
sql/mysqld.cc:
Move signal handler to separate file.
sql/set_var.h:
Add missing #include dependency.
sql/sys_vars.cc:
Cleanup .h and .cc files.
sql/sys_vars.h:
Cleanup .h and .cc files.
handle_segfault is the signal handler code of mysqld. however, it makes
calls to potentially unsafe functions localtime_r, fprintf, fflush.
include/my_stacktrace.h:
Add safe versions of itoa() write() and snprintf().
libmysqld/CMakeLists.txt:
Move signal handler to separate file.
mysys/stacktrace.c:
Remove unsafe function calls.
sql/CMakeLists.txt:
Move signal handler to separate file.
sql/Makefile.am:
Move signal handler to separate file.
sql/mysqld.cc:
Move signal handler to separate file.
sql/signal_handler.cc:
Remove unsafe function calls.
The problem is that the logic which checks if a pointer is
valid relies on a poor heuristic based on the start and end
addresses of the data segment and heap.
Apart from miscalculating the heap bounds, this approach also
suffers from the fact that memory can come from places other
than the heap. See Bug#58528 for a more detailed explanation.
On Linux, the solution is to access the process's memory
through /proc/self/task/<tid>/mem, which allows for retrieving
the contents of pages within the virtual address space of
the calling process. If a address range is not mapped, a
input/output error is returned.
client/mysqltest.cc:
Use new interface to my_safe_print_str.
include/my_stacktrace.h:
Drop name from my_safe_print_str.
mysys/stacktrace.c:
Access the process's memory through a file descriptor and
dump the contents of the memory range. The file descriptor
offset is equivalent to a offset into the address space.
Do not print the name of the variable associated with the
address. It can be better accomplished at a higher level.
sql/mysqld.cc:
Put the variable dumping information within its own newline block.
Use symbolic names which better convey information to the user.
Another problem is that the backtrace facility wasn't being
enabled for non-Linux targets even if the target OS has the
backtrace functions. Also, the stacktrace functions inside
mysqltest were being used without proper checks for their
presence in the build.
client/mysqltest.c:
Only use stacktrace functions if they are available.
configure.in:
Check if the compiler defines __bss_start
include/my_stacktrace.h:
Enable stacktrace if system has backtrace functions.
mysys/stacktrace.c:
Use backtrace functions if the system supports it.
sql/mysqld.cc:
Only use stacktrace functions if they are available.
The problem was that when a embedded linked version of mysqltest
crashed there was no way to obtain a stack trace if no core file
is available. Another problem is that the embedded version of
libmysql was not behaving (crash) the same as the non-embedded with
respect to sending commands to a explicitly closed connection.
The solution is to generate a mysqltest's stack trace on crash
and to enable "reconnect" if the connection handle was explicitly
closed so the behavior matches the non-embedded one.
client/CMakeLists.txt:
Link mysys to mysqltest.
client/Makefile.am:
Link mysys to mysqltest.
client/mysqltest.c:
Add fatal signal handling with backtracing for Unix and Windows.
configure.in:
Add check for weak symbols support and remove a spurious word.
include/Makefile.am:
Add new header with prototype for stack tracing functions.
include/my_stacktrace.h:
Add new header with prototype for stack tracing functions.
libmysqld/CMakeLists.txt:
stack tracing is now part of mysys.
libmysqld/Makefile.am:
stack tracing is now part of mysys.
libmysqld/lib_sql.cc:
Re-connect if connection was explicitly closed. This is
done to match the behavior of the non-embeded libmysql.
mysql-test/t/sql_low_priority_updates_func.test:
Test expects parallelism between queries that cannot be
guaranteed under embedded.
mysys/CMakeLists.txt:
Add stacktrace to mysys.
mysys/Makefile.am:
Add stacktrace to mysys.
mysys/stacktrace.c:
Move stacktrace to mysys and add weak symbol for the
C++ name de-mangling function so that it can later be
overridden in C++ code. Also add my_ prefix to exported
functions.
sql/CMakeLists.txt:
stacktrace was moved to mysys.
sql/Makefile.am:
stacktrace was moved to mysys.
sql/mysqld.cc:
Add my_ prefix to mysys functions.