This is done to get more performance when running in production.
Different Compilation Options Changing DBUG_ASSERT to Print to Error LogĪ debug binary has lots of code checks and asserts, that are not checked in production. The debug mysqld binary is still present if it is needed again in the future. Only the symbolic link to this file was deleted. Notice that the debug mysqld binary located at /usr/sbin/mysqld-debug was not deleted. Then, execute the following command to move the original mysqld release binary back into place: sudo mv /usr/sbin/mysqld-orig /usr/sbin/mysqldīe sure to replace /usr/sbin/mysqld with the path to your mysqld binary Then, execute the following command to delete the symbolic link: sudo rm /usr/sbin/mysqld If you want to restore your original mysqld binary, you can do it with the following process:: Then, link the mysqld path to the path of your debug mysqld binary: sudo ln -s /usr/sbin/mysqld-debug /usr/sbin/mysqldīe sure to replace /usr/sbin/mysqld with the path to your mysqld binary and to also replace ~/mariadb-10.3.14/sql/mysqld with the path to your debug mysqld binary.
Then, install the debug mysqld binary from your source tree: sudo install ~/mariadb-10.3.14/sql/mysqld /usr/sbin/mysqld-debug Note: Do not use the cp utility because that will change the file modification timestamp. Then, use the mv utility to rename the release mysqld binary: sudo mv /usr/sbin/mysqld /usr/sbin/mysqld-orig Most importantly, they replace the binary in a way which makes it trivial to revert back to the The commands shown below replace the release mysqld binary with the debug mysqld binary that you compiled. This binary can directly replace the one provided by the binary package that is placed on "/usr/bin/mysqld". Then you will have your "debugging enabled" mysqld binary in the sql/ directory. To build a "mysqld" binary with debugging enabled that uses the same parameters as the ones used in Debian/Ubuntu binary packages, you must do as follows (you must have a deb-src line of one of the MariaDB repositories on your /etc/apt/sources.list in order to do that): apt-get build-dep mariadb-10.2 One way to do this is to edit the script BUILD/compile-pentium64-maxĪnd add the -g3 last on the line with extra_flags, like this: extra_flags="$pentium64_cflags $fast_cflags -g3"Īfter that you can compile MariaDB with debugging symbols by just execution the above script. Just compiling with -g3 will make the binary much bigger but the slowdown of the server should be negligible. To build MariaDB with symbols, to get better stack traces and to be able to debug the binary with gdb, you need to supply the -g3 option to the gcc compiler. If this fails, you canīuilding Optimized Build With Debug Symbols
If you have a system other than 64 bit Intel/AMD on Linux you can use aĭifferent BUILD/.-debug-max file. The last command will produce a debug version of sql/mysqld.
Here is an example of how to compile MariaDB for debugging in your home directory with MariaDB 5.2.9 as an example: cd ~
A full debug binary will be notably slower than a normal binary (30%). Changing DBUG_ASSERT to Print to Error LogĬompiling MariaDB with full debug information includes all code symbols and also new code to do internal testing of structures and allow one to trace MariaDB execution.Temporarily Installing your Debug Build.
Building Optimized Build With Debug Symbols.Example of Compiling MariaDB for Debugging Using Build Scripts.Compiling MariaDB for Debugging Using Build Scripts.Compiling MariaDB for Debugging Using the CMAKE_BUILD_TYPE Option.