Miscellaneous workarounds for drop-in compatibility problems with Linux distributions, arounf versioning of the
MySQL 5.5 client shared library. There seems to be 3 different ways major distributions handle versioning
1. Fedora (also Mageia, and likely other Redhat descendants) way
old, 5.1 API functions are given version libmysqlclient_16
new API functions (client plugins, mysql_stmt_next ) are given version libmysqlclient_18
some extra functions beyond API are exported.
some functions are renamed.
2.Debian Wheezy way
all functions are given libmysqlclient_18 version
3. Ubuntu way (or MySQL/MariaDB download packages)
no versioning
UIp to this fix, MariaDB distributions did not have any versioning in the libraries, this rendered client library incompatible to distributions
thus exchanging distribution's libmysqlclient.so.18.0.0 with MariaDB's did not work nicely (anywhere but on Ubuntu)
THE FIX
is to build libraries the same way as distributions do it
- when building RPMs, use same version script as Fedora does, Make sure to export extra-symbols, the same as Fedora exports.
- when building DEBs, use the same version script as Debian Wheezy
- do not use version scripts otherwise
Also, makes sure that extensions of MySQL APIs (asynchronous client functionality) is exported by the shared libraries.
Background :
In mysql-5.1, in a fix for bug#47485, code has been changed for
mysql client (libmysql/libmysql.c) but corresponding code was not
changed for embedded mysql. In that code change, after execution
of a statement, mysql_stmt_store_result() checks for mysql->state
to be MYSQL_STATUS_STATEMENT_GET_RESULT, instead of
MYSQL_STATUS_GET_RESULT (earlier).
Reason:
In embedded mysql code, after execution, mysql->state was not
set to MYSQL_STATUS_STATEMENT_GET_RESULT, so it was throwing
OUT_OF_SYNC error.
Fix:
Fixed the code in libmysqld/lib_sql.cc to have mysql->state
to be set to MYSQL_STATUS_STATEMENT_GET_RESULT after execution.
mysql-test/suite/innodb/t/group_commit_crash.test:
remove autoincrement to avoid rbr being used for insert ... select
mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test:
remove autoincrement to avoid rbr being used for insert ... select
mysys/my_addr_resolve.c:
a pointer to a buffer is returned to the caller -> the buffer cannot be on the stack
mysys/stacktrace.c:
my_vsnprintf() is ok here, in 5.5
modified for MySQL 5.5. Logger service moved to the
plugin/sql_errlog directory to be properly used later.
plugin/sql_errlog/sql_errlog.c:
Fixes for bugs #956427 (SQL_ERROR_LOG plugin produces bogus warnings about sql-error-log-size-limit value) and #956463 (Server crashes if SQL_ERROR_LOG fails to initialize) they're also MDEV-184 and MDEV-183
The sql_error_log_deinit() should be prepared for the logger_file to be NULL.
The logger_file_size_limit upper limit wasn't properly set.
- Mark test components, plugins etc with COMPONENT Test, to get them excluded from the MSI
- Only include debug symbols for client and embedded libs and also
mysqld.exe and server plugins (so we can still can get a callstack in case of crash)
The rest (all *.pdbs, test components, MTR) can be obtained from the big ZIP distribution, if required.
The file uses external variables defined in another (C++) source file. Since MSVC mangles variables and not only functions, either variables in question should be extern "C", or sql_logger should be made C++ for link to succeed.
Fixed by renaming sql_logger.c to sql_logger.cc
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.
2. dialog plugin now always returns mysql->password if non-empty and the first question is of password type
3. split get_tty_password into get_tty_password_buff and strdup.
4. dialog plugin now uses get_tty_password by default
5. dialog.test
6. moved small tests of individual plugins into a dedicated suite
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.
A variable XTRADB_PREFER_STATIC_LIBAIO should be set to 1 (or TRUE
or ON) for static linking.
Even if mysqld can avoid dependency on shared libaio, shared libraries
libmysqld.so or ha_innodb.so cannot link without it.
Given that the patch primarily addresses building tar.gz package, and
shared libraries mentioned above deemed less important than mysqld
executable, we accept shared lib dependency on libaio.so
http://lists.mysql.com/commits/102373
It is better than previous attempts to build the libmysqld,
as it also takes care of
1) -Wl,--no-undefined for shared libraries and
2) CLEAN_DIRECT_OUTPUT since there are now 2 libraries with
the same base output name