Description:
Building the mysql server (mysqld) all static i.e.
--enable-shared \
--with-mysqld-ldflags='-all-static' \
--with-client-ldflags='-all-static' \
$USE_OTHER_LIBC_DIR \
Causes mysqld to not run from a standalone process, it will only execute properly with mysqlmanager.
Here is the reason below
open("/var/lib/mysql/ibdata1", O_RDWR) = 8
fcntl(8, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
open("/var/lib/mysql/ib_logfile0", O_RDWR) = 13
fcntl(13, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
open("/var/lib/mysql/ib_logfile1", O_RDWR) = 14
fcntl(14, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
mmap(NULL, 2101248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2d4e9c4000
mmap(NULL, 1359986688, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2d4ebc5000
pread(13, "\0\0\0\0\0\7GX\0\0\0\25d\352\r@$\357M@\1\0\0\0\377\377"..., 512, 512) = 512
pread(13, "\0\0\0\0\0\7GY\0\0\0\25d\352\r@$\357M@\1\0\0\0\377\377"..., 512, 1536) = 512
pread(13, "\0\0\0\0\0\7GY\0\0\0\25d\352\r@$\357M@\1\0\0\0\377\377"..., 512, 1536) = 512
pread(13, "\0\0\0\0\0\0\0\25?\372\320\0\0\0\0\0 \0\0\0\0\0\0\0"..., 2048, 0) = 2048
pread(8, "\341W\7n\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\25d\352\r@\0\0\0"..., 16384, 81920) = 16384
mmap(NULL, 2117632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2d9fcc1000
pread(8, "\341W\7n\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\25d\352\r@\0\0\0"..., 1048576, 1048576) = 1048576
pread(8, "\r@\215W\0\0\3q\0\0\3m\377\377\377\377\0\0\0\25d\314\216"..., 1048576, 2097152) = 1048576
pread(14, "\212\262u\7\1@\0/\0\7GSnfo\1\0\0\0\0\0\0\0\0vern.fs@"..., 65536, 82791424) = 65536
pread(14, "\212\262u\7\1@\0/\0\7GSnfo\1\0\0\0\0\0\0\0\0vern.fs@"..., 512, 82791424) = 512
time(NULL) = 1179341853
kill(28977, SIGRTMIN) = -1 EPERM (Operation not permitted)
sched_yield() = 0
time(NULL) = 1179341853
rt_sigprocmask(SIG_SETMASK, NULL, [HUP INT QUIT PIPE TERM TSTP RTMIN], 8) = 0
rt_sigsuspend([HUP INT QUIT PIPE TERM TSTP]
Since mysql manager evokes the mysqld process via a IPC pipe, the server continues to execute, while invoking mysqld on the command line or via safe_mysqld will hang the process.
Here is a debug trace that shows post innodb setup
T@16384: | | | >_mymalloc
T@16384: | | | | enter: Size: 24
T@16384: | | | | exit: ptr: 0x1d1cc5c8
T@16384: | | | <_mymalloc
T@16384: | | | exit: fd: 8
T@16384: | | <create_temp_file
T@16384: | | >my_close
T@16384: | | | my: fd: 8 MyFlags: 16
T@16384: | | | >_myfree
T@16384: | | | | enter: ptr: 0x1d1cc5c8
T@16384: | | | <_myfree
T@16384: | | <my_close
Here are the compile options
export CC=/usr/bin/gcc
export CXX=/usr/bin/gcc
export MYSQL_RPMBUILD_TEST="no"
export LD_LIBARY_PATH=$LD_LIBARY_PATH:/lib64:/usr/lib64
export CFLAGS="-O3 -static -fomit-frame-pointer -ffixed-ebp -m64"
export CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
rpmbuild -ba --define '_with_static 1' mysql-5.0.41.spec
I like static builds, I don't like giving up 5% of resources to a dynamic load :)
How to repeat:
Build mysqld into a static build with these options
BuildMySQL "\
--enable-shared \
--with-mysqld-ldflags='-all-static' \
--with-client-ldflags='-all-static' \
$USE_OTHER_LIBC_DIR \
--with-extra-charsets=complex \
--with-comment=\"MySQL Community Edition (Flickr)\" \
--with-server-suffix='%{server_suffix}' \
--with-archive-storage-engine \
--with-innodb \
--with-ndbcluster \
--with-csv-storage-engine \
--with-example-storage-engine \
--with-blackhole-storage-engine \
--with-federated-storage-engine \
--with-big-tables $servertype"