Description:
The current Community BK tree (5.0.51) won't compile on my Gentoo boxes running gcc 4.2.2:
g++ -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/var/mysql/50055\"" -DDATADIR="\"/var/mysql/50055/data\"" -DSHAREDIR="\"/var/mysql/50055/share/mysql\"" -DHAVE_CONFIG_H -I. -I../include -I../innobase/include -I../innobase/include -I../include -I../include -I../regex -I. -g -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC -fno-implicit-templates -fno-exceptions -fno-rtti -MT slave.o -MD -MP -MF .deps/slave.Tpo -c -o slave.o slave.cc
slave.cc: In function ‘int exec_relay_log_event(THD*, RELAY_LOG_INFO*)’:
slave.cc:3348: error: expected `;' before ‘if’
make[4]: *** [slave.o] Error 1
The problem occurs due to the lack of a terminating semicolon for the DBUG_PRINT() statement preceding line 3348:
3340 DBUG_PRINT("info", ("thd->options: %s",
3341 (thd->options & OPTION_BEGIN) ? "OPTION_BEGIN" : ""))
3342
3343 /*
3344 Protect against common user error of setting the counter to 1
3345 instead of 2 while recovering from an insert which used auto_increm ent,
3346 rand or user var.
3347 */
3348 if (rli->slave_skip_counter &&
3349 !((type_code == INTVAR_EVENT ||
3350 type_code == RAND_EVENT ||
3351 type_code == USER_VAR_EVENT) &&
3352 rli->slave_skip_counter == 1) &&
3353 #if MYSQL_VERSION_ID < 50100
3354 /*
3355 Decrease the slave skip counter only if we are not inside
3356 a transaction or the slave skip counter is more than
3357 1. The slave skip counter will be decreased from 1 to 0
3358 when reaching the final ROLLBACK, COMMIT, or XID_EVENT.
3359 */
3360 (!(thd->options & OPTION_BEGIN) || rli->slave_skip_counter > 1) & &
3361 #endif
3362 /*
3363 The events from ourselves which have something to do with the r elay
3364 log itself must be skipped, true, but they mustn't decrement
3365 rli->slave_skip_counter, because the user is supposed to not se e
3366 these events (they are not in the master's binlog) and if we
3367 decremented, START SLAVE would for example decrement when it se es
3368 the Rotate, so the event which the user probably wanted to skip
3369 would not be skipped.
3370 */
3371 !(ev->server_id == (uint32) ::server_id &&
3372 (type_code == ROTATE_EVENT ||
3373 type_code == STOP_EVENT ||
3374 type_code == START_EVENT_V3 ||
3375 type_code == FORMAT_DESCRIPTION_EVENT)))
3376 --rli->slave_skip_counter;
How to repeat:
I'm not sure you'll be able to repeat it. This compilation failure occurs for me only on my Gentoo boxes, and only for the Community tree, even though the code is similar for other trees.
Nevertheless, it's incorrect for DBUG_PRINT() not to be terminated by a semicolon, I think.
Suggested fix:
Add a semicolon.